Bootstrapping Freestanding, part 2
Parts: 1, 2
Time to start using the C library! Though this article is about all the things that can go wrong when you start to do that. First, let’s replace the infinite loop at the end of init.S with a jump to the C library’s entry point (in this case newlib).
init.S@@ -21,19 +28,38 @@ _entry: stmia r9!, {r0-r7} b 1b 2: -1: b 1b + b _mainCRTStartup
The first issue is:
Bootstrapping Freestanding, part 1
Parts: 1, 2
Recently I was building the platform support for a Cortex-R5 microcontroller. It is executing out of QSPI flash, with SRAM (static RAM, doesn’t need a controller set up unlike DRAM) and tightly coupled memory: ATCM is typically for instructions, and BTCM is typically for data. The benefit of {A,B}TCM is much faster access, and it is present even when doing erases/writes to the flash. On the other hand, it is not accessible for other devices in the system (e.g. network DMA engines), unlike the SRAM.