C/C++ Runtime Startup
When writing a freestanding application, it’s generally necessary for the firmware engineer to handle runtime initialization.
Even when a library like newlib includes a rudimentary implementation of crt0.o
, initialization is a very application-specific process owing to the need to initialize hardware, memory, and other loading tasks.
In this essay, we examine the current and historical implementation of executable initialization, finishing with a minimal implementation usable with firmware applications.
Note: Most firmware applications need to address the initialization of
.data
and.bss
from nonvolatile memory. That is not addressed in this essay.