Skip to content

Commit 2c2a8f7

Browse files
arch: arm: cortex_m: Allow VTOR to be relocated to DTCM
Relocate VTOR from SRAM to DTCM to minimize interrupt latency. DTCM offers single-cycle access compared to multi-cycle SRAM reads. This improves exception handling speed for real-time workloads. Signed-off-by: Peter van der Perk <[email protected]>
1 parent 7987614 commit 2c2a8f7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

arch/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,26 @@ config SRAM_VECTOR_TABLE
621621
When XiP is enabled, this option will result in the vector table being
622622
relocated from Flash to SRAM.
623623

624+
DT_CHOSEN_Z_DTCM := zephyr,dtcm
625+
626+
choice
627+
prompt "Vector table memory location"
628+
depends on SRAM_VECTOR_TABLE
629+
default VECTOR_TABLE_SRAM
630+
631+
config VECTOR_TABLE_SRAM
632+
bool "SRAM"
633+
help
634+
Place the vector table in SRAM.
635+
636+
config VECTOR_TABLE_DTCM
637+
bool "DTCM"
638+
depends on $(dt_chosen_enabled,$(DT_CHOSEN_Z_DTCM))
639+
help
640+
Place the vector table in DTCM if available.
641+
642+
endchoice
643+
624644
config SRAM_SW_ISR_TABLE
625645
bool "Place the software ISR table in SRAM instead of flash"
626646
help

arch/arm/core/cortex_m/ram_vector_table.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ SECTION_PROLOGUE(.sram_vt,,)
2828
. += _vector_end - _vector_start;
2929
MPU_ALIGN(_sram_vector_size);
3030
_sram_vector_end = .;
31+
#if defined(CONFIG_VECTOR_TABLE_DTCM)
32+
} GROUP_DATA_LINK_IN(DTCM, ROMABLE_REGION)
33+
#else
3134
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
35+
#endif
3236
_sram_vector_size = _sram_vector_end - _sram_vector_start;

0 commit comments

Comments
 (0)