2019-06-13 05:55:51 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-04-08 00:16:17 -04:00
|
|
|
idf_component_register(SRCS "patches/esp_rom_longjmp.S"
|
|
|
|
INCLUDE_DIRS include "${target}"
|
|
|
|
PRIV_REQUIRES soc)
|
2019-11-28 08:10:31 -05:00
|
|
|
|
2019-03-14 05:29:32 -04:00
|
|
|
if(BOOTLOADER_BUILD)
|
2019-05-09 22:53:08 -04:00
|
|
|
set(scripts
|
2019-08-07 23:44:24 -04:00
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-funcs.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
2019-05-09 22:53:08 -04:00
|
|
|
)
|
2020-01-16 22:47:08 -05:00
|
|
|
if(target STREQUAL "esp32s2")
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2019-05-27 02:29:43 -04:00
|
|
|
endif()
|
2019-08-07 23:44:24 -04:00
|
|
|
|
2020-02-24 14:51:41 -05:00
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2019-06-04 07:05:33 -04:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-11-28 08:10:31 -05:00
|
|
|
else() # Regular app build
|
2019-06-13 05:55:51 -04:00
|
|
|
set(scripts
|
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-data.ld")
|
|
|
|
|
2019-11-28 08:10:31 -05:00
|
|
|
if(target STREQUAL "esp32")
|
2019-06-13 05:55:51 -04:00
|
|
|
list(APPEND scripts "${target}/ld/${target}.rom.syscalls.ld")
|
2019-03-14 05:29:32 -04:00
|
|
|
|
2019-05-27 02:29:43 -04:00
|
|
|
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2019-08-07 23:44:24 -04:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.newlib-funcs.ld")
|
2020-01-09 23:58:54 -05: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 05:02:24 -04:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-time.ld")
|
2020-01-09 23:58:54 -05:00
|
|
|
endif()
|
2019-03-14 05:29:32 -04:00
|
|
|
|
2020-02-07 05:35:37 -05:00
|
|
|
# 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 02:29:43 -04:00
|
|
|
endif()
|
2019-03-14 05:29:32 -04:00
|
|
|
|
2019-05-27 02:29:43 -04:00
|
|
|
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
2019-08-07 23:44:24 -04:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld")
|
2019-05-27 02:29:43 -04:00
|
|
|
endif()
|
2019-03-29 00:37:51 -04:00
|
|
|
|
2020-02-24 14:51:41 -05:00
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2020-01-16 22:47:08 -05:00
|
|
|
elseif(target STREQUAL "esp32s2")
|
|
|
|
# no SPIRAM workaround for esp32s2
|
2020-02-24 14:51:41 -05:00
|
|
|
# no nano formatting function in ROM
|
2019-06-13 05:55:51 -04:00
|
|
|
|
2020-01-16 22:47:08 -05:00
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-funcs.ld"
|
|
|
|
"esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2020-01-23 12:02:29 -05:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-nano.ld")
|
|
|
|
endif()
|
2019-03-14 05:29:32 -04:00
|
|
|
endif()
|
2019-05-27 02:29:43 -04:00
|
|
|
|
2019-08-07 23:44:24 -04:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-06-13 05:55:51 -04:00
|
|
|
|
2021-04-08 00:16:17 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=longjmp")
|
2019-03-14 05:29:32 -04:00
|
|
|
endif()
|