2022-01-13 12:39 PM
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.
2022-01-13 12:59 PM
Find-in-files "HardFault_Handler"
2022-01-13 01:18 PM
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.
2022-01-13 01:29 PM
I dont see any a startup folder or s files in core folder in ide.
2022-01-13 01:48 PM
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.
2022-01-13 02:14 PM
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
2022-01-13 02:44 PM
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...