Skip to content

Commit af0db50

Browse files
committed
tests: arch: arm: irq_advanced_features: fix build issue
This commit fixes build issue when multi level interrupts feature is enabled, define new macro TEST_1ST_LEVEL_INTERRUPTS_MAX to support multi level interrupts case. - error: array subscript 24 is above array bounds of 'volatile uint32_t[16]' {aka 'volatile unsigned int[16]'} [-Werror=array-bounds]) Signed-off-by: Biwen Li <[email protected]>
1 parent 959170a commit af0db50

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

tests/arch/arm/arm_irq_advanced_features/src/arm_dynamic_direct_interrupts.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
#include <zephyr/sys/barrier.h>
1111

1212
/* Offset for the Direct interrupt used in this test. */
13+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
14+
#define DIRECT_ISR_OFFSET (CONFIG_2ND_LVL_ISR_TBL_OFFSET - 1)
15+
#else
1316
#define DIRECT_ISR_OFFSET (CONFIG_NUM_IRQS - 1)
17+
#endif
1418

1519
static volatile int test_flag;
1620

tests/arch/arm/arm_irq_advanced_features/src/arm_irq_target_state.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#include <cmsis_core.h>
1010

1111
#if defined(CONFIG_ARM_SECURE_FIRMWARE) && defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
12+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
13+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_2ND_LVL_ISR_TBL_OFFSET - 1)
14+
#else
15+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_NUM_IRQS - 1)
16+
#endif
1217

1318
extern irq_target_state_t irq_target_state_set(unsigned int irq, irq_target_state_t target_state);
1419
extern int irq_target_state_is_secure(unsigned int irq);
@@ -24,7 +29,7 @@ ZTEST(arm_irq_advanced_features, test_arm_irq_target_state)
2429
*/
2530
int i;
2631

27-
for (i = CONFIG_NUM_IRQS - 1; i >= 0; i--) {
32+
for (i = TEST_1ST_LEVEL_INTERRUPTS_MAX; i >= 0; i--) {
2833
if (NVIC_GetEnableIRQ(i) == 0) {
2934
/*
3035
* In-use interrupts are automatically enabled by

tests/arch/arm/arm_irq_advanced_features/src/arm_zero_latency_irqs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
#include <cmsis_core.h>
1010
#include <zephyr/sys/barrier.h>
1111

12+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
13+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_2ND_LVL_ISR_TBL_OFFSET - 1)
14+
#else
15+
#define TEST_1ST_LEVEL_INTERRUPTS_MAX (CONFIG_NUM_IRQS - 1)
16+
#endif
17+
1218
static volatile int test_flag;
1319

1420
void arm_zero_latency_isr_handler(const void *args)
@@ -39,7 +45,7 @@ ZTEST(arm_irq_advanced_features, test_arm_zero_latency_irqs)
3945

4046
zassert_false(init_flag, "Test flag not initialized to zero\n");
4147

42-
for (i = CONFIG_NUM_IRQS - 1; i >= 0; i--) {
48+
for (i = TEST_1ST_LEVEL_INTERRUPTS_MAX; i >= 0; i--) {
4349
if (NVIC_GetEnableIRQ(i) == 0) {
4450
/*
4551
* Interrupts configured statically with IRQ_CONNECT(.)

0 commit comments

Comments
 (0)