Skip to content

Conversation

@PetervdPerk-NXP
Copy link
Contributor

@PetervdPerk-NXP PetervdPerk-NXP commented Nov 17, 2025

This change allows you to move the interrupt vector table to ITCM or DTCM instead of SRAM, which provides deterministic, single-cycle access, unlike multi-cycle SRAM reads that may incur additional wait states. This reduces exception entry latency and benefits real-time and interrupt-driven workloads.

Both ITCM and DTCM are supported for vector table placement. ITCM is accessed via the CPU instruction bus and typically provides the lowest possible interrupt latency, making it the preferred location when available. DTCM, while on the data bus, still offers significantly faster and more predictable access compared to SRAM and serves as a suitable alternative where ITCM is unavailable or reserved for hot code.

dcpleung
dcpleung previously approved these changes Nov 17, 2025
@dcpleung dcpleung assigned wearyzen and unassigned dcpleung Nov 17, 2025
@PetervdPerk-NXP PetervdPerk-NXP changed the title arch: arm: cortex_m: Allow VTOR to be relocated to DTCM arch: arm: cortex_m: Allow VTOR to be relocated to TCM Nov 17, 2025
@PetervdPerk-NXP
Copy link
Contributor Author

@dcpleung
I dug a bit further into the ARM TCM documentation, ITCM appears to be the best choice for vector table placement due to how interrupt handling on a cortex-m uses the instruction bus, but both ITCM and DTCM are supported. I’ve updated the PR to support both options and clarified the differences in the Kconfig help text.

Relocate VTOR from SRAM to ITCM/DTCM to minimize interrupt latency.
TCM 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]>
@wearyzen
Copy link
Contributor

wearyzen commented Nov 17, 2025

Could you refer to the MPS3 boards which already use ITCM and DTCM without these extra configs?

Another example where MPS3 board selects SRAM for flash and code but still uses ITCM for vector table:


default $(dt_nodelabel_reg_addr_hex,itcm)

@PetervdPerk-NXP
Copy link
Contributor Author

PetervdPerk-NXP commented Nov 17, 2025

Could you refer to the MPS3 boards which already use ITCM and DTCM without these extra configs?

In that example the MPS3 uses DTCM as primary ram setting zephyr,sram to DTCM, then this doesn't apply because if CONFIG_SRAM_VECTOR_TABLE gets used then RAMABLE_REGION is is equal to DTCM memory.

This is why we depend on $(dt_chosen_enabled,$(DT_CHOSEN_Z_DTCM)) if zephyr,dtcm or zephyr,itcm is set then we can oly relocate the vector table to DTCM or ITCM.

In the case for example the vmu_rt1170 the primary ram is &ocram and has seperate DTCM and ITCM entries.

zephyr,sram = &ocram1; /* TODO Merge with other OCRAM */

In this case

default $(dt_nodelabel_reg_addr_hex,itcm)

The MPS3 seems to fully executing from ITCM so no XIP from flash but then CONFIG_SRAM_VECTOR_TABLE wouldn't be applicable at all anyhow.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Architectures area: ARM ARM (32-bit) Architecture

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants