cancel
Showing results for 
Search instead for 
Did you mean: 

Where is ISR vector table and C startup file in CubeIDE?

MLowe.3
Associate II

Hi, where can I access the ISR vector table and C startup file in cube IDE? In Atmel Studio it's listed in startup folder as startup_sam but I can't find it in cube.

6 REPLIES 6

Find-in-files "HardFault_Handler"

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

The startup file is an s-file found in Core/Startup. The vector is stored in flash and called g_pfnVectors. For the length of the vector table you can count the number of items in this table (and multiply by 4 to get the the length in bytes), or check the datasheet/manual (sometimes you need to know the exact processor/device category for the size).

In C/C++ you can use it like this:

extern uint32_t g_pfnVectors[VECTORTABLE_SIZE/4];

If there is a clean way to get VECTORTABLE_SIZE I'd like to know it. I successfully moved the table to RAM using VTOR (examples can be found in ARM documentation). Make sure the table in RAM is aligned properly. Cortex-M CPUs require the vector table to be aligned to a boundary width of the lowest power of 2 that will fit the entire vector table.

I dont see any a startup folder or s files in core folder in ide.

Hmm, I made a different project but used the "include library" button and it comes up now, interesting. For atmel studio the vector table is a struct given a section name which is placed at a certain address by the linker.

In the main repository these things live in the CMSIS Device tree

STM32Cube_FW_L0_V1.11.2\Drivers\CMSIS\Device\ST\STM32L0xx\Source\Templates\gcc\startup_stm32l010x8.s

Projects have the appropriate instance, so you can edit/modify those

STM32Cube_FW_L0_V1.11.2\Projects\NUCLEO-L011K4\Examples\CRC\CRC_Example\SW4STM32\startup_stm32l011xx.s

Sorry not using CubeIDE or CubeMX autogen tools here

Size is computed, so probably available symbolicly, or you could compute in linker script also

  .section .isr_vector,"a",%progbits

 .type g_pfnVectors, %object

 .size g_pfnVectors, .-g_pfnVectors

I tend to use the symbol to set SCB->VTOR, avoids a lot on nonsense seen in system_stm32xyz.c and SystemInit() code

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

It wasn't always in Core/Startup. It used to be in its own Startup folder. No doubt expanding all folders or doing a search would reveal it. It would also be listed when you compile the project, if it exists.

Search -> File...

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