AnsweredAssumed Answered

VTOR setting in startup code

Question asked by biafra on Jan 4, 2018
Latest reply on Jan 8, 2018 by Jorge Antonio Alcala Vazquez

Hi everyone,

 

I use MCUXpresso SDK: I noticed that in the startup code for all the compilers other than MCUXpresso, there is the code for setting VTOR register before the call of the SystemInit function, but there isn't such code for MCUXpresso compiler.

 

For ARM:

LDR R0, =0xE000ED08
LDR R1, =__Vectors
STR R1, [R0]
LDR R2, [R1]
MSR MSP, R2

 

For GCC:

.equ VTOR, 0xE000ED08
ldr r0, =VTOR
ldr r1, =__isr_vector
str r1, [r0]
ldr r2, [r1]
msr msp, r2

 

For IAR:

LDR R0, =0xE000ED08
LDR R1, =__vector_table
STR R1, [R0]
LDR R2, [R1]
MSR MSP, R2

 

What is the reason for this choice?

How can I set the VTOR register?

 

Many thanks

Biafra

Outcomes