2019-06-13 09:55:51 +00:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2020-11-10 07:40:01 +00:00
|
|
|
idf_component_register(SRCS "patches/esp_rom_crc.c"
|
|
|
|
"patches/esp_rom_sys.c"
|
|
|
|
"patches/esp_rom_uart.c"
|
2020-06-19 07:08:38 +00:00
|
|
|
INCLUDE_DIRS include
|
2020-04-30 13:19:56 +00:00
|
|
|
PRIV_INCLUDE_DIRS "${target}"
|
2020-08-08 12:15:27 +00:00
|
|
|
PRIV_REQUIRES soc hal)
|
2019-11-28 13:10:31 +00:00
|
|
|
|
2019-03-14 09:29:32 +00:00
|
|
|
if(BOOTLOADER_BUILD)
|
2019-05-10 02:53:08 +00:00
|
|
|
set(scripts
|
2020-06-19 07:08:38 +00:00
|
|
|
"${target}/ld/${target}.rom.api.ld"
|
2019-08-08 03:44:24 +00:00
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-funcs.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
2019-05-10 02:53:08 +00:00
|
|
|
)
|
2020-01-17 03:47:08 +00:00
|
|
|
if(target STREQUAL "esp32s2")
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2019-05-27 06:29:43 +00:00
|
|
|
endif()
|
2019-08-08 03:44:24 +00:00
|
|
|
|
2020-06-10 11:07:48 +00:00
|
|
|
if(target STREQUAL "esp32s3")
|
|
|
|
list(APPEND scripts "esp32s3/ld/esp32s3.rom.spiflash.ld")
|
|
|
|
endif()
|
|
|
|
|
2020-02-24 19:51:41 +00:00
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2019-06-04 11:05:33 +00:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-11-28 13:10:31 +00:00
|
|
|
else() # Regular app build
|
2019-06-13 09:55:51 +00:00
|
|
|
set(scripts
|
2020-06-19 07:08:38 +00:00
|
|
|
"${target}/ld/${target}.rom.api.ld"
|
2019-06-13 09:55:51 +00:00
|
|
|
"${target}/ld/${target}.rom.ld"
|
|
|
|
"${target}/ld/${target}.rom.libgcc.ld"
|
|
|
|
"${target}/ld/${target}.rom.newlib-data.ld")
|
|
|
|
|
2019-11-28 13:10:31 +00:00
|
|
|
if(target STREQUAL "esp32")
|
2019-06-13 09:55:51 +00:00
|
|
|
list(APPEND scripts "${target}/ld/${target}.rom.syscalls.ld")
|
2019-03-14 09:29:32 +00:00
|
|
|
|
2019-05-27 06:29:43 +00:00
|
|
|
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2019-08-08 03:44:24 +00:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.newlib-funcs.ld")
|
2020-01-10 04:58:54 +00: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 09:02:24 +00:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-time.ld")
|
2020-01-10 04:58:54 +00:00
|
|
|
endif()
|
2019-03-14 09:29:32 +00:00
|
|
|
|
2020-02-07 10:35:37 +00: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 06:29:43 +00:00
|
|
|
endif()
|
2019-03-14 09:29:32 +00:00
|
|
|
|
2019-05-27 06:29:43 +00:00
|
|
|
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
2019-08-08 03:44:24 +00:00
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld")
|
2019-05-27 06:29:43 +00:00
|
|
|
endif()
|
2019-03-29 04:37:51 +00:00
|
|
|
|
2020-02-24 19:51:41 +00:00
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
list(APPEND scripts "esp32/ld/esp32.rom.eco3.ld")
|
|
|
|
endif()
|
|
|
|
|
2020-01-17 03:47:08 +00:00
|
|
|
elseif(target STREQUAL "esp32s2")
|
|
|
|
# no SPIRAM workaround for esp32s2
|
2020-02-24 19:51:41 +00:00
|
|
|
# no nano formatting function in ROM
|
2019-06-13 09:55:51 +00:00
|
|
|
|
2020-01-17 03:47:08 +00:00
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-funcs.ld"
|
|
|
|
"esp32s2/ld/esp32s2.rom.spiflash.ld")
|
2020-01-23 17:02:29 +00:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
list(APPEND scripts "esp32s2/ld/esp32s2.rom.newlib-nano.ld")
|
|
|
|
endif()
|
2020-06-10 11:07:48 +00:00
|
|
|
|
|
|
|
elseif(target STREQUAL "esp32s3")
|
|
|
|
# no SPIRAM workaround for esp32s3
|
|
|
|
list(APPEND scripts "esp32s3/ld/esp32s3.rom.newlib-funcs.ld"
|
|
|
|
"esp32s3/ld/esp32s3.rom.spiflash.ld")
|
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
|
|
|
list(APPEND scripts "esp32s3/ld/esp32s3.rom.newlib-nano.ld")
|
|
|
|
endif()
|
|
|
|
|
2019-03-14 09:29:32 +00:00
|
|
|
endif()
|
2019-05-27 06:29:43 +00:00
|
|
|
|
2019-08-08 03:44:24 +00:00
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}")
|
2019-03-14 09:29:32 +00:00
|
|
|
endif()
|
2020-04-30 13:19:56 +00:00
|
|
|
|
|
|
|
if(target STREQUAL "esp32s2")
|
|
|
|
target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_descriptors.c")
|
|
|
|
endif()
|