diff --git a/tools/platformio-build.py b/tools/platformio-build.py index d6d935a57e..2cc1efae65 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -84,24 +84,24 @@ def scons_patched_match_splitext(path, suffixes=None): LIBSOURCE_DIRS=[ join(FRAMEWORK_DIR, "libraries") - ] -) + ], -env.Replace( LINKFLAGS=[ - "-Os", - "-nostdlib", - "-Wl,--no-check-sections", - "-Wl,-static", - "-Wl,--gc-sections", "-Wl,-wrap,system_restart_local", "-Wl,-wrap,spi_flash_read", - "-u", "app_entry", - "-u", "_printf_float", - "-u", "_scanf_float" + "-u", "app_entry" ] ) +# remove LINKFLAGS defined in main.py and keep user custom flags +try: + index = env['LINKFLAGS'].index("call_user_start") + if index > 0 and env['LINKFLAGS'][index - 1] == "-u": + del env['LINKFLAGS'][index - 1] + env['LINKFLAGS'].remove("call_user_start") +except IndexError: + pass + flatten_cppdefines = env.Flatten(env['CPPDEFINES']) #