diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index ade3b3d903..bf067862d4 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -25,6 +25,9 @@ extern "C" { // Forces data into DRAM instead of flash #define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__) +// Forces code into TCM instead of flash +#define TCM_IRAM_ATTR _SECTION_ATTR_IMPL(".tcm.text", __COUNTER__) + // IRAM can only be accessed as an 8-bit memory on ESP32, when CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY is set #define IRAM_8BIT_ACCESSIBLE (CONFIG_IDF_TARGET_ESP32 && CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY) diff --git a/components/esp_common/soc.lf b/components/esp_common/soc.lf index 46193323e5..99f81a2a74 100644 --- a/components/esp_common/soc.lf +++ b/components/esp_common/soc.lf @@ -41,3 +41,15 @@ entries: [sections:extram_bss] entries: .ext_ram.bss+ + +[sections:tcm_text] +entries: + .tcm.text+ + +[sections:tcm_data] +entries: + .tcm.data+ + +[sections:tcm_bss] +entries: + .tcm.bss+ diff --git a/components/esp_system/app.lf b/components/esp_system/app.lf index 15484115d0..d9f6b73e44 100644 --- a/components/esp_system/app.lf +++ b/components/esp_system/app.lf @@ -22,6 +22,8 @@ entries: rtc_data -> rtc_data rtc_rodata -> rtc_data rtc_bss -> rtc_bss + tcm_text -> tcm_text + tcm_data -> tcm_data [scheme:rtc] entries: @@ -44,6 +46,14 @@ entries: entries: text -> iram0_text +[scheme:tcm] +entries: + text -> tcm_text + data -> tcm_data + rodata -> tcm_data + bss -> tcm_bss + common -> tcm_bss + [mapping:default] archive: * entries: