Problems with self-made startup sequence, code will not execute but map file looks ok
- December 10, 2021
- 11 replies
- 3858 views
Hello Everyone.
I'm currently trying to understand how the startup sequence (from power-on to main) of the STMs work.
As I always used the provided tools and files from ST I never had to deal with linker scripts, startup code etc.
This lack of knowledge always bothered me, so I decided to fill this gap.
I thought to make a small project where I don't use any of the ST files and write everything on my own to learn how the startup process actually works.
For this purpose, I created a very basic blinky LED project for a Nucleo-F072RB board, tested it with the common toolchain (CubeIDE and STM scripts & files) to make sure that the code is correct and then create the whole startup sequence on my own with the help of some online tutorials on this matter.
As I'm not familiar with assembly language I unfortunately couldn't take the ST files as a base (and because they are much more advanced as I want them to be for the start)
My toolchain is as follows:
Compiler: ARM (arm-none-eabi-gcc)
Build Utility: GNU Make
Programmer: CubeProgrammer
As the title of my question already suggests I was not able to get it working and therefore seeking your help.
I created a very basic makefile, a startup code where I set up the memory sections and provide the vector table, as well as a simple linker script. For the main code I created a small device header where I simply copied the necessary register defines from the official stm32f072xx.h.
The compilation works without issues and the map file also looks ok. I can see that the vector table is set up in the correct memory region (at least as far as my understanding goes).
But after looking at the GPIO registers I manipulate in my code, I can see that they are unchanged and therefore my code was not executed at all.
Because I have no experience with this, I don't have much ideas about what could cause the problem. But it seems that there is most probably still something wrong with the linker script or startup code.
So it would be much appreciated if someone could have a look at my files and help me finding the problem and get a better understanding of the whole process.
Thank you in advance
Best regards
Flo
