2021-10-11 08:22 AM
In file generated by CubeMx when creating a new project, the SystemInit function does not set the register of the interrupt vector table (SCB-> VTOR) !!!
The default value is zero, which causes a crash on the first interrupt trigger, i.e. the code loops to an address 0x1FFFxxxx (system memory)
/**
* @brief Setup the microcontroller system.
* @retval None
*/
void SystemInit(void)
{
#if defined(USER_VECT_TAB_ADDRESS)
/* Configure the Vector Table location -------------------------------------*/
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
#endif
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 20U)|(3UL << 22U)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
...
code of the previous version of the package
/**
* @brief Setup the microcontroller system.
* @param None
* @retval None
*/
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set MSION bit */
RCC->CR |= RCC_CR_MSION;
/* Reset CFGR register */
RCC->CFGR = 0x00000000U;
/* Reset HSEON, CSSON , HSION, and PLLON bits */
RCC->CR &= 0xEAF6FFFFU;
/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x00001000U;
/* Reset HSEBYP bit */
RCC->CR &= 0xFFFBFFFFU;
/* Disable all interrupts */
RCC->CIER = 0x00000000U;
/* 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
}
why this register is no longer set with the default flash memory address ?
Thanks for your help
Solved! Go to Solution.
2024-01-20 09:48 PM - edited 2024-01-20 09:52 PM
Hello Imen.D,
I think “There is a change request which is deployed on all STM32 series:” is not true for STM32U5xx(STM32U585 to be precise) series. Neither USER_VECT_TAB_ADDRESS nor VECT_TAB_BASE_ADDRESS is defined in the package.
Below is the setup details:
My problem seems as same as below screenshot and link.
I have spent enough time on this and now got completely blank. Looking out for immediate support from #ST #STM32U5 #SysTick
As I am relatively new to the bootloaders, any help will be much appreciated.
Also, I have 5 system_stm32u5xx.c files in my project. Which are for Secure Appli, Non secure Appli, Secure loader, Non secure loader and SBSFU projects. And I am not sure which file I should work on, I believ it is either Secure Appli or Non secure Appli.
2024-01-24 11:35 AM
Same on STM32L051. Weird change which makes vanilla CubeMX projects not working.
Spent few hours until found this thread.
2024-06-21 02:00 AM
Hello,
on STM32F723 i noted that VTOR has an hw default value different than FLASH_BASE.
SysTick interrupt works.
If I Uncomment then the VTOR has value FLASH_BASE
SysTick interrupt also works
I am confused.
Can you point me on a complete doc about VTOR ?
The PM0253 tell me that VTOR value at reset is Unknown (Table 50). Does exist another documentation for VTOR reset value?
Thank you
Marco
2024-11-13 10:20 PM
I too (running CubeIDE v1.16.1 and FW_F1 v1.8.6 with a STM32F103C6T6A BluePill-like board from Amazon making a simple Blink test) just wasted a few hours trying to diagnose why HAL_Delay() wasn't working and why SysTick interrupt was jumping to a strange address with meaningless disassembly code until I fortunately found this thread. When creating a new project in CubeIDE, I wish the project configuration defaulted to the common case of having the interrupt table at the start of flash, and if user wanted something more intricate then there could be special options in the Project Manager tab.
2024-11-18 11:21 PM
It doesn't work for the STM32G070 (november, 2024).