Skip to content

Commit d5f67d0

Browse files
Martinhoff-makercfriedt
authored andcommitted
arch: split dynamic interrupt symbol
This commit introduces the SRAM_SW_ISR_TABLE option which is selected by DYNAMIC_INTERRUPT. It allows splitting the DYNAMIC_INTERRUPT option into two parts: - One for the relocation of the ISR vector table in RAM - One for the inclusion of functions needed to install ISRs dynamically The goal is to later only select the relocation of the ISR vector table in RAM and not all the associated functions from the dynamic interrupt mechanism. Signed-off-by: Martin Hoff <[email protected]>
1 parent 426c3d1 commit d5f67d0

File tree

7 files changed

+29
-4
lines changed

7 files changed

+29
-4
lines changed

arch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ config ISR_TABLES_LOCAL_DECLARATION
472472

473473
config DYNAMIC_INTERRUPTS
474474
bool "Installation of IRQs at runtime"
475+
select SRAM_SW_ISR_TABLE
475476
help
476477
Enable installation of interrupts at runtime, which will move some
477478
interrupt-related data structures to RAM instead of ROM, and
@@ -598,6 +599,12 @@ config SRAM_VECTOR_TABLE
598599
When XiP is enabled, this option will result in the vector table being
599600
relocated from Flash to SRAM.
600601

602+
config SRAM_SW_ISR_TABLE
603+
bool "Place the software ISR table in SRAM instead of flash"
604+
help
605+
The option specifies that the software interrupts vector table will be
606+
placed inside SRAM instead of the flash.
607+
601608
config IRQ_OFFLOAD_NESTED
602609
bool "irq_offload() supports nested IRQs"
603610
depends on IRQ_OFFLOAD

cmake/linker_script/common/common-ram.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# The contents of this file is based on include/zephyr/linker/common-ram.ld
33
# Please keep in sync
44

5-
if(CONFIG_GEN_SW_ISR_TABLE AND CONFIG_DYNAMIC_INTERRUPTS)
5+
if(CONFIG_GEN_SW_ISR_TABLE AND CONFIG_SRAM_SW_ISR_TABLE)
66
# ld align has been changed to subalign to provide identical behavior scatter vs. ld.
77
zephyr_linker_section(NAME sw_isr_table
88
GROUP DATA_REGION

cmake/linker_script/common/common-rom.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ zephyr_linker_section_obj_level(SECTION init LEVEL SMP)
1313

1414
zephyr_iterable_section(NAME device NUMERIC KVMA RAM_REGION GROUP RODATA_REGION)
1515

16-
if(CONFIG_GEN_SW_ISR_TABLE AND NOT CONFIG_DYNAMIC_INTERRUPTS)
16+
if(CONFIG_GEN_SW_ISR_TABLE AND NOT CONFIG_SRAM_SW_ISR_TABLE)
1717
# ld align has been changed to subalign to provide identical behavior scatter vs. ld.
1818
zephyr_linker_section(NAME sw_isr_table KVMA FLASH GROUP RODATA_REGION SUBALIGN ${CONFIG_ARCH_SW_ISR_TABLE_ALIGN} NOINPUT)
1919
zephyr_linker_section_configure(

doc/kernel/services/interrupts.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ generate exceptions that need to be handled synchronously (e.g. kernel panic).
197197
The feature is currently implemented in the ARM Cortex-M architecture
198198
variant.
199199

200+
.. tip::
201+
To mitigate flash access latency, consider relocating ISRs and all related
202+
symbols to RAM. This eliminates flash access delays.
203+
200204
Offloading ISR Work
201205
===================
202206

@@ -374,6 +378,16 @@ Cortex-M architecture variant via the macro
374378
:c:macro:`ARM_IRQ_DIRECT_DYNAMIC_CONNECT`, which can be used to declare a direct
375379
and dynamic interrupt.
376380

381+
RAM-based ISR Execution
382+
=======================
383+
384+
For ultra-low latency, ISRs and vector tables can be relocated to RAM to eliminate
385+
flash access delays. :kconfig:option:`CONFIG_SRAM_VECTOR_TABLE` and
386+
:kconfig:option:`CONFIG_SRAM_SW_ISR_TABLE` will help you have interrupt vectors
387+
in RAM. :kconfig:option:`CONFIG_DEVICE_MUTABLE` will help you put the device
388+
structure in RAM and :kconfig:option:`CONFIG_CODE_DATA_RELOCATION` will help you relocate
389+
the ISR and all the related symbols to RAM.
390+
377391
Sharing an interrupt line
378392
=========================
379393

doc/releases/release-notes-4.3.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ New APIs and options
7575
7676
.. zephyr-keep-sorted-start re(^\* \w)
7777
78+
* Architectures
79+
80+
* :kconfig:option:`CONFIG_SRAM_SW_ISR_TABLE`
81+
7882
* Power management
7983

8084
* :c:func:`pm_device_driver_deinit`

include/zephyr/linker/common-ram.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ITERABLE_SECTION_RAM(scmi_protocol, Z_LINK_ITERABLE_SUBALIGN)
1818
#endif /* CONFIG_ARM_SCMI */
1919

20-
#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS)
20+
#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_SRAM_SW_ISR_TABLE)
2121
SECTION_DATA_PROLOGUE(sw_isr_table,,)
2222
{
2323
/*

include/zephyr/linker/common-rom/common-rom-kernel-devices.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
4343
#endif
4444

45-
#if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
45+
#if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_SRAM_SW_ISR_TABLE)
4646
SECTION_PROLOGUE(sw_isr_table,,)
4747
{
4848
/*

0 commit comments

Comments
 (0)