Foundations · Lesson 10 of 11 · about 8 min
The full picture
One device, one cycle, every lesson
Follow one cycle of a thermostat. Every embedded device, from a toy to a car, repeats the same pattern: wait, sense, decide, act, sleep.
- Power on: the CPU runs the program from flash and sets up pins, buses and timers.
- The timer counts by itself while the CPU rests.
- The timer raises an interrupt and the scheduler wakes the sensor task.
- Over I2C, the MCU asks the sensor for the temperature.
- The code compares it with the target and sets one GPIO bit: the heater turns on.
- The display task draws the new value on the screen.
- A button press raises an interrupt and changes the target.
- Everything is done: the CPU sleeps until the next tick.
The device is like a body
| Body | Embedded |
|---|---|
| Brain | CPU |
| Long-term memory | Flash, where the program lives |
| Short-term memory | RAM, where the variables live |
| Heartbeat | Timer |
| Reflex | Interrupt |
| Eyes and skin | Sensors and ADC |
| Muscles | Outputs: LEDs, motors, heaters |
| Nerves | Wires and buses: I2C, SPI, UART |
From your computer to the chip
- Write C code in an IDE such as STM32CubeIDE.
- The compiler turns it into a binary file.
- The programmer on the board (for example ST-LINK) writes the binary into flash. This is flashing.
- The MCU restarts and runs your code.
- The debugger pauses the chip so you can look at variables and registers, line by line.
In BoardPilot, Flash firmware backs up the board before it writes, and Monitor shows what your code prints.
Interview questions
- Walk me through what happens from power on to the first sensor reading.
- How does the code get from your computer into the chip?
No answers here on purpose: try answering out loud first. In the BoardPilot app, the interview coach reads your own answer and tells you what was right, what is missing and what a senior interviewer would ask next (it uses the AI provider you choose in the app). Embedded systems interview questions →
Key terms
Embedded system Firmware Flash memory RAM (SRAM) Debugger JTAG and SWD Flashing Toolchain Cross-compiler SDK
In the app, the lessons come alive
The lessons have interactive demos and hands-on labs checked on your board in the app. These pages are the readable version: the demos are described in words, and the labs need the app.