Skip to main content
Graduate
November 24, 2023
Solved

Multiple value for VECT_TAB_OFFSET on STM32H7

  • November 24, 2023
  • 4 replies
  • 3145 views

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

    This topic has been closed for replies.
    Best answer by TDK

    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.

    https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-control-block/Vector-Table-Offset-Register?lang=en

     

    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.

    4 replies

    TDKAnswer
    Super User
    November 24, 2023

    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.

    https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-control-block/Vector-Table-Offset-Register?lang=en

     

    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.

    Technical Moderator
    November 24, 2023

    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 areaThe 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.

    Super User
    November 24, 2023

    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.

     

    Graduate II
    November 24, 2023

    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.