From b445029cf2df3c94dae30afdedf2feb48dd0a563 Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 18 May 2023 23:25:23 +0800 Subject: [PATCH] armv8m: fix up_secure_irq failed for NVIC_IRQ_BUSFAULT Signed-off-by: ligd --- arch/arm/src/armv8-m/arm_secure_irq.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/src/armv8-m/arm_secure_irq.c b/arch/arm/src/armv8-m/arm_secure_irq.c index bc88a3928c..376ec71f34 100644 --- a/arch/arm/src/armv8-m/arm_secure_irq.c +++ b/arch/arm/src/armv8-m/arm_secure_irq.c @@ -49,6 +49,8 @@ void up_secure_irq(int irq, bool secure) { + uint32_t keymask = 0; + uint32_t keyval = 0; uint32_t regaddr; uint32_t regval; uint32_t regbit; @@ -60,6 +62,8 @@ void up_secure_irq(int irq, bool secure) case NVIC_IRQ_BUSFAULT: regaddr = NVIC_AIRCR; regbit = NVIC_AIRCR_BFHFNMINS; + keymask = NVIC_AIRCR_VECTKEY_MASK; + keyval = NVIC_AIRCR_VECTKEY; break; case NVIC_IRQ_DBGMONITOR: @@ -85,6 +89,7 @@ void up_secure_irq(int irq, bool secure) regval |= regbit; } + regval = (regval & ~keymask) | keyval; putreg32(regval, regaddr); }