refactor(esp_rom): refactor rom LD inclusions to make it easier to add new targets

This commit is contained in:
Marius Vikhammer 2024-03-01 15:53:20 +08:00
parent efc3f9fa88
commit 83d1c2f054
33 changed files with 330 additions and 332 deletions

View File

@ -245,15 +245,6 @@ if(COMPILER_RT_LIB_NAME)
list(APPEND link_options "-rtlib=${CONFIG_COMPILER_RT_LIB_NAME}")
endif()
# For the transition period from 32-bit time_t to 64-bit time_t,
# auto-detect the size of this type and set corresponding variable.
include(CheckTypeSize)
check_type_size("time_t" TIME_T_SIZE)
if(TIME_T_SIZE)
idf_build_set_property(TIME_T_SIZE ${TIME_T_SIZE})
else()
message(FATAL_ERROR "Failed to determine sizeof(time_t)")
endif()
idf_build_set_property(COMPILE_OPTIONS "${compile_options}" APPEND)
idf_build_set_property(C_COMPILE_OPTIONS "${c_compile_options}" APPEND)

View File

@ -101,65 +101,46 @@ else()
endif()
endif()
idf_build_get_property(time_t_size TIME_T_SIZE)
# Common API which is linked both for bootloader and app builds
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
if(CONFIG_ESP_ROM_HAS_VERSION)
rom_linker_script("version")
endif()
if(BOOTLOADER_BUILD)
if(target STREQUAL "esp32")
rom_linker_script("newlib-funcs")
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
rom_linker_script("spiflash")
rom_linker_script("spiflash_legacy")
endif()
if(CONFIG_ESP32_REV_MIN_FULL GREATER_EQUAL 300)
rom_linker_script("eco3")
endif()
elseif(target STREQUAL "esp32s2")
rom_linker_script("newlib-funcs")
rom_linker_script("spiflash")
elseif(target STREQUAL "esp32s3")
rom_linker_script("newlib")
elseif(target STREQUAL "esp32c3")
rom_linker_script("newlib")
elseif(target STREQUAL "esp32c2")
rom_linker_script("newlib")
rom_linker_script("spiflash_legacy")
elseif(target STREQUAL "esp32c6")
rom_linker_script("newlib")
# The linking of the bootloader needs to use the rom_i2c_writeReg_Mask in esp32c6.rom.phy.ld
rom_linker_script("phy")
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
rom_linker_script("version")
elseif(target STREQUAL "esp32c5")
rom_linker_script("newlib")
elseif(target STREQUAL "esp32h2")
rom_linker_script("newlib")
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
elseif(target STREQUAL "esp32p4")
if(CONFIG_ESP_ROM_HAS_NEWLIB)
if(target STREQUAL "esp32" OR target STREQUAL "esp32s2")
rom_linker_script("newlib-funcs")
else()
rom_linker_script("newlib")
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
rom_linker_script("version")
endif()
else() # Regular app build
if(target STREQUAL "esp32")
rom_linker_script("newlib-data")
@ -169,22 +150,11 @@ else() # Regular app build
# ESP32 only: these ROM functions may only be used if PSRAM cache workaround is disabled.
# Otherwise we need to link to a multilib version of libc compiled with PSRAM workaround.
rom_linker_script("newlib-funcs")
if(time_t_size EQUAL 4)
# The ROM functions listed in this linker script depend on sizeof(time_t).
# Since ROM for ESP32 was compiled for 32-bit time_t, only link these functions
# if the toolchain is also using 32-bit time_t.
rom_linker_script("newlib-time")
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 32-bit time_t.
rom_linker_script("newlib-nano")
endif()
endif()
endif()
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
rom_linker_script("spiflash")
# For ESP32, inclusion of ROM driver do not depend on CONFIG_SPI_FLASH_ROM_IMPL
rom_linker_script("spiflash_legacy")
endif()
if(CONFIG_ESP32_REV_MIN_FULL GREATER_EQUAL 300)
@ -194,51 +164,11 @@ else() # Regular app build
elseif(target STREQUAL "esp32s2")
rom_linker_script("newlib-funcs")
rom_linker_script("newlib-data")
rom_linker_script("spiflash")
if(time_t_size EQUAL 4)
# The ROM functions listed in this linker script depend on sizeof(time_t).
# Since ROM for ESP32-S2 was compiled for 32-bit time_t, only link these functions
# if the toolchain is also using 32-bit time_t.
rom_linker_script("newlib-time")
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 32-bit time_t.
rom_linker_script("newlib-nano")
endif()
endif()
elseif(target STREQUAL "esp32s3")
rom_linker_script("newlib")
rom_linker_script("version")
if(time_t_size EQUAL 4)
# The ROM functions listed in this linker script depend on sizeof(time_t).
# Since ROM for ESP32-S3 was compiled for 32-bit time_t, only link these functions
# if the toolchain is also using 32-bit time_t.
rom_linker_script("newlib-time")
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 32-bit time_t.
rom_linker_script("newlib-nano")
endif()
endif()
# For ESP32S2, inclusion of ROM driver do not depend on CONFIG_SPI_FLASH_ROM_IMPL
rom_linker_script("spiflash_legacy")
elseif(target STREQUAL "esp32c3")
rom_linker_script("newlib")
rom_linker_script("version")
if(time_t_size EQUAL 4)
# The ROM functions listed in this linker script depend on sizeof(time_t).
# Since ROM for ESP32-C3 was compiled for 32-bit time_t, only link these functions
# if the toolchain is also using 32-bit time_t.
rom_linker_script("newlib-time")
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 32-bit time_t.
rom_linker_script("newlib-nano")
endif()
endif()
if(CONFIG_ESP32C3_REV_MIN_FULL GREATER_EQUAL 3)
rom_linker_script("eco3")
@ -248,102 +178,30 @@ else() # Regular app build
rom_linker_script("eco7")
endif()
elseif(target STREQUAL "esp32c2")
rom_linker_script("newlib")
rom_linker_script("version")
if(CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL)
rom_linker_script("mbedtls")
endif()
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 64-bit time_t.
rom_linker_script("newlib-nano")
endif()
elseif(target STREQUAL "esp32c6")
rom_linker_script("newlib")
rom_linker_script("version")
# esp32c6.rom.api.ld has been split to several lds by components.
# esp32c6.rom.api.ld is still reserved to map the APIs
rom_linker_script("phy")
rom_linker_script("coexist")
rom_linker_script("net80211")
rom_linker_script("pp")
if(CONFIG_SPI_FLASH_ROM_IMPL)
rom_linker_script("spiflash")
endif()
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
if(NOT CONFIG_NEWLIB_NANO_FORMAT)
# Normal(Non-nano) formatting functions in ROM are also built for 64-bit time_t.
rom_linker_script("newlib-normal")
endif()
elseif(target STREQUAL "esp32c5")
if(CONFIG_ESP_ROM_HAS_NEWLIB AND NOT target STREQUAL "esp32" AND NOT target STREQUAL "esp32s2")
# ESP32 and S2 are a bit different, keep them as special cases in the target specific include section
rom_linker_script("newlib")
rom_linker_script("version")
# esp32c5.rom.api.ld has been split to several lds by components.
# esp32c5.rom.api.ld is still reserved to map the APIs
if(CONFIG_SPI_FLASH_ROM_IMPL)
rom_linker_script("spiflash")
endif()
if(NOT CONFIG_NEWLIB_NANO_FORMAT)
# Normal(Non-nano) formatting functions in ROM are also built for 64-bit time_t.
rom_linker_script("newlib-normal")
endif()
elseif(target STREQUAL "esp32h2")
rom_linker_script("newlib")
rom_linker_script("version")
if(CONFIG_SPI_FLASH_ROM_IMPL)
rom_linker_script("spiflash")
endif()
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
endif()
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 64-bit time_t.
if(CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT AND CONFIG_NEWLIB_NANO_FORMAT)
if(NOT CONFIG_ESP_ROM_HAS_NEWLIB_32BIT_TIME)
# Newlib-nano functions contains time_t related functions
# and cannot be used if they were compiled with 32 bit time_t
rom_linker_script("newlib-nano")
endif()
elseif(target STREQUAL "esp32p4")
rom_linker_script("newlib")
rom_linker_script("version")
# esp32p4 rom doesn't have esp_flash driver
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_HAL_SYSTIMER_USE_ROM_IMPL)
rom_linker_script("systimer")
if(CONFIG_ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT AND NOT CONFIG_NEWLIB_NANO_FORMAT)
rom_linker_script("newlib-normal")
endif()
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 64-bit time_t.
rom_linker_script("newlib-nano")
endif()
endif()
if(CONFIG_HEAP_TLSF_USE_ROM_IMPL)
@ -358,6 +216,17 @@ else() # Regular app build
rom_linker_script("heap")
endif()
if(CONFIG_SPI_FLASH_ROM_IMPL)
# Older targets do not have a separate ld file for spiflash
if(NOT target STREQUAL "esp32c3" AND NOT target STREQUAL "esp32s3" AND NOT target STREQUAL "esp32c2")
rom_linker_script("spiflash")
endif()
endif()
if(CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL)
rom_linker_script("mbedtls")
endif()
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=longjmp")
endif()

View File

@ -27,10 +27,18 @@ config ESP_ROM_NEEDS_SWSETUP_WORKAROUND
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_HAS_NEWLIB_32BIT_TIME
bool
default y
config ESP_ROM_HAS_SW_FLOAT
bool
default y

View File

@ -12,7 +12,9 @@
#define ESP_ROM_HAS_JPEG_DECODE (1) // ROM has JPEG decode library
#define ESP_ROM_HAS_UART_BUF_SWITCH (1) // ROM has exported the uart buffer switch function
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_NEWLIB_32BIT_TIME (1) // ROM was compiled with 32 bit time_t
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
Address table for SPI driver functions in ESP32 ROM.
These functions are only linked from ROM when SPI_FLASH_ROM_DRIVER_PATCH is not set in configuration.

View File

@ -47,6 +47,10 @@ config ESP_ROM_HAS_SPI_FLASH
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
@ -74,3 +78,7 @@ config ESP_ROM_USB_OTG_NUM
config ESP_ROM_USB_SERIAL_DEVICE_NUM
int
default -1
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -17,6 +17,7 @@
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE (1) // ROM needs to set cache MMU size according to instruction and rodata for flash mmap
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
@ -24,3 +25,4 @@
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -1,8 +1,59 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/***************************************
Group heap
***************************************/
/* Functions */
PROVIDE( tlsf_create = 0x400002dc );
PROVIDE( tlsf_create_with_pool = 0x400002e0 );
PROVIDE( tlsf_get_pool = 0x400002e4 );
PROVIDE( tlsf_add_pool = 0x400002e8 );
PROVIDE( tlsf_remove_pool = 0x400002ec );
PROVIDE( tlsf_malloc = 0x400002f0 );
PROVIDE( tlsf_memalign = 0x400002f4 );
PROVIDE( tlsf_memalign_offs = 0x400002f8 );
PROVIDE( tlsf_realloc = 0x400002fc );
PROVIDE( tlsf_free = 0x40000300 );
PROVIDE( tlsf_block_size = 0x40000304 );
PROVIDE( tlsf_size = 0x40000308 );
PROVIDE( tlsf_align_size = 0x4000030c );
PROVIDE( tlsf_block_size_min = 0x40000310 );
PROVIDE( tlsf_block_size_max = 0x40000314 );
PROVIDE( tlsf_pool_overhead = 0x40000318 );
PROVIDE( tlsf_alloc_overhead = 0x4000031c );
PROVIDE( tlsf_walk_pool = 0x40000320 );
PROVIDE( tlsf_check = 0x40000324 );
PROVIDE( tlsf_check_pool = 0x40000328 );
PROVIDE( tlsf_poison_fill_pfunc_set = 0x4000032c );
PROVIDE( multi_heap_get_block_address_impl = 0x40000330 );
PROVIDE( multi_heap_get_allocated_size_impl = 0x40000334 );
PROVIDE( multi_heap_register_impl = 0x40000338 );
PROVIDE( multi_heap_set_lock = 0x4000033c );
PROVIDE( multi_heap_os_funcs_init = 0x40000340 );
PROVIDE( multi_heap_internal_lock = 0x40000344 );
PROVIDE( multi_heap_internal_unlock = 0x40000348 );
PROVIDE( multi_heap_get_first_block = 0x4000034c );
PROVIDE( multi_heap_get_next_block = 0x40000350 );
PROVIDE( multi_heap_is_free = 0x40000354 );
PROVIDE( multi_heap_malloc_impl = 0x40000358 );
PROVIDE( multi_heap_free_impl = 0x4000035c );
PROVIDE( multi_heap_realloc_impl = 0x40000360 );
PROVIDE( multi_heap_aligned_alloc_impl_offs = 0x40000364 );
PROVIDE( multi_heap_aligned_alloc_impl = 0x40000368 );
PROVIDE( multi_heap_check = 0x4000036c );
PROVIDE( multi_heap_dump = 0x40000370 );
PROVIDE( multi_heap_free_size_impl = 0x40000374 );
PROVIDE( multi_heap_minimum_free_size_impl = 0x40000378 );
PROVIDE( multi_heap_get_info_impl = 0x4000037c );
/* Data (.data, .bss, .rodata) */
PROVIDE( heap_tlsf_table_ptr = 0x3fcdffec );
/**
* Multi heap function
*/

View File

@ -200,81 +200,6 @@ PROVIDE( spi_flash_encryption_hal_prepare = 0x4000026c );
PROVIDE( spi_flash_encryption_hal_done = 0x40000270 );
PROVIDE( spi_flash_encryption_hal_destroy = 0x40000274 );
PROVIDE( spi_flash_encryption_hal_check = 0x40000278 );
PROVIDE( wdt_hal_init = 0x4000027c );
PROVIDE( wdt_hal_deinit = 0x40000280 );
PROVIDE( wdt_hal_config_stage = 0x40000284 );
PROVIDE( wdt_hal_write_protect_disable = 0x40000288 );
PROVIDE( wdt_hal_write_protect_enable = 0x4000028c );
PROVIDE( wdt_hal_enable = 0x40000290 );
PROVIDE( wdt_hal_disable = 0x40000294 );
PROVIDE( wdt_hal_handle_intr = 0x40000298 );
PROVIDE( wdt_hal_feed = 0x4000029c );
PROVIDE( wdt_hal_set_flashboot_en = 0x400002a0 );
PROVIDE( wdt_hal_is_enabled = 0x400002a4 );
PROVIDE( systimer_hal_get_counter_value = 0x400002ac );
PROVIDE( systimer_hal_get_alarm_value = 0x400002bc );
PROVIDE( systimer_hal_enable_alarm_int = 0x400002c0 );
PROVIDE( systimer_hal_enable_counter = 0x400002cc );
PROVIDE( systimer_hal_select_alarm_mode = 0x400002d0 );
PROVIDE( systimer_hal_connect_alarm_counter = 0x400002d4 );
PROVIDE( systimer_hal_counter_can_stall_by_cpu = 0x400002d8 );
/* The following ROM functions are commented out because they're patched in the esp_rom_systimer.c */
/* PROVIDE( systimer_hal_init = 0x400002a8 ); */
/* PROVIDE( systimer_hal_get_time = 0x400002b0 ); */
/* PROVIDE( systimer_hal_set_alarm_target = 0x400002b4 ); */
/* PROVIDE( systimer_hal_set_alarm_period = 0x400002b8 ); */
/* PROVIDE( systimer_hal_counter_value_advance = 0x400002c8 ); */
/***************************************
Group heap
***************************************/
/* Functions */
PROVIDE( tlsf_create = 0x400002dc );
PROVIDE( tlsf_create_with_pool = 0x400002e0 );
PROVIDE( tlsf_get_pool = 0x400002e4 );
PROVIDE( tlsf_add_pool = 0x400002e8 );
PROVIDE( tlsf_remove_pool = 0x400002ec );
PROVIDE( tlsf_malloc = 0x400002f0 );
PROVIDE( tlsf_memalign = 0x400002f4 );
PROVIDE( tlsf_memalign_offs = 0x400002f8 );
PROVIDE( tlsf_realloc = 0x400002fc );
PROVIDE( tlsf_free = 0x40000300 );
PROVIDE( tlsf_block_size = 0x40000304 );
PROVIDE( tlsf_size = 0x40000308 );
PROVIDE( tlsf_align_size = 0x4000030c );
PROVIDE( tlsf_block_size_min = 0x40000310 );
PROVIDE( tlsf_block_size_max = 0x40000314 );
PROVIDE( tlsf_pool_overhead = 0x40000318 );
PROVIDE( tlsf_alloc_overhead = 0x4000031c );
PROVIDE( tlsf_walk_pool = 0x40000320 );
PROVIDE( tlsf_check = 0x40000324 );
PROVIDE( tlsf_check_pool = 0x40000328 );
PROVIDE( tlsf_poison_fill_pfunc_set = 0x4000032c );
PROVIDE( multi_heap_get_block_address_impl = 0x40000330 );
PROVIDE( multi_heap_get_allocated_size_impl = 0x40000334 );
PROVIDE( multi_heap_register_impl = 0x40000338 );
PROVIDE( multi_heap_set_lock = 0x4000033c );
PROVIDE( multi_heap_os_funcs_init = 0x40000340 );
PROVIDE( multi_heap_internal_lock = 0x40000344 );
PROVIDE( multi_heap_internal_unlock = 0x40000348 );
PROVIDE( multi_heap_get_first_block = 0x4000034c );
PROVIDE( multi_heap_get_next_block = 0x40000350 );
PROVIDE( multi_heap_is_free = 0x40000354 );
PROVIDE( multi_heap_malloc_impl = 0x40000358 );
PROVIDE( multi_heap_free_impl = 0x4000035c );
PROVIDE( multi_heap_realloc_impl = 0x40000360 );
PROVIDE( multi_heap_aligned_alloc_impl_offs = 0x40000364 );
PROVIDE( multi_heap_aligned_alloc_impl = 0x40000368 );
PROVIDE( multi_heap_check = 0x4000036c );
PROVIDE( multi_heap_dump = 0x40000370 );
PROVIDE( multi_heap_free_size_impl = 0x40000374 );
PROVIDE( multi_heap_minimum_free_size_impl = 0x40000378 );
PROVIDE( multi_heap_get_info_impl = 0x4000037c );
/* Data (.data, .bss, .rodata) */
PROVIDE( heap_tlsf_table_ptr = 0x3fcdffec );
/***************************************

View File

@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
PROVIDE( systimer_hal_get_counter_value = 0x400002ac );
PROVIDE( systimer_hal_get_alarm_value = 0x400002bc );
PROVIDE( systimer_hal_enable_alarm_int = 0x400002c0 );
PROVIDE( systimer_hal_enable_counter = 0x400002cc );
PROVIDE( systimer_hal_select_alarm_mode = 0x400002d0 );
PROVIDE( systimer_hal_connect_alarm_counter = 0x400002d4 );
PROVIDE( systimer_hal_counter_can_stall_by_cpu = 0x400002d8 );
/* The following ROM functions are commented out because they're patched in the esp_rom_systimer.c */
/* PROVIDE( systimer_hal_init = 0x400002a8 ); */
/* PROVIDE( systimer_hal_get_time = 0x400002b0 ); */
/* PROVIDE( systimer_hal_set_alarm_target = 0x400002b4 ); */
/* PROVIDE( systimer_hal_set_alarm_period = 0x400002b8 ); */
/* PROVIDE( systimer_hal_counter_value_advance = 0x400002c8 ); */

View File

@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
PROVIDE( wdt_hal_init = 0x4000027c );
PROVIDE( wdt_hal_deinit = 0x40000280 );
PROVIDE( wdt_hal_config_stage = 0x40000284 );
PROVIDE( wdt_hal_write_protect_disable = 0x40000288 );
PROVIDE( wdt_hal_write_protect_enable = 0x4000028c );
PROVIDE( wdt_hal_enable = 0x40000290 );
PROVIDE( wdt_hal_disable = 0x40000294 );
PROVIDE( wdt_hal_handle_intr = 0x40000298 );
PROVIDE( wdt_hal_feed = 0x4000029c );
PROVIDE( wdt_hal_set_flashboot_en = 0x400002a0 );
PROVIDE( wdt_hal_is_enabled = 0x400002a4 );

View File

@ -59,10 +59,18 @@ config ESP_ROM_HAS_ETS_PRINTF_BUG
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_HAS_NEWLIB_32BIT_TIME
bool
default y
config ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE
bool
default y
@ -78,3 +86,7 @@ config ESP_ROM_HAS_SW_FLOAT
config ESP_ROM_USB_OTG_NUM
int
default -1
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -20,8 +20,11 @@
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_HAS_ETS_PRINTF_BUG (1) // ROM has ets_printf bug when disable the ROM log either by eFuse or RTC storage register
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_NEWLIB_32BIT_TIME (1) // ROM was compiled with 32 bit time_t
#define ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE (1) // ROM needs to set cache MMU size according to instruction and rodata for flash mmap
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -63,6 +63,10 @@ config ESP_ROM_WITHOUT_REGI2C
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT
bool
default y
@ -78,3 +82,7 @@ config ESP_ROM_RAM_APP_NEEDS_MMU_INIT
config ESP_ROM_USB_OTG_NUM
int
default -1
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -21,7 +21,9 @@
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT (1) // ROM has the newlib normal/full version of formatting functions (as opposed to the nano versions)
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -160,46 +160,6 @@ rom_spiflash_legacy_data = 0x4087ffec;
g_flash_guard_ops = 0x4087fff4;
/***************************************
Group hal_wdt
***************************************/
/* Functions */
wdt_hal_init = 0x40000390;
wdt_hal_deinit = 0x40000394;
wdt_hal_config_stage = 0x40000398;
wdt_hal_write_protect_disable = 0x4000039c;
wdt_hal_write_protect_enable = 0x400003a0;
wdt_hal_enable = 0x400003a4;
wdt_hal_disable = 0x400003a8;
wdt_hal_handle_intr = 0x400003ac;
wdt_hal_feed = 0x400003b0;
wdt_hal_set_flashboot_en = 0x400003b4;
wdt_hal_is_enabled = 0x400003b8;
/***************************************
Group hal_systimer
***************************************/
/* Functions */
systimer_hal_init = 0x400003bc;
systimer_hal_deinit = 0x400003c0;
systimer_hal_set_tick_rate_ops = 0x400003c4;
systimer_hal_get_counter_value = 0x400003c8;
systimer_hal_get_time = 0x400003cc;
systimer_hal_set_alarm_target = 0x400003d0;
systimer_hal_set_alarm_period = 0x400003d4;
systimer_hal_get_alarm_value = 0x400003d8;
systimer_hal_enable_alarm_int = 0x400003dc;
systimer_hal_on_apb_freq_update = 0x400003e0;
systimer_hal_counter_value_advance = 0x400003e4;
systimer_hal_enable_counter = 0x400003e8;
systimer_hal_select_alarm_mode = 0x400003ec;
systimer_hal_connect_alarm_counter = 0x400003f0;
systimer_hal_counter_can_stall_by_cpu = 0x400003f4;
/***************************************
Group cache
***************************************/

View File

@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/***************************************
Group hal_systimer
***************************************/
/* Functions */
systimer_hal_init = 0x400003bc;
systimer_hal_deinit = 0x400003c0;
systimer_hal_set_tick_rate_ops = 0x400003c4;
systimer_hal_get_counter_value = 0x400003c8;
systimer_hal_get_time = 0x400003cc;
systimer_hal_set_alarm_target = 0x400003d0;
systimer_hal_set_alarm_period = 0x400003d4;
systimer_hal_get_alarm_value = 0x400003d8;
systimer_hal_enable_alarm_int = 0x400003dc;
systimer_hal_on_apb_freq_update = 0x400003e0;
systimer_hal_counter_value_advance = 0x400003e4;
systimer_hal_enable_counter = 0x400003e8;
systimer_hal_select_alarm_mode = 0x400003ec;
systimer_hal_connect_alarm_counter = 0x400003f0;
systimer_hal_counter_can_stall_by_cpu = 0x400003f4;

View File

@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/***************************************
Group hal_wdt
***************************************/
/* Functions */
wdt_hal_init = 0x40000390;
wdt_hal_deinit = 0x40000394;
wdt_hal_config_stage = 0x40000398;
wdt_hal_write_protect_disable = 0x4000039c;
wdt_hal_write_protect_enable = 0x400003a0;
wdt_hal_enable = 0x400003a4;
wdt_hal_disable = 0x400003a8;
wdt_hal_handle_intr = 0x400003ac;
wdt_hal_feed = 0x400003b0;
wdt_hal_set_flashboot_en = 0x400003b4;
wdt_hal_is_enabled = 0x400003b8;

View File

@ -63,6 +63,10 @@ config ESP_ROM_HAS_REGI2C_BUG
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT
bool
default y
@ -90,3 +94,7 @@ config ESP_ROM_HAS_SW_FLOAT
config ESP_ROM_USB_OTG_NUM
int
default -1
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -21,6 +21,7 @@
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_HAS_REGI2C_BUG (1) // ROM has the regi2c bug
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT (1) // ROM has the newlib normal/full version of formatting functions (as opposed to the nano versions)
#define ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE (1) // ECO 0 does not have ets_ecdsa_verify symbol, future revision will have it
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
@ -28,3 +29,4 @@
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -55,6 +55,10 @@ config ESP_ROM_WITHOUT_REGI2C
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
@ -78,3 +82,7 @@ config ESP_ROM_HAS_SW_FLOAT
config ESP_ROM_USB_OTG_NUM
int
default -1
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -19,9 +19,11 @@
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano versions of formatting functions
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
#define ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE (1) // ROM needs to set cache MMU size according to instruction and rodata for flash mmap
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -59,6 +59,14 @@ config ESP_ROM_WITHOUT_REGI2C
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -20,4 +20,6 @@
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
#define ESP_ROM_HAS_LP_ROM (1) // ROM also has a LP ROM placed in LP memory
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -23,10 +23,18 @@ config ESP_ROM_HAS_REGI2C_BUG
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_HAS_NEWLIB_32BIT_TIME
bool
default y
config ESP_ROM_USB_OTG_NUM
int
default 3

View File

@ -11,7 +11,9 @@
#define ESP_ROM_HAS_UART_BUF_SWITCH (1) // ROM has exported the uart buffer switch function
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
#define ESP_ROM_HAS_REGI2C_BUG (1) // ROM has the regi2c bug
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_NEWLIB_32BIT_TIME (1) // ROM was compiled with 32 bit time_t
#define ESP_ROM_USB_OTG_NUM (3) // The serial port ID (UART, USB, ...) of USB_OTG CDC in the ROM.
#define ESP_ROM_HAS_FLASH_COUNT_PAGES_BUG (1) // ROM api Cache_Count_Flash_Pages will return unexpected value
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* SPI flash driver function, compatibility names.
*/

View File

@ -67,10 +67,18 @@ config ESP_ROM_HAS_ETS_PRINTF_BUG
bool
default y
config ESP_ROM_HAS_NEWLIB
bool
default y
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_HAS_NEWLIB_32BIT_TIME
bool
default y
config ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE
bool
default y
@ -94,3 +102,7 @@ config ESP_ROM_HAS_CACHE_WRITEBACK_BUG
config ESP_ROM_HAS_SW_FLOAT
bool
default y
config ESP_ROM_HAS_VERSION
bool
default y

View File

@ -22,10 +22,13 @@
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_HAS_ETS_PRINTF_BUG (1) // ROM has ets_printf bug when disable the ROM log either by eFuse or RTC storage register
#define ESP_ROM_HAS_NEWLIB (1) // ROM has newlib (at least parts of it) functions included
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_NEWLIB_32BIT_TIME (1) // ROM was compiled with 32 bit time_t
#define ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE (1) // ROM needs to set cache MMU size according to instruction and rodata for flash mmap
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_HAS_FLASH_COUNT_PAGES_BUG (1) // ROM api Cache_Count_Flash_Pages will return unexpected value
#define ESP_ROM_HAS_CACHE_SUSPEND_WAITI_BUG (1) // ROM api Cache_Suspend_I/DCache and Cache_Freeze_I/DCache_Enable does not waiti
#define ESP_ROM_HAS_CACHE_WRITEBACK_BUG (1) // ROM api Cache_WriteBack_Addr address or size misalignment may cause cache hit with wrong value.
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information

View File

@ -243,29 +243,6 @@ PROVIDE( spi_flash_hal_erase_block = 0x40000d8c );
PROVIDE( spi_flash_hal_program_page = 0x40000d98 );
PROVIDE( spi_flash_hal_set_write_protect = 0x40000da4 );
PROVIDE( spi_flash_hal_host_idle = 0x40000db0 );
PROVIDE( wdt_hal_init = 0x40000dbc );
PROVIDE( wdt_hal_deinit = 0x40000dc8 );
PROVIDE( wdt_hal_config_stage = 0x40000dd4 );
PROVIDE( wdt_hal_write_protect_disable = 0x40000de0 );
PROVIDE( wdt_hal_write_protect_enable = 0x40000dec );
PROVIDE( wdt_hal_enable = 0x40000df8 );
PROVIDE( wdt_hal_disable = 0x40000e04 );
PROVIDE( wdt_hal_handle_intr = 0x40000e10 );
PROVIDE( wdt_hal_feed = 0x40000e1c );
PROVIDE( wdt_hal_set_flashboot_en = 0x40000e28 );
PROVIDE( wdt_hal_is_enabled = 0x40000e34 );
PROVIDE( systimer_hal_get_counter_value = 0x40000e40 );
PROVIDE( systimer_hal_get_time = 0x40000e4c );
PROVIDE( systimer_hal_set_alarm_target = 0x40000e58 );
PROVIDE( systimer_hal_set_alarm_period = 0x40000e64 );
PROVIDE( systimer_hal_get_alarm_value = 0x40000e70 );
PROVIDE( systimer_hal_enable_alarm_int = 0x40000e7c );
PROVIDE( systimer_hal_on_apb_freq_update = 0x40000e88 );
PROVIDE( systimer_hal_counter_value_advance = 0x40000e94 );
PROVIDE( systimer_hal_enable_counter = 0x40000ea0 );
PROVIDE( systimer_hal_init = 0x40000eac );
PROVIDE( systimer_hal_select_alarm_mode = 0x40000eb8 );
PROVIDE( systimer_hal_connect_alarm_counter = 0x40000ec4 );
/***************************************

View File

@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
PROVIDE( systimer_hal_get_counter_value = 0x40000e40 );
PROVIDE( systimer_hal_get_time = 0x40000e4c );
PROVIDE( systimer_hal_set_alarm_target = 0x40000e58 );
PROVIDE( systimer_hal_set_alarm_period = 0x40000e64 );
PROVIDE( systimer_hal_get_alarm_value = 0x40000e70 );
PROVIDE( systimer_hal_enable_alarm_int = 0x40000e7c );
PROVIDE( systimer_hal_on_apb_freq_update = 0x40000e88 );
PROVIDE( systimer_hal_counter_value_advance = 0x40000e94 );
PROVIDE( systimer_hal_enable_counter = 0x40000ea0 );
PROVIDE( systimer_hal_init = 0x40000eac );
PROVIDE( systimer_hal_select_alarm_mode = 0x40000eb8 );
PROVIDE( systimer_hal_connect_alarm_counter = 0x40000ec4 );

View File

@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
PROVIDE( wdt_hal_init = 0x40000dbc );
PROVIDE( wdt_hal_deinit = 0x40000dc8 );
PROVIDE( wdt_hal_config_stage = 0x40000dd4 );
PROVIDE( wdt_hal_write_protect_disable = 0x40000de0 );
PROVIDE( wdt_hal_write_protect_enable = 0x40000dec );
PROVIDE( wdt_hal_enable = 0x40000df8 );
PROVIDE( wdt_hal_disable = 0x40000e04 );
PROVIDE( wdt_hal_handle_intr = 0x40000e10 );
PROVIDE( wdt_hal_feed = 0x40000e1c );
PROVIDE( wdt_hal_set_flashboot_en = 0x40000e28 );
PROVIDE( wdt_hal_is_enabled = 0x40000e34 );

View File

@ -422,7 +422,6 @@ components/esp_rom/esp32/ld/esp32.rom.newlib-locale.ld
components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld
components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
components/esp_rom/esp32/ld/esp32.rom.redefined.ld
components/esp_rom/esp32/ld/esp32.rom.spiflash.ld
components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld
components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld
@ -437,7 +436,6 @@ components/esp_rom/esp32s2/ld/esp32s2.rom.libgcc.ld
components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-data.ld
components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-funcs.ld
components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-nano.ld
components/esp_rom/esp32s2/ld/esp32s2.rom.spiflash.ld
components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
components/esp_rom/esp32s3/ld/esp32s3.rom.ld
components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld