Roadmap / Firmware
Machine Code & Assembly
When a hard fault hits or the optimizer rewrites your code, machine code is what you end up reading.
Goal Follow what happens from reset to main().
- 01What an instruction is
Machine code is the numbers the CPU reads; assembly is the names for those numbers.
- 02Reading Thumb instructions
MOV, LDR, STR, B and BL on ARM Cortex-M.
- 03Registers and calling convention
Arguments in r0 to r3, return address in lr, stack position in sp.
- 04C versus assembly
Disassembling a small C function line by line and comparing optimization levels.
- 05Startup code
.data is copied to RAM and .bss zeroed before main is called.
- 06Linker scripts and sections
The file that decides where .text, .data and .bss sit in Flash and RAM.
- 07Vector table
The table holding the initial stack value and the handler addresses.
- 08Hard-fault analysis
Finding the failing line from the registers left on the stack.