I build the bootloader for STM32F4 and build user app with the changes the VECT_TAB_OFFSET value manually for SCB->VTOR in system_stm32f4xx.c file but If I do it in the application. It's not working properly.
I called the SCB->VTOR = 0x8040000 at the beginning of the main() but it didn't work.BOOTLOADER USER APPLICATION
The STM32 startup code calls SystemInit()
before main()
. SystemInit()
sets the SCB->VTOR
value (among other things). SystemInit()
is implemented in the vendor provided file system_stm32f4xx.c
. You can customize the value that gets assigned to SCB-VTOR
by editing the value of VECT_TAB_OFFSET
, which is also defined in system_stm32f4xx.c
. (There should be a copy of system_stm32f4xx.c
in your project folder that you can customize for your project.)
If you need different values of VECT_TAB_OFFSET
for your boot and application programs then you can use a preprocessor statement like this. (This allows the boot and application programs to use the same copy of system_stm32fxx.c
. Alternatively you could use different copies of the file for each program.)
#ifdef BOOT
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_OFFSET 0x80000
#endif