Skip to main content
Associate II
April 20, 2026
Question

SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET;

  • April 20, 2026
  • 1 reply
  • 218 views

I configured a nucleato-L152RE LED program using CubeMX6.17+STM32L1 Firmware Package V1.10.6 and found that the program kept restarting automatically. After adding the following code to the SystemInit() function generated by CubeMX, the problem was solved. What is the reason for this? And my other projects never need to include this line of code, such as F103, F411, G431, L051, and so on.
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET;

1 reply

mƎALLEm
Technical Moderator
April 20, 2026

Hello,

VTOR is the vector table offset register. That should be set at the start. It contains the start address of the interrupts routine list. 

Please refer to "Interrupt and exception vectors" in the RM0008.

"And my other projects never need to include this line of code, such as F103, F411, G431, L051, and so on."

It may be available but you didn't find it.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
Associate II
April 20, 2026

I added this code only after discovering that there was an issue with initializing the interrupt vector table, but other projects have never manually added this code. They are generated by CubeMX and and can run correctly.

Associate II
April 20, 2026

I am quite puzzled as to why the L152 project needs to manually add this code?