From b787e9ec3ba40d5057205b7a46ae9c7461f3a23e Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Tue, 4 Jul 2023 13:14:17 +0200 Subject: [PATCH] arch/armv8-m/arm_secure_irq.c: fix writing to the NVIC_AIRCR register Register key (VECTKEY) must be written, otherwise the write is ignored. Reference: https://developer.arm.com/documentation/100235/0004/the-cortex-m33-peripherals/system-control-block/application-interrupt-and-reset-control-register --- arch/arm/src/armv8-m/arm_secure_irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/armv8-m/arm_secure_irq.c b/arch/arm/src/armv8-m/arm_secure_irq.c index dc52a5454c..bc88a3928c 100644 --- a/arch/arm/src/armv8-m/arm_secure_irq.c +++ b/arch/arm/src/armv8-m/arm_secure_irq.c @@ -100,8 +100,8 @@ void up_secure_irq_all(bool secure) { int i; - modreg32(secure ? 0 : NVIC_AIRCR_BFHFNMINS, - NVIC_AIRCR_BFHFNMINS, NVIC_AIRCR); + modreg32((secure ? 0 : NVIC_AIRCR_BFHFNMINS) | NVIC_AIRCR_VECTKEY, + (NVIC_AIRCR_VECTKEY_MASK | NVIC_AIRCR_BFHFNMINS), NVIC_AIRCR); modreg32(secure ? NVIC_DEMCR_SDME : 0, NVIC_DEMCR_SDME, NVIC_DEMCR);