mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-04 18:03:20 +03:00
Respect linking order of libraries for PlatformIO (#8263)
* Respect linking order of libraries Now has the same order as the Arduino IDE does with its platform.txt * Remove double-referenced libs * Change implementation style Instead of injecting at magic indices, which might break when some other extra-scripts inject other libraries, let's create the LIBS array at the bottom in easy to understand and correct order.
This commit is contained in:
parent
9f30f2469f
commit
f7951e6842
@ -139,12 +139,8 @@ env.Append(
|
||||
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",
|
||||
"m", "c", "gcc"
|
||||
],
|
||||
# LIBS is set at the bottom of the builder script
|
||||
# where we know about all system libraries to be included
|
||||
|
||||
LIBSOURCE_DIRS=[
|
||||
join(FRAMEWORK_DIR, "libraries")
|
||||
@ -218,43 +214,44 @@ else: #(default) if "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703" in flatten_c
|
||||
#
|
||||
# lwIP
|
||||
#
|
||||
lwip_lib = None
|
||||
if "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 1)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip6-536-feat"]
|
||||
)
|
||||
lwip_lib = "lwip6-536-feat"
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 1)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip6-1460-feat"]
|
||||
)
|
||||
lwip_lib = "lwip6-1460-feat"
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-1460-feat"]
|
||||
)
|
||||
lwip_lib = "lwip2-1460-feat"
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 0), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-536"]
|
||||
)
|
||||
lwip_lib = "lwip2-536"
|
||||
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 1460), ("LWIP_FEATURES", 0), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-1460"]
|
||||
)
|
||||
lwip_lib = "lwip2-1460"
|
||||
# PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY (default)
|
||||
else:
|
||||
env.Append(
|
||||
CPPDEFINES=[("TCP_MSS", 536), ("LWIP_FEATURES", 1), ("LWIP_IPV6", 0)],
|
||||
CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
|
||||
LIBS=["lwip2-536-feat"]
|
||||
)
|
||||
lwip_lib = "lwip2-536-feat"
|
||||
|
||||
#
|
||||
# Waveform
|
||||
@ -266,17 +263,17 @@ if "PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PHASE" in flatten_cppdefines:
|
||||
#
|
||||
# Exceptions
|
||||
#
|
||||
stdcpp_lib = None
|
||||
if "PIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS" in flatten_cppdefines:
|
||||
env.Append(
|
||||
CXXFLAGS=["-fexceptions"],
|
||||
LIBS=["stdc++-exc"]
|
||||
)
|
||||
stdcpp_lib = "stdc++-exc"
|
||||
else:
|
||||
env.Append(
|
||||
CXXFLAGS=["-fno-exceptions"],
|
||||
LIBS=["stdc++"]
|
||||
)
|
||||
|
||||
stdcpp_lib = "stdc++"
|
||||
#
|
||||
# VTables
|
||||
#
|
||||
@ -355,6 +352,15 @@ else:
|
||||
assert mmu_flags
|
||||
env.Append(CPPDEFINES=mmu_flags)
|
||||
|
||||
# A list of one or more libraries that will be linked with any executable programs created by this environment
|
||||
# We do this at this point so that we can put the libraries in their correct order more easily
|
||||
env.Append(
|
||||
LIBS=[
|
||||
"hal", "phy", "pp", "net80211", lwip_lib, "wpa", "crypto", "main",
|
||||
"wps", "bearssl", "espnow", "smartconfig", "airkiss", "wpa2",
|
||||
stdcpp_lib, "m", "c", "gcc"
|
||||
]
|
||||
)
|
||||
|
||||
# Build the eagle.app.v6.common.ld linker file
|
||||
app_ld = env.Command(
|
||||
|
Loading…
x
Reference in New Issue
Block a user