2019-06-13 17:55:51 +08:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-04-08 12:16:17 +08:00
|
|
|
set(sources "patches/esp_rom_crc.c"
|
|
|
|
"patches/esp_rom_sys.c"
|
|
|
|
"patches/esp_rom_uart.c")
|
|
|
|
|
|
|
|
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
|
|
|
list(APPEND sources "patches/esp_rom_longjmp.S")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
idf_component_register(SRCS ${sources}
|
2021-05-18 11:54:38 +07:00
|
|
|
INCLUDE_DIRS include "${target}" "include/${target}"
|
2020-08-08 20:15:27 +08:00
|
|
|
PRIV_REQUIRES soc hal)
|
2019-11-28 21:10:31 +08:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
# Append a target linker script at the target-specific path,
|
|
|
|
# only the 'name' part is different for each script
|
|
|
|
function(rom_linker_script name)
|
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/ld/${target}.rom.${name}.ld")
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/ld/${target}.rom.ld")
|
|
|
|
rom_linker_script("api")
|
|
|
|
rom_linker_script("libgcc")
|
|
|
|
|
2019-03-14 17:29:32 +08:00
|
|
|
if(BOOTLOADER_BUILD)
|
2020-11-18 10:28:10 +11:00
|
|
|
if(target STREQUAL "esp32")
|
|
|
|
rom_linker_script("newlib-funcs")
|
2021-09-02 05:12:49 +10:00
|
|
|
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
|
|
|
rom_linker_script("spiflash")
|
|
|
|
endif()
|
2020-11-18 10:28:10 +11:00
|
|
|
if(CONFIG_ESP32_REV_MIN_3)
|
|
|
|
rom_linker_script("eco3")
|
|
|
|
endif()
|
2020-11-26 15:47:32 +11:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
elseif(target STREQUAL "esp32s2")
|
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
|
rom_linker_script("spiflash")
|
2019-08-08 13:44:24 +10:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
elseif(target STREQUAL "esp32s3")
|
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
|
rom_linker_script("spiflash")
|
2020-06-10 19:07:48 +08:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
elseif(target STREQUAL "esp32c3")
|
2020-12-22 18:24:39 +11:00
|
|
|
rom_linker_script("newlib")
|
2020-11-26 15:47:32 +11:00
|
|
|
endif()
|
2019-06-13 17:55:51 +08:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
else() # Regular app build
|
2019-11-28 21:10:31 +08:00
|
|
|
if(target STREQUAL "esp32")
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-data")
|
|
|
|
rom_linker_script("syscalls")
|
2019-03-14 17:29:32 +08:00
|
|
|
|
2019-05-27 14:29:43 +08:00
|
|
|
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-funcs")
|
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-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-time")
|
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)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-nano")
|
2020-02-07 16:05:37 +05:30
|
|
|
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)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("spiflash")
|
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)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("eco3")
|
2020-02-25 01:21:41 +05:30
|
|
|
endif()
|
|
|
|
|
2020-01-17 11:47:08 +08:00
|
|
|
elseif(target STREQUAL "esp32s2")
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
|
rom_linker_script("newlib-data")
|
|
|
|
rom_linker_script("spiflash")
|
2020-01-23 18:02:29 +01:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-nano")
|
2020-01-23 18:02:29 +01:00
|
|
|
endif()
|
2020-06-10 19:07:48 +08:00
|
|
|
|
2020-11-18 10:28:10 +11:00
|
|
|
# descirptors used by ROM code
|
|
|
|
target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_descriptors.c")
|
|
|
|
|
2020-06-10 19:07:48 +08:00
|
|
|
elseif(target STREQUAL "esp32s3")
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-funcs")
|
|
|
|
rom_linker_script("newlib-data")
|
|
|
|
rom_linker_script("spiflash")
|
2020-06-10 19:07:48 +08:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-nano")
|
2020-06-10 19:07:48 +08:00
|
|
|
endif()
|
|
|
|
|
2020-11-26 15:47:32 +11:00
|
|
|
elseif(target STREQUAL "esp32c3")
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib")
|
|
|
|
rom_linker_script("version")
|
2020-11-26 15:47:32 +11:00
|
|
|
|
|
|
|
if(CONFIG_NEWLIB_NANO_FORMAT)
|
2020-11-18 10:28:10 +11:00
|
|
|
rom_linker_script("newlib-nano")
|
2020-11-26 15:47:32 +11:00
|
|
|
endif()
|
2021-03-03 11:57:58 +08:00
|
|
|
|
|
|
|
if(CONFIG_ESP32C3_REV_MIN_3)
|
|
|
|
rom_linker_script("eco3")
|
|
|
|
endif()
|
2019-03-14 17:29:32 +08:00
|
|
|
endif()
|
2019-05-27 14:29:43 +08:00
|
|
|
|
2021-04-08 12:16:17 +08:00
|
|
|
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=longjmp")
|
|
|
|
endif()
|
2019-03-14 17:29:32 +08:00
|
|
|
endif()
|
2020-04-30 15:19:56 +02:00
|
|
|
|
|
|
|
if(target STREQUAL "esp32s2")
|
|
|
|
target_sources(${COMPONENT_LIB} PRIVATE "esp32s2/usb_descriptors.c")
|
|
|
|
endif()
|