Skip to content

Commit 0ebc560

Browse files
committed
tests: arch: arm: custom_interrupt: fix build issue
Fix build issue when multi level interrupts is enabled, define new macro TEST_1ST_LEVEL_INTERRUPTS_MAX to support multi level interrupts case. - core_cm33.h:2559:47: error: iteration 496 invokes undefined behavior [-Werror=aggressive-loop-optimizations] Signed-off-by: Biwen Li <[email protected]>
1 parent af0db50 commit 0ebc560

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/arch/arm/arm_custom_interrupt/src/arm_custom_interrupt.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ static volatile bool custom_set_priority_called;
1717
static volatile bool custom_eoi_called;
1818
static volatile bool irq_handler_called;
1919

20+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
21+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_2ND_LVL_ISR_TBL_OFFSET - 1)
22+
#else
23+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_NUM_IRQS - 1)
24+
#endif
25+
2026
/* Define out custom SoC interrupt controller interface methods.
2127
* These closely match the normal Cortex-M implementations.
2228
*/
@@ -29,7 +35,7 @@ void z_soc_irq_init(void)
2935
{
3036
int irq = 0;
3137

32-
for (; irq < CONFIG_NUM_IRQS; irq++) {
38+
for (; irq < TEST_1ST_LEVEL_INTERRUPTS_MAX; irq++) {
3339
NVIC_SetPriority((IRQn_Type)irq, _IRQ_PRIO_OFFSET);
3440
}
3541

@@ -127,7 +133,7 @@ ZTEST(arm_custom_interrupt, test_arm_custom_interrupt)
127133
/* Determine an NVIC IRQ line that is not currently in use. */
128134
int i;
129135

130-
for (i = CONFIG_NUM_IRQS - 1; i >= 0; i--) {
136+
for (i = TEST_1ST_LEVEL_INTERRUPTS_MAX; i >= 0; i--) {
131137
if (NVIC_GetEnableIRQ(i) == 0) {
132138
/*
133139
* Interrupts configured statically with IRQ_CONNECT(.)

0 commit comments

Comments
 (0)