@@ -139,12 +139,8 @@ def scons_patched_match_splitext(path, suffixes=None):
139
139
join (FRAMEWORK_DIR , "tools" , "sdk" , "ld" )
140
140
],
141
141
142
- # A list of one or more libraries that will be linked with any executable programs created by this environment
143
- LIBS = [
144
- "hal" , "phy" , "pp" , "net80211" , "wpa" , "crypto" , "main" ,
145
- "wps" , "bearssl" , "espnow" , "smartconfig" , "airkiss" , "wpa2" ,
146
- "m" , "c" , "gcc"
147
- ],
142
+ # LIBS is set at the bottom of the builder script
143
+ # where we know about all system libraries to be included
148
144
149
145
LIBSOURCE_DIRS = [
150
146
join (FRAMEWORK_DIR , "libraries" )
@@ -218,43 +214,44 @@ def scons_patched_match_splitext(path, suffixes=None):
218
214
#
219
215
# lwIP
220
216
#
217
+ lwip_lib = None
221
218
if "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY" in flatten_cppdefines :
222
219
env .Append (
223
220
CPPDEFINES = [("TCP_MSS" , 536 ), ("LWIP_FEATURES" , 1 ), ("LWIP_IPV6" , 1 )],
224
221
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
225
- LIBS = ["lwip6-536-feat" ]
226
222
)
223
+ lwip_lib = "lwip6-536-feat"
227
224
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH" in flatten_cppdefines :
228
225
env .Append (
229
226
CPPDEFINES = [("TCP_MSS" , 1460 ), ("LWIP_FEATURES" , 1 ), ("LWIP_IPV6" , 1 )],
230
227
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
231
- LIBS = ["lwip6-1460-feat" ]
232
228
)
229
+ lwip_lib = "lwip6-1460-feat"
233
230
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH" in flatten_cppdefines :
234
231
env .Append (
235
232
CPPDEFINES = [("TCP_MSS" , 1460 ), ("LWIP_FEATURES" , 1 ), ("LWIP_IPV6" , 0 )],
236
233
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
237
- LIBS = ["lwip2-1460-feat" ]
238
234
)
235
+ lwip_lib = "lwip2-1460-feat"
239
236
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH" in flatten_cppdefines :
240
237
env .Append (
241
238
CPPDEFINES = [("TCP_MSS" , 536 ), ("LWIP_FEATURES" , 0 ), ("LWIP_IPV6" , 0 )],
242
239
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
243
- LIBS = ["lwip2-536" ]
244
240
)
241
+ lwip_lib = "lwip2-536"
245
242
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH" in flatten_cppdefines :
246
243
env .Append (
247
244
CPPDEFINES = [("TCP_MSS" , 1460 ), ("LWIP_FEATURES" , 0 ), ("LWIP_IPV6" , 0 )],
248
245
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
249
- LIBS = ["lwip2-1460" ]
250
246
)
247
+ lwip_lib = "lwip2-1460"
251
248
# PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY (default)
252
249
else :
253
250
env .Append (
254
251
CPPDEFINES = [("TCP_MSS" , 536 ), ("LWIP_FEATURES" , 1 ), ("LWIP_IPV6" , 0 )],
255
252
CPPPATH = [join (FRAMEWORK_DIR , "tools" , "sdk" , "lwip2" , "include" )],
256
- LIBS = ["lwip2-536-feat" ]
257
253
)
254
+ lwip_lib = "lwip2-536-feat"
258
255
259
256
#
260
257
# Waveform
@@ -266,17 +263,17 @@ def scons_patched_match_splitext(path, suffixes=None):
8000
266
263
#
267
264
# Exceptions
268
265
#
266
+ stdcpp_lib = None
269
267
if "PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS" in flatten_cppdefines :
270
268
env .Append (
271
269
CXXFLAGS = ["-fexceptions" ],
272
- LIBS = ["stdc++-exc" ]
273
270
)
271
+ stdcpp_lib = "stdc++-exc"
274
272
else :
275
273
env .Append (
276
274
CXXFLAGS = ["-fno-exceptions" ],
277
- LIBS = ["stdc++" ]
278
275
)
279
-
276
+ stdcpp_lib = "stdc++"
280
277
#
281
278
# VTables
282
279
#
@@ -355,6 +352,15 @@ def scons_patched_match_splitext(path, suffixes=None):
355
352
assert mmu_flags
356
353
env .Append (CPPDEFINES = mmu_flags )
357
354
355
+ # A list of one or more libraries that will be linked with any executable programs created by this environment
356
+ # We do this at this point so that we can put the libraries in their correct order more easily
357
+ env .Append (
358
+ LIBS = [
359
+ "hal" , "phy" , "pp" , "net80211" , lwip_lib , "wpa" , "crypto" , "main" ,
360
+ "wps" , "bearssl" , "espnow" , "smartconfig" , "airkiss" , "wpa2" ,
361
+ stdcpp_lib , "m" , "c" , "gcc"
362
+ ]
363
+ )
358
364
359
365
# Build the eagle.app.v6.common.ld linker file
360
366
app_ld = env .Command (
0 commit comments