Interrupt Vector Table in RAM Topic is solved
Posted: Tue Nov 09, 2021 8:48 am
Hi!
We need to have the Vector table in RAM, because we can have a problem with code fetch from flash.
Kind regards,
Klaus
We suggest the following change:
--- \os\common\startup\ARMCMx\compilers\GCC\crt0_v7m.S 2020-09-04 09:54:04.000000000 +0100
+++ \os\common\startup\ARMCMx\compilers\GCC\crt0_v7m.S 2021-11-09 08:39:59.000000000 +0100
@@ -197,12 +197,27 @@
/* PSP stack pointers initialization.*/
ldr r0, =__process_stack_end__
msr PSP, r0
#if CRT0_VTOR_INIT == TRUE
+ /* copy Vector Table to RAM */
+ /* Data initialization. Note, it assumes that the DATA size
+ is a multiple of 4 so the linker file must ensure this.*/
+ ldr r1, =_ram_vectors_load
+ ldr r2, =_ram_vectors_start
+ ldr r3, =_ram_vectors_end
+vloop:
+ cmp r2, r3
+ ittt lo
+ ldrlo r0, [r1], #4
+ strlo r0, [r2], #4
+ blo vloop
+
+ /* set base address of Vector Table */
ldr r0, =_vectors
movw r1, #SCB_VTOR & 0xFFFF
movt r1, #SCB_VTOR >> 16
str r0, [r1]
#endif
We need to have the Vector table in RAM, because we can have a problem with code fetch from flash.
Kind regards,
Klaus
We suggest the following change:
--- \os\common\startup\ARMCMx\compilers\GCC\crt0_v7m.S 2020-09-04 09:54:04.000000000 +0100
+++ \os\common\startup\ARMCMx\compilers\GCC\crt0_v7m.S 2021-11-09 08:39:59.000000000 +0100
@@ -197,12 +197,27 @@
/* PSP stack pointers initialization.*/
ldr r0, =__process_stack_end__
msr PSP, r0
#if CRT0_VTOR_INIT == TRUE
+ /* copy Vector Table to RAM */
+ /* Data initialization. Note, it assumes that the DATA size
+ is a multiple of 4 so the linker file must ensure this.*/
+ ldr r1, =_ram_vectors_load
+ ldr r2, =_ram_vectors_start
+ ldr r3, =_ram_vectors_end
+vloop:
+ cmp r2, r3
+ ittt lo
+ ldrlo r0, [r1], #4
+ strlo r0, [r2], #4
+ blo vloop
+
+ /* set base address of Vector Table */
ldr r0, =_vectors
movw r1, #SCB_VTOR & 0xFFFF
movt r1, #SCB_VTOR >> 16
str r0, [r1]
#endif