cancel
Showing results for 
Search instead for 
Did you mean: 

How to change VECT_TAB_OFFSET in IDE (MX)

NH
Associate II

Now, I develop DFU.

0x80000000 : DFU Project

0x8000C000 : Application Project.

I have to change VECTOR Table in Application Area.

I'm trying to find VECT_TAB_OFFSET in IDE.

But, I can't

Old solution is directly change source code in System_stmf2xx.c

I don't know best solution.

Please give good advice.

6 REPLIES 6

Isn't that where it is defined.

ST's approach is broken.

I change the addresses in the Linker Script, and then use the symbol for the vector table out of startup.s in SystemInit() to set SCB->VTOR directly to the build address. This removes the need for multiple dependencies and source files.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Your words mean is

" VECT_TAB_OFFSET" can't define CUBEMX. right?​

TDK
Guru

I think he's saying that CubeMX copies the system_stm32f2xx.c file into your project directory, and it is meant to be modified by you if you need something other than the default configuration. The comments in the file itself tells you to modify it as needed:

/*!< Uncomment the following line if you need to relocate your vector Table in
     Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET  0x00 /*!< Vector Table base offset field. 
                                   This value must be a multiple of 0x200. */

Not everything is going to be able to be done in CubeMX. Some stuff like HSE_VALUE can be defined elsewhere. Doesn't seem like VECT_TAB_OFFSET is set up for that.

There's also nothing stopping you from adjusting SCB->VTOR yourself within your application code.

If you feel a post has answered your question, please click "Accept as Solution".
NH
Associate II

Thanks for your advice.

I understand now.​

berendi
Principal

> Old solution is directly change source code in System_stmf2xx.c

Yes, that's how broken code is supposed to be fixed.

> I don't know best solution.

Best solution is not relying on low quality code.

The g_pfnVectors array holds the vector table, but it is declared in assembly only.

extern uint32_t g_pfnVectors[];
SCB->VTOR = (uint32_t)g_pfnVectors;

NH
Associate II

Thanks for your advice.

I help it