This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 91be7781f5 arch/armv8-m/arm_secure_irq.c: fix writing to the 
NVIC_AIRCR register
91be7781f5 is described below

commit 91be7781f506aa31a4a1f8321cb7633cbd3dbfa4
Author: raiden00pl <[email protected]>
AuthorDate: Tue Jul 4 13:14:17 2023 +0200

    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);

Reply via email to