Skip to content

Conversation

bjarki-andreasen
Copy link

Adapt code to allow removing sw isr table, saving 2K ROM

Update nrf to include no sw isr table changes.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The software isr table is not needed for bare metal. To avoid using
it, all interrupts must be placed directly in the vector table,
which is done using IRQ_DIRECT_CONNECT(). Update all in tree uses
and disable GEN_SW_ISR_TABLE by default.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
@bjarki-andreasen bjarki-andreasen requested review from a team as code owners August 7, 2025 10:10
@NordicBuilder
Copy link

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
nrf nrfconnect/[email protected] nrfconnect/sdk-nrf#23793 nrfconnect/sdk-nrf#23793/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@@ -6,13 +6,20 @@

#include <zephyr/sys/printk-hooks.h>
#include <zephyr/sys/libc-hooks.h>
#include <zephyr/irq.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit needs <blah>: <blah> format

@@ -19,6 +19,14 @@ void relocate_vector_table(void)
/* Empty, but needed */
}

#ifdef CONFIG_NRF5_SDK_IRQ_CONNECT_GPIOTE
ISR_DIRECT_DECLARE(gpiote0_isr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjarki-andreasen Why is this needed instead of providing nrfx_gpiote_0_irq_handler directly in IRQ_DIRECT_CONNECT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the macro ISR_DIRECT_DECLARE() adds required header and footer to the function, its not as simple as a void fn(void)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SoftDevice interrupt forwarding is missing ISR_DIRECT_DECLARE(). Is that different or is this required there as well?

See

extern void CLOCK_POWER_IRQHandler(void);
extern void RADIO_0_IRQHandler(void);
extern void TIMER10_IRQHandler(void);
extern void GRTC_3_IRQHandler(void);
extern void ECB00_IRQHandler(void);
extern void AAR00_CCM00_IRQHandler(void);
extern void SWI00_IRQHandler(void);

IRQ_DIRECT_CONNECT(CLOCK_POWER_IRQn, PRIO_LOW, CLOCK_POWER_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(RADIO_0_IRQn, PRIO_HIGH, RADIO_0_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(TIMER10_IRQn, PRIO_HIGH, TIMER10_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(GRTC_3_IRQn, PRIO_HIGH, GRTC_3_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(ECB00_IRQn, PRIO_LOW, ECB00_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(AAR00_CCM00_IRQn, PRIO_LOW, AAR00_CCM00_IRQHandler, IRQ_ZERO_LATENCY);
IRQ_DIRECT_CONNECT(SWI00_IRQn, PRIO_LOW, SWI00_IRQHandler, IRQ_ZERO_LATENCY);

Copy link
Author

@bjarki-andreasen bjarki-andreasen Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If TIMER10_IRQHandler etc. declare the appropriate attributes, like __attribute__((interrupt)) etc. then its no problem, especially given they are zero latency. But in general, the ISR_DIRECT_DECLARE macro should be used as it wraps the function in these attributes automatically

@eivindj-nordic eivindj-nordic added this to the v0.9.0 milestone Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants