2222https://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
2730from os .path import isdir ,join
@@ -58,16 +61,17 @@ def scons_patched_match_splitext(path, suffixes=None):
5861env .Append (
5962ASFLAGS = ["-x" ,"assembler-with-cpp" ],
6063
64+ # General options that are passed to the C compiler (C only; not C++)
6165CFLAGS = [
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
7175CCFLAGS = [
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
8591CXXFLAGS = [
8692"-fno-rtti" ,
8793"-std=gnu++17"
8894 ],
8995
96+ # General user options passed to the linker
9097LINKFLAGS = [
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")
108118CPPDEFINES = [
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
118129CPPPATH = [
119130join (FRAMEWORK_DIR ,"tools" ,"sdk" ,"include" ),
120131join (FRAMEWORK_DIR ,"cores" ,env .BoardConfig ().get ("build.core" )),
121132join (platform .get_package_dir ("toolchain-xtensa" ),"include" )
122133 ],
123134
135+ # The list of directories that will be searched for libraries
124136LIBPATH = [
125137join ("$BUILD_DIR" ,"ld" ),# eagle.app.v6.common.ld
126138join (FRAMEWORK_DIR ,"tools" ,"sdk" ,"lib" ),
127139join (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
130143LIBS = [
131144"hal" ,"phy" ,"pp" ,"net80211" ,"wpa" ,"crypto" ,"main" ,
132145"wps" ,"bearssl" ,"espnow" ,"smartconfig" ,"airkiss" ,"wpa2" ,