Skip to content

Commit f9242d0

Browse files
committed
Fix runtime crash by ARMC6 build
1 parent 0d88ff0 commit f9242d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

targets/TARGET_NXP/TARGET_LPC11UXX/device/cmsis_nvic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
6060

6161
// Copy and switch to dynamic vectors if first time called
6262
if((LPC_SYSCON->SYSMEMREMAP & 0x3) != 0x1) {
63-
uint32_t *old_vectors = (uint32_t *)0; // FLASH vectors are at 0x0
63+
// Add volatile qualifier to avoid armclang aggressive optimization
64+
volatile uint32_t *old_vectors = (uint32_t *)0; // FLASH vectors are at 0x0
6465
for(i = 0; i < NVIC_NUM_VECTORS; i++) {
6566
vectors[i] = old_vectors[i];
6667
}

0 commit comments

Comments
 (0)