embedded firmware from scratch - part 3
Which code does execute first when a microcontroller starts to run? Many would say:
Firmware execution starts at the
main()
function
Eventhough that is a reasanoble and expected answer, a lot should have already happened when the execution gets there.
Let’s take a look at a few crucial steps for embedded development that are usually ignored when coding for complete operating systems like Linux, where the toolchain will probably take care of everything correctly. I’m talking about startup code and the linker script. They will provide the very first instructions that execute when the processor starts and tell the linker where to put the binary bits that the compiler it is creating, every function and most of the variables will get an address in memory base on this.
This is the third article in a series about creating a firmware project from scratch. The other ones are available at PART 1 and PART 2.
Continue reading...