You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/07/07 09:25:18 UTC

[nuttx] branch releases/12.2 updated: arch/armv8-m/arm_secure_irq.c: fix writing to the NVIC_AIRCR register

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

pkarashchenko pushed a commit to branch releases/12.2
in repository https://gitbox.apache.org/repos/asf/nuttx.git


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

commit b787e9ec3ba40d5057205b7a46ae9c7461f3a23e
Author: raiden00pl <ra...@railab.me>
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);