Skip to content

Commit 8eecfd2

Browse files
ivankravetsme-no-dev
authored andcommitted
Sync flags with platform.txt; Custom partitions per board (espressif#875)
* Sync flags with platform.txt * Add support for custom partitions per board * Add "-fstack-protector" to CCFLAGS
1 parent a907113 commit 8eecfd2

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tools/platformio-build.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@
3636

3737
env.Prepend(
3838
CPPDEFINES=[
39-
("ARDUINO", 10610),
40-
"ARDUINO_ARCH_ESP32"
39+
("ARDUINO", 10805),
40+
"ARDUINO_ARCH_ESP32",
41+
("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', ""))
4142
],
4243

4344
CFLAGS=["-Wno-old-style-declaration"],
4445

4546
CCFLAGS=[
4647
"-Wno-error=deprecated-declarations",
48+
"-Wno-error=unused-function",
4749
"-Wno-unused-parameter",
48-
"-Wno-sign-compare"
50+
"-Wno-sign-compare",
51+
"-fstack-protector"
4952
],
5053

5154
CPPPATH=[
@@ -115,7 +118,7 @@ def _get_board_flash_mode(env):
115118

116119
env.Append(
117120
__get_board_flash_mode=_get_board_flash_mode,
118-
121+
119122
LIBSOURCE_DIRS=[
120123
join(FRAMEWORK_DIR, "libraries")
121124
],
@@ -174,11 +177,11 @@ def _get_board_flash_mode(env):
174177
#
175178
# Generate partition table
176179
#
177-
178180
partition_table = env.Command(
179181
join("$BUILD_DIR", "partitions.bin"),
180-
join(FRAMEWORK_DIR, "tools", "partitions", "default.csv"),
181-
env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' %
182-
join(FRAMEWORK_DIR, "tools", "gen_esp32part.py"),
182+
join(FRAMEWORK_DIR, "tools", "partitions",
183+
"%s.csv" % env.BoardConfig().get("build.partitions", "default")),
184+
env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join(
185+
FRAMEWORK_DIR, "tools", "gen_esp32part.py"),
183186
"Generating partitions $TARGET"))
184187
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)

0 commit comments

Comments
 (0)