From 8eecfd21b41838761ecf5a3cb62446e4d53dce36 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 26 Nov 2017 02:22:42 +0200 Subject: [PATCH] Sync flags with platform.txt; Custom partitions per board (#875) * Sync flags with platform.txt * Add support for custom partitions per board * Add "-fstack-protector" to CCFLAGS --- tools/platformio-build.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 9e197e33..c3950451 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -36,16 +36,19 @@ assert isdir(FRAMEWORK_DIR) env.Prepend( CPPDEFINES=[ - ("ARDUINO", 10610), - "ARDUINO_ARCH_ESP32" + ("ARDUINO", 10805), + "ARDUINO_ARCH_ESP32", + ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")) ], CFLAGS=["-Wno-old-style-declaration"], CCFLAGS=[ "-Wno-error=deprecated-declarations", + "-Wno-error=unused-function", "-Wno-unused-parameter", - "-Wno-sign-compare" + "-Wno-sign-compare", + "-fstack-protector" ], CPPPATH=[ @@ -115,7 +118,7 @@ def _get_board_flash_mode(env): env.Append( __get_board_flash_mode=_get_board_flash_mode, - + LIBSOURCE_DIRS=[ join(FRAMEWORK_DIR, "libraries") ], @@ -174,11 +177,11 @@ env.Prepend(LIBS=libs) # # Generate partition table # - partition_table = env.Command( join("$BUILD_DIR", "partitions.bin"), - join(FRAMEWORK_DIR, "tools", "partitions", "default.csv"), - env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % - join(FRAMEWORK_DIR, "tools", "gen_esp32part.py"), + join(FRAMEWORK_DIR, "tools", "partitions", + "%s.csv" % env.BoardConfig().get("build.partitions", "default")), + env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join( + FRAMEWORK_DIR, "tools", "gen_esp32part.py"), "Generating partitions $TARGET")) env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)