From 019fab4e02e613d5cd790b3c55de461969cb41db Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Sat, 26 Jun 2021 04:38:46 +0300 Subject: [PATCH] pio: use CCFLAGS for -Werror (#8175) Also adds some comments referencing SCons documentation --- tools/platformio-build.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/platformio-build.py b/tools/platformio-build.py index de0c019e2..8998fcde7 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -22,6 +22,9 @@ kinds of creative coding, interactive objects, spaces or physical experiences. https://arduino.cc/en/Reference/HomePage """ +# For SCons documentation, see: +# https://scons.org/doc/latest + # Extends: https://github.com/platformio/platform-espressif8266/blob/develop/builder/main.py from os.path import isdir, join @@ -58,16 +61,17 @@ if gzip_fw: env.Append( ASFLAGS=["-x", "assembler-with-cpp"], + # General options that are passed to the C compiler (C only; not C++) CFLAGS=[ "-std=gnu17", "-Wpointer-arith", "-Wno-implicit-function-declaration", - "-Werror=return-type", "-Wl,-EL", "-fno-inline-functions", "-nostdlib" ], + # General options that are passed to the C and C++ compilers CCFLAGS=[ "-Os", # optimize for size "-mlongcalls", @@ -78,15 +82,18 @@ env.Append( "-ffunction-sections", "-fdata-sections", "-Wall", + "-Werror=return-type", "-free", "-fipa-pta" ], + # General options that are passed to the C++ compiler CXXFLAGS=[ "-fno-rtti", "-std=gnu++17" ], + # General user options passed to the linker LINKFLAGS=[ "-Os", "-nostdlib", @@ -105,6 +112,9 @@ env.Append( "-u", "_UserExceptionVector" ], + # A platform independent specification of C preprocessor definitions as either: + # - -DFLAG as "FLAG" + # - -DFLAG=VALUE as ("FLAG", "VALUE") CPPDEFINES=[ ("F_CPU", "$BOARD_F_CPU"), "__ets__", @@ -115,18 +125,21 @@ env.Append( "LWIP_OPEN_SRC" ], + # The list of directories that the C preprocessor will search for include directories CPPPATH=[ join(FRAMEWORK_DIR, "tools", "sdk", "include"), join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")), join(platform.get_package_dir("toolchain-xtensa"), "include") ], + # The list of directories that will be searched for libraries LIBPATH=[ join("$BUILD_DIR", "ld"), # eagle.app.v6.common.ld join(FRAMEWORK_DIR, "tools", "sdk", "lib"), join(FRAMEWORK_DIR, "tools", "sdk", "ld") ], + # A list of one or more libraries that will be linked with any executable programs created by this environment LIBS=[ "hal", "phy", "pp", "net80211", "wpa", "crypto", "main", "wps", "bearssl", "espnow", "smartconfig", "airkiss", "wpa2",