Skip to content
BoKSA

Compilers & Toolchains

Compilers & Toolchains

Use this page to revise what happens between a .c file and bytes in flash.

Compile vs. interpret

A compiler translates source to object/machine code before the program runs. An interpreter executes source (or bytecode) while it runs. MCU firmware is almost always compiled. A cross-compiler runs on your PC and targets a different CPU (ARM, Xtensa, AVR).

Toolchain stages

Typical stages: preprocess → compile → assemble → link. The linker places sections (.text, .data, .bss) using a linker script. A hex/bin/elf file is what you flash or debug.

Warnings and optimisation

Compiler warnings are often real bugs on embedded (truncation, unused, implicit declarations). Optimisation can remove "useless" reads of registers unless they are volatile.

Starting Points

Key Points

  • You can explain compiler vs. interpreter and what a cross-compiler is for.
  • You can name the toolchain stages including link.
  • You can explain .text / .data / .bss at a high level.
  • You can explain why volatile exists for hardware registers.
  • You can explain what an ELF vs. a raw binary is used for.