diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index c202595de2..7f0980792b 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -1,7 +1,6 @@ idf_build_get_property(target IDF_TARGET) -set(srcs "wdt_hal_iram.c" - "mpu_hal.c" +set(srcs "mpu_hal.c" "cpu_hal.c" "efuse_hal.c" "${target}/efuse_hal.c" @@ -9,6 +8,10 @@ set(srcs "wdt_hal_iram.c" set(includes "${target}/include" "include" "platform_port/include") +if(NOT CONFIG_HAL_WDT_ROM_IMPL) + list(APPEND srcs "wdt_hal_iram.c") +endif() + if(NOT ${target} STREQUAL "esp32") list(APPEND srcs "cache_hal.c") endif() diff --git a/components/hal/Kconfig b/components/hal/Kconfig index 3ab4a6e2e3..3ab4f83eba 100644 --- a/components/hal/Kconfig +++ b/components/hal/Kconfig @@ -76,6 +76,23 @@ menu "Hardware Abstraction Layer (HAL) and Low Level (LL)" help Enable this flag to use HAL functions from ROM instead of ESP-IDF. + If keeping this as "n" in your project, you will have less free IRAM. + If making this as "y" in your project, you will increase free IRAM, + but you will lose the possibility to debug this module, and some new + features will be added and bugs will be fixed in the IDF source + but cannot be synced to ROM. + + config HAL_WDT_HAS_ROM_IMPL + bool + default y if IDF_TARGET_ESP32C2 + + config HAL_WDT_ROM_IMPL + bool "Use WDT HAL implementation in ROM" + depends on HAL_WDT_HAS_ROM_IMPL + default y + help + Enable this flag to use HAL functions from ROM instead of ESP-IDF. + If keeping this as "n" in your project, you will have less free IRAM. If making this as "y" in your project, you will increase free IRAM, but you will lose the possibility to debug this module, and some new diff --git a/components/hal/linker.lf b/components/hal/linker.lf index cb80110cbb..729118368c 100644 --- a/components/hal/linker.lf +++ b/components/hal/linker.lf @@ -16,7 +16,8 @@ entries: i2c_hal_iram (noflash) cpu_hal (noflash) soc_hal (noflash) - wdt_hal_iram (noflash) + if HAL_WDT_HAS_ROM_IMPL = n || HAL_WDT_ROM_IMPL = n: + wdt_hal_iram (noflash) if TWAI_ISR_IN_IRAM = y: twai_hal_iram (noflash) if IDF_TARGET_ESP32 = n: