Skip to main content
YDann.7
Associate III
March 8, 2021
Question

[STM32 library] Library improvement

  • March 8, 2021
  • 3 replies
  • 799 views

Dear,

It's just an idea to improve the STM32 library.

In the "system_stm32fxxx.c" files in the CMSIS folder, the vector table offset is defined as follow :

#define VECT_TAB_OFFSET 0x00

In some product, I use a bottloader, so the vector table is relocated.

And then I have one Debug configuration and one Release configuration, the vector table offset isn't the same in this two configuration

  • Debug => no offset
  • Release => offset

To do this, I need to modify this file.

Why do not add a conditional compilation as is do for the oscillator value in the "stm32fxx_hal_conf.h" file ?

Something like that :

#if !defined (VECT_TAB_OFFSET) 
 #define VECT_TAB_OFFSET 0x00
#endif

Like that, it is possible to defined the "VECT_TAB_OFFSET" in the project properties proprocessor.

    This topic has been closed for replies.

    3 replies

    Imen GH
    ST Employee
    March 8, 2021

    ​Hello @Community member​ ,

    I will report your feedback to our team for consideration.

    Thanks for your contribution.

    Imen

    Tesla DeLorean
    Guru
    March 8, 2021

    Surely the REAL solution is to avoid all this #define nonsense and just let the linker fix the address with the GD vector table symbol?

    ie SCB->VTOR = &__Vectors;

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    YDann.7
    YDann.7Author
    Associate III
    March 8, 2021

    Yes, probably, but if I remember correctly, the vector table address isn't define is the same way depending the linker file (IAR or GCC).

    And to have something coherent between all libraries files, it more easy to add a conditional compilation.