@@ -51,11 +51,51 @@ def scons_patched_match_splitext(path, suffixes=None):
5151
5252
5353env .Append (
54+ ASFLAGS = ["-x" , "assembler-with-cpp" ],
55+
56+ CFLAGS = [
57+ "-std=gnu99" ,
58+ "-Wpointer-arith" ,
59+ "-Wno-implicit-function-declaration" ,
60+ "-Wl,-EL" ,
61+ "-fno-inline-functions" ,
62+ "-nostdlib"
63+ ],
64+
5465 CCFLAGS = [
66+ "-Os" , # optimize for size
67+ "-mlongcalls" ,
68+ "-mtext-section-literals" ,
69+ "-falign-functions=4" ,
70+ "-U__STRICT_ANSI__" ,
71+ "-ffunction-sections" ,
72+ "-fdata-sections" ,
5573 "-Wall"
5674 ],
5775
76+ CXXFLAGS = [
77+ "-fno-rtti" ,
78+ "-fno-exceptions" ,
79+ "-std=c++11"
80+ ],
81+
82+ LINKFLAGS = [
83+ "-Os" ,
84+ "-nostdlib" ,
85+ "-Wl,--no-check-sections" ,
86+ "-Wl,-static" ,
87+ "-Wl,--gc-sections" ,
88+ "-Wl,-wrap,system_restart_local" ,
89+ "-Wl,-wrap,spi_flash_read" ,
90+ "-u" , "app_entry" ,
91+ "-u" , "_printf_float" ,
92+ "-u" , "_scanf_float"
93+ ],
94+
5895 CPPDEFINES = [
96+ ("F_CPU" , "$BOARD_F_CPU" ),
97+ "__ets__" ,
98+ "ICACHE_FLASH" ,
5999 ("ARDUINO" , 10805 ),
60100 ("ARDUINO_BOARD" , '\\ "PLATFORMIO_%s\\ "'
61101 % env .BoardConfig ().id .upper ()),
@@ -84,23 +124,11 @@ def scons_patched_match_splitext(path, suffixes=None):
84124
85125 LIBSOURCE_DIRS = [
86126 join (FRAMEWORK_DIR , "libraries" )
87- ],
88-
89- LINKFLAGS = [
90- "-Wl,-wrap,system_restart_local" ,
91- "-Wl,-wrap,spi_flash_read" ,
92- "-u" , "app_entry"
93127 ]
94128)
95129
96- # remove LINKFLAGS defined in main.py and keep user custom flags
97- try :
98- index = env ['LINKFLAGS' ].index ("call_user_start" )
99- if index > 0 and env ['LINKFLAGS' ][index - 1 ] == "-u" :
100- del env ['LINKFLAGS' ][index - 1 ]
101- env ['LINKFLAGS' ].remove ("call_user_start" )
102- except IndexError :
103- pass
130+ # copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
131+ env .Append (ASFLAGS = env .get ("CCFLAGS" , [])[:])
104132
105133flatten_cppdefines = env .Flatten (env ['CPPDEFINES' ])
106134
0 commit comments