2023-11-24 06:12 AM
Hi all, we've been developing some applications using STM32H743BG since 2020 and only now we realized that value of VECT_TAB_OFFSET has been changed according the package used in STM32Cube. So, these are the differences between different Cube versions:
STM32Cube FW_H7 V1.9.0:
#define VECT_TAB_OFFSET 0x00000000UL /*!< Vector Table base offset field. This value must be a multiple of 0x200. */
STM32Cube FW_H7 V1.10.0:
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field. This value must be a multiple of 0x300. */
STM32Cube FW_H7 V1.11.1:
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field. This value must be a multiple of 0x400. */
So, my question is: what offset value should be used? Offset of 0x200, 0x300 or 0x400?
Where is possible to find this information on the available documentation?
Regards,
Tiago F. Borth
Solved! Go to Solution.
2023-11-24 06:31 AM - edited 2023-11-24 06:33 AM
The latest version is correct. It should be a multiple of 0x400. It is the lowest multiple of 2 which can contain all the vector table entries.
The restriction is part of Cortex documentation.
Note that the value of VECT_TAB_OFFSET hasn't change at all in any of these revisions. Only the comment has changed. The default value is 0 in all of them.
2023-11-24 06:31 AM - edited 2023-11-24 06:33 AM
The latest version is correct. It should be a multiple of 0x400. It is the lowest multiple of 2 which can contain all the vector table entries.
The restriction is part of Cortex documentation.
Note that the value of VECT_TAB_OFFSET hasn't change at all in any of these revisions. Only the comment has changed. The default value is 0 in all of them.
2023-11-24 07:12 AM
Hello @TFBorth
As explained by @TDK, the vector table is defined in the "system_stm32fxxx" by default at the start address of the user Flash area. The minimum alignment is 32 words, enough for up to 16 interrupts. For more interrupts, you can adjust the alignment by rounding up to the next power of two.
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.
2023-11-24 07:31 AM
For several years (and many projects) on H7 I used the table alignment 0x200 and no one noticed, because all used vectors were in range of 0x200. Only noticed it when used ADC3 interrupt.
2023-11-24 10:05 AM
Can likely check the stuck-at-zero (STZ) bits of the SCB->VTOR
Although I'm not sure the alignment falls under the flash sector/page sizes in most cases.
I'd wished this define nonsense would have been dispatched years ago, as 99.9% of use cases could simply have used the linker symbols to set SCB->VTOR as built rather than create secondary dependencies.