cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32 library] Library improvement

YDann.7
Associate III

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.

3 REPLIES 3
Imen GH
ST Employee

​Hello @Community member​ ,

I will report your feedback to our team for consideration.

Thanks for your contribution.

Imen

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
Up vote any posts that you find helpful, it shows what's working..
YDann.7
Associate III

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.