Skip to main content
NH_it
Associate II
June 10, 2020
Question

How to change VECT_TAB_OFFSET in IDE (MX)

  • June 10, 2020
  • 3 replies
  • 3211 views

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.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
June 10, 2020

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 VenmoUp vote any posts that you find helpful, it shows what's working..
NH_it
NH_itAuthor
Associate II
June 10, 2020

Your words mean is

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

TDK
Super User
June 10, 2020

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_it
NH_itAuthor
Associate II
June 10, 2020

Thanks for your advice.

I understand now.​

berendi
Principal
June 10, 2020

> 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_it
NH_itAuthor
Associate II
June 16, 2020

Thanks for your advice.

I help it