Skip to content

Commit f6f2e57

Browse files
facchinmkartben
authored andcommitted
soc: renesas: ra: ra6m5: clear NVIC->ITNS at startup for non TZ
Otherwise, interrupts will trigger a very funny fault See https://github.com/arduino/ArduinoCore-renesas/blob/main/cores/arduino/main.cpp#L49-L57 Signed-off-by: Martino Facchin <m.facchin@arduino.cc>
1 parent 67834a8 commit f6f2e57

File tree

1 file changed

+10
-3
lines changed
  • soc/renesas/ra/ra6m5

1 file changed

+10
-3
lines changed

soc/renesas/ra/ra6m5/soc.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,16 @@ void soc_early_init_hook(void)
5757
R_PSCU->PSARD = 0;
5858
R_PSCU->PSARE = 0;
5959

60-
R_CPSCU->ICUSARG = 0;
61-
R_CPSCU->ICUSARH = 0;
62-
R_CPSCU->ICUSARI = 0;
60+
/* The secure Attribute managed within the ARM CPU NVIC must match the
61+
* security attribution of IELSEn registers (Reference section 13.2.9
62+
* in the RA6M4 manual R01UH0890EJ0050).
63+
*/
64+
uint32_t volatile *p_icusarg = &R_CPSCU->ICUSARG;
65+
66+
for (int i = 0; i < BSP_ICU_VECTOR_MAX_ENTRIES / NUM_BITS(uint32_t); i++) {
67+
p_icusarg[i] = 0;
68+
NVIC->ITNS[i] = 0;
69+
}
6370

6471
/* Enable protection using PRCR register. */
6572
R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_SAR);

0 commit comments

Comments
 (0)