VTOR setting in startup code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

VTOR setting in startup code

跳至解决方案
2,705 次查看
biafra
Senior Contributor I

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

1 解答
2,394 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Francesco Bianchini 

As long as MCUXpresso IDE uses a GCC compiler, if you want to set VTOR register you could use the same code that you mentioned, you will only have to specify that you going to uses assembly code.

Hope this helps

Best Regards

Jorge Alcala

在原帖中查看解决方案

1 回复
2,395 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Francesco Bianchini 

As long as MCUXpresso IDE uses a GCC compiler, if you want to set VTOR register you could use the same code that you mentioned, you will only have to specify that you going to uses assembly code.

Hope this helps

Best Regards

Jorge Alcala