Skip to main content
HPATH.1
Associate III
September 9, 2025
Question

LL code generated by cube MX interrupt vector table not linked.

  • September 9, 2025
  • 1 reply
  • 354 views

I am using custom board with STM32G030F6P6.  Used Cube Mx to generate code with LL  library. Interrupts not working,  I need to add this SCB->VTOR = FLASH_BASE; in main.c 

Even after this also ADC DMA interrupt wont work. Need to rewrite the ADC_Init() to get it work. 

Just keeping you informed. Same thing happened with STM32G030C8T6 also

 

 

 

 

1 reply

Pavel A.
Super User
September 9, 2025

This is strange. VTOR normally is not initialized in any generated code, either HAL or LL. It should be initialized in the function SystemInit, in system_stm32xxxx.c.

 

 

HPATH.1
HPATH.1Author
Associate III
September 9, 2025

 

the below code is latest generated by CubeMX for STM32G030F6P6. now

/************************* Miscellaneous Configuration ************************/
/* Note: Following vector table addresses must be defined in line with linker
 configuration. */
/*!< Uncomment the following line if you need to relocate the vector table
 anywhere in Flash or Sram, else the vector table is kept at the automatic
 remap of boot address selected */
/* #define USER_VECT_TAB_ADDRESS */

#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
 in Sram else user remap will be done in Flash. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
 This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
 This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
 This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
 This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* USER_VECT_TAB_ADDRESS */

HPATH1_1-1757391170772.png

this is in HAL code generated by Cube MX for STM32G070RBT6.  Three years ago

/**
 * @brief Setup the microcontroller system.
 * @PAram None
 * @retval None
 */
void SystemInit(void)
{
 /* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
 SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
 SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}

HPATH1_0-1757391140135.png

I never knew about, we need to define it.