tests: arch: arm: interrupt: test the spurious ISR handler

We extend the interrupt test for ARM Cortex-M so that
it can test the behavior of the spurious ISR handler.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2020-03-09 20:44:44 +01:00 committed by Johan Hedberg
commit f003c8b508
2 changed files with 20 additions and 1 deletions

View file

@ -6,7 +6,8 @@ Description:
The first test verifies that we can handle system fault conditions
while running in handler mode (i.e. in an ISR). Only for ARM
Cortex-M targets.
Cortex-M targets. The test also verifies the behavior of the
spurious interrupt handler.
The second test verifies that threads in user mode, despite being able to call
the irq_lock() and irq_unlock() functions without triggering a CPU fault,

View file

@ -87,6 +87,24 @@ void test_arm_interrupt(void)
TC_PRINT("Available IRQ line: %u\n", i);
/* Verify that triggering an interrupt in an IRQ line,
* on which an ISR has not yet been installed, leads
* to a fault of type K_ERR_SPURIOUS_IRQ.
*/
expected_reason = K_ERR_SPURIOUS_IRQ;
NVIC_ClearPendingIRQ(i);
NVIC_EnableIRQ(i);
NVIC_SetPendingIRQ(i);
__DSB();
__ISB();
/* Verify that the spurious ISR has led to the fault and the
* expected reason variable is reset.
*/
zassert_true(expected_reason == -1,
"expected_reason has not been reset\n");
NVIC_DisableIRQ(i);
arch_irq_connect_dynamic(i, 0 /* highest priority */,
arm_isr_handler,
NULL,