From 3ecf698255d1d78bb6bd4943d9aac9c5326e6d34 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 20 Feb 2017 21:59:41 +0200 Subject: [PATCH] Move espidf specific flags to appropriate builder --- builder/frameworks/espidf.py | 38 ++++++++++++++++++++++++------------ builder/main.py | 20 +++---------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 6b760f2..dccdcf8 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -98,15 +98,8 @@ def build_component(path): def build_espidf_bootloader(): envsafe = env.Clone() + envsafe.Append(CPPDEFINES=[("BOOTLOADER_BUILD", 1)]) envsafe.Replace( - CPPDEFINES=[ - "ESP_PLATFORM", - "WITH_POSIX", - ("BOOTLOADER_BUILD", 1), - ("IDF_VER", '\\"%s\\"' % - platform.get_package_version("framework-espidf")) - ], - LIBPATH=[ join(FRAMEWORK_DIR, "components", "esp32", "ld"), join(FRAMEWORK_DIR, "components", "esp32", "lib"), @@ -237,12 +230,31 @@ for root, dirs, _ in walk(join( env.Append(CPPPATH=[join(root, d)]) -env.Append( - LIBSOURCE_DIRS=[ - join(FRAMEWORK_DIR, "libraries") +env.Prepend( + CFLAGS=["-Wno-old-style-declaration"], + + CPPDEFINES=[ + "WITH_POSIX", + ("IDF_VER", '\\"%s\\"' % + platform.get_package_version("framework-espidf")) ], + CCFLAGS=[ + "-Wall", + "-Werror=all", + "-Wno-error=deprecated-declarations", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-sign-compare", + "-Wno-error=unused-function" + ], + + LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")] +) + +env.Append( LINKFLAGS=[ + "-u", "__cxa_guard_dummy", "-T", "esp32.common.ld", "-T", "esp32.rom.ld", "-T", "esp32.peripherals.ld" @@ -265,11 +277,11 @@ partition_table = env.Command( "partitions_singleapp.csv"), env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join( FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py"), - "Generating partitions $TARGET")) + "Generating partitions $TARGET")) + env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table) - # # Generate linker script # diff --git a/builder/main.py b/builder/main.py index 43568ce..401eebf 100644 --- a/builder/main.py +++ b/builder/main.py @@ -42,22 +42,13 @@ env.Replace( ASFLAGS=["-x", "assembler-with-cpp"], - CFLAGS=[ - "-std=gnu99", - "-Wno-old-style-declaration" - ], + CFLAGS=["-std=gnu99"], CCFLAGS=[ "%s" % "-Os" if env.subst("$PIOFRAMEWORK") == "arduino" else "-Og", "-g3", "-nostdlib", - "-Wall", - "-Werror=all", - "-Wno-error=deprecated-declarations", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-sign-compare", - "-Wno-error=unused-function", + "-Wpointer-arith", "-Wno-error=unused-but-set-variable", "-Wno-error=unused-variable", "-mlongcalls", @@ -77,17 +68,13 @@ env.Replace( "ESP_PLATFORM", ("F_CPU", "$BOARD_F_CPU"), "HAVE_CONFIG_H", - ("MBEDTLS_CONFIG_FILE", '\\"mbedtls/esp_config.h\\"'), - "WITH_POSIX", - ("IDF_VER", '\\"%s\\"' % - platform.get_package_version("framework-espidf")) + ("MBEDTLS_CONFIG_FILE", '\\"mbedtls/esp_config.h\\"') ], LINKFLAGS=[ "-nostdlib", "-Wl,-static", "-u", "call_user_start_cpu0", - "-u", "__cxa_guard_dummy", "-Wl,--undefined=uxTopUsedPriority", "-Wl,--gc-sections" ], @@ -174,7 +161,6 @@ target_upload = env.Alias( env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]) env.AlwaysBuild(target_upload) - # # Default targets #