2019-06-13 17:55:51 +08:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-04-08 12:16:17 +08:00
|
|
|
idf_component_register(SRCS "patches/esp_rom_longjmp.S"
|
|
|
|
INCLUDE_DIRS include "${target}"
|
|
|
|
PRIV_REQUIRES soc)
|
2019-11-28 21:10:31 +08:00
|
|
|
|
2019-03-14 17:29:32 +08:00
|
|
|
if(BOOTLOADER_BUILD)
|
2019-05-10 10:53:08 +08:00
|
|
|
set(scripts
|
2019-08-08 13:44:24 +10:00
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-funcs.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
2019-05-10 10:53:08 +08:00
|
|
|
)
|
2020-01-17 11:47:08 +08:00
|
|
|
if(target STREQUAL "esp32s2")
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2019-05-27 14:29:43 +08:00
|
|
|
endif()
|
2019-08-08 13:44:24 +10:00
|
|
|
|
2021-09-02 05:12:49 +10:00
|
|
|
if(target STREQUAL "esp32")
|
|
|
|
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-02-25 01:21:41 +05:30
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2019-06-04 19:05:33 +08:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-11-28 21:10:31 +08:00
|
|
|
else() # Regular app build
|
2019-06-13 17:55:51 +08:00
|
|
|
set(scripts
|
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-data.ld")
|
|
|
|
|
2019-11-28 21:10:31 +08:00
|
|
|
if(target STREQUAL "esp32")
|
2019-06-13 17:55:51 +08:00
|
|
|
list(APPEND scripts "${target}/ld/${target}.rom.syscalls.ld")
|
2019-03-14 17:29:32 +08:00
|
|
|
|
2019-05-27 14:29:43 +08:00
|
|
|
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2019-08-08 13:44:24 +10:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.newlib-funcs.ld")
|
2020-01-10 12:58:54 +08:00
|
|
|
if(NOT CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS)
|
|
|
|
# If SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS option is defined
|
|
|
|
# then all time functions from the ROM memory will not be linked.
|
|
|
|
# Instead, those functions can be used from the toolchain by ESP-IDF.
|
2020-03-17 17:02:24 +08:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-time.ld")
|
2020-01-10 12:58:54 +08:00
|
|
|
endif()
|
2019-03-14 17:29:32 +08:00
|
|
|
|
2020-02-07 16:05:37 +05:30
|
|
|
# Include in newlib nano from ROM only if SPIRAM cache workaround is disabled
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.newlib-nano.ld")
|
|
|
|
endif()
|
|
|
|
|
2019-05-27 14:29:43 +08:00
|
|
|
endif()
|
2019-03-14 17:29:32 +08:00
|
|
|
|
2019-05-27 14:29:43 +08:00
|
|
|
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
2019-08-08 13:44:24 +10:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld")
|
2019-05-27 14:29:43 +08:00
|
|
|
endif()
|
2019-03-29 12:37:51 +08:00
|
|
|
|
2020-02-25 01:21:41 +05:30
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2020-01-17 11:47:08 +08:00
|
|
|
elseif(target STREQUAL "esp32s2")
|
|
|
|
# no SPIRAM workaround for esp32s2
|
2020-02-25 01:21:41 +05:30
|
|
|
# no nano formatting function in ROM
|
2019-06-13 17:55:51 +08:00
|
|
|
|
2020-01-17 11:47:08 +08:00
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-funcs.ld"
|
|
|
|
"esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2020-01-23 18:02:29 +01:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-nano.ld")
|
|
|
|
endif()
|
2019-03-14 17:29:32 +08:00
|
|
|
endif()
|
2019-05-27 14:29:43 +08:00
|
|
|
|
2019-08-08 13:44:24 +10:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-06-13 17:55:51 +08:00
|
|
|
|
2021-04-08 12:16:17 +08:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=longjmp")
|
2019-03-14 17:29:32 +08:00
|
|
|
endif()
|