Skip to main content
Associate II
Apr 20, 2026 14:12 UTC
Question

SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET;

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;

7 replies

mƎALLEm
ST Technical Moderator
Apr 20, 2026 14:21 UTC

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 "Best answer" on the reply which solved your issue or answered your question.
Associate II
Apr 20, 2026 14:31 UTC

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
Apr 20, 2026 14:33 UTC

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