Skip to content

Commit 019fab4

Browse files
authored
pio: use CCFLAGS for -Werror (#8175)
Also adds some comments referencing SCons documentation
1 parent d2a3cbe commit 019fab4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tools/platformio-build.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
https://arduino.cc/en/Reference/HomePage
2323
"""
2424

25+
# For SCons documentation, see:
26+
# https://scons.org/doc/latest
27+
2528
# Extends: https://github.com/platformio/platform-espressif8266/blob/develop/builder/main.py
2629

2730
from os.path import isdir, join
@@ -58,16 +61,17 @@ def scons_patched_match_splitext(path, suffixes=None):
5861
env.Append(
5962
ASFLAGS=["-x", "assembler-with-cpp"],
6063

64+
# General options that are passed to the C compiler (C only; not C++)
6165
CFLAGS=[
6266
"-std=gnu17",
6367
"-Wpointer-arith",
6468
"-Wno-implicit-function-declaration",
65-
"-Werror=return-type",
6669
"-Wl,-EL",
6770
"-fno-inline-functions",
6871
"-nostdlib"
6972
],
7073

74+
# General options that are passed to the C and C++ compilers
7175
CCFLAGS=[
7276
"-Os", # optimize for size
7377
"-mlongcalls",
@@ -78,15 +82,18 @@ def scons_patched_match_splitext(path, suffixes=None):
7882
"-ffunction-sections",
7983
"-fdata-sections",
8084
"-Wall",
85+
"-Werror=return-type",
8186
"-free",
8287
"-fipa-pta"
8388
],
8489

90+
# General options that are passed to the C++ compiler
8591
CXXFLAGS=[
8692
"-fno-rtti",
8793
"-std=gnu++17"
8894
],
8995

96+
# General user options passed to the linker
9097
LINKFLAGS=[
9198
"-Os",
9299
"-nostdlib",
@@ -105,6 +112,9 @@ def scons_patched_match_splitext(path, suffixes=None):
105112
"-u", "_UserExceptionVector"
106113
],
107114

115+
# A platform independent specification of C preprocessor definitions as either:
116+
# - -DFLAG as "FLAG"
117+
# - -DFLAG=VALUE as ("FLAG", "VALUE")
108118
CPPDEFINES=[
109119
("F_CPU", "$BOARD_F_CPU"),
110120
"__ets__",
@@ -115,18 +125,21 @@ def scons_patched_match_splitext(path, suffixes=None):
115125
"LWIP_OPEN_SRC"
116126
],
117127

128+
# The list of directories that the C preprocessor will search for include directories
118129
CPPPATH=[
119130
join(FRAMEWORK_DIR, "tools", "sdk", "include"),
120131
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")),
121132
join(platform.get_package_dir("toolchain-xtensa"), "include")
122133
],
123134

135+
# The list of directories that will be searched for libraries
124136
LIBPATH=[
125137
join("$BUILD_DIR", "ld"), # eagle.app.v6.common.ld
126138
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
127139
join(FRAMEWORK_DIR, "tools", "sdk", "ld")
128140
],
129141

142+
# A list of one or more libraries that will be linked with any executable programs created by this environment
130143
LIBS=[
131144
"hal", "phy", "pp", "net80211", "wpa", "crypto", "main",
132145
"wps", "bearssl", "espnow", "smartconfig", "airkiss", "wpa2",

0 commit comments

Comments
 (0)