Roadmap / Foundations
C Language
Most embedded firmware is still written in C. Once pointers and bit operations feel natural, everything after opens up.
Goal Write code that reads and writes registers directly.
- 01Variables and types
Why we use fixed-width types such as uint8_t and int16_t instead of int, plus signedness and overflow.
- 02Operators and conversions
Integer division, implicit conversions and operator precedence: where bugs like to hide.
- 03Control flow
Building flow with if, switch, for and while, and why firmware is an endless loop.
- 04Functions and scope
Pass-by-value, the lifetime of local and global variables, and why recursion is risky on an MCU.
- 05Arrays and strings
Contiguous data in memory, null-terminated strings, and how buffer overflows happen.
- 06Pointers
A variable that holds an address. Reading and writing a specific address is all register control is.
- 07Advanced pointers and function pointers
Pointer arithmetic, double pointers, and function pointers for callbacks and state machines.
- 08Structs, unions and bit-fields
Describing register blocks and packets with structs, and checking alignment and padding.
- 09Bit operations
Clear with AND, set with OR, toggle with XOR, move with shifts.
- 10volatile, const, static
volatile blocks optimization, const fixes a value, static changes scope and lifetime.
- 11Preprocessor and macros
#define, conditional compilation, header guards, and the traps macros set.
- 12The build process
Preprocess, compile, assemble, link: how source becomes an executable, and how to read linker errors.