VTOR setting in startup code

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

VTOR setting in startup code

ソリューションへジャンプ
2,174件の閲覧回数
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 解決策
1,863件の閲覧回数
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 返信
1,864件の閲覧回数
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