What Are Embedded Systems?
Embedded Systems & Firmware · Embedded Systems & Firmware track
4 min read
In this module
Computers You Do Not See
So far in this course you've been thinking about general-purpose computers: machines with a CPU, gigabytes of RAM, an operating system, and a user interface. The overwhelming majority of processors on the planet are nothing like that. They're embedded systems — specialised computers tucked inside larger devices, running dedicated software for one specific job. Your car has dozens. So does your microwave, your thermostat, your smartwatch, and the router blinking on your shelf.
Microcontrollers vs Microprocessors
The CPU you studied in CPU Basics is a microprocessor. It needs external RAM, external storage, and peripheral chips to function. An embedded system typically uses a microcontroller (MCU) instead, which packs the CPU, memory, and I/O peripherals onto a single chip. An ARM Cortex-M4 microcontroller might have a 100 MHz CPU, 256 KB of flash, 64 KB of RAM, plus built-in serial ports, timers, and analogue-to-digital converters — the whole computer smaller than your fingernail.
That integration matters because embedded systems live under constraints general-purpose computers never feel.
Where your laptop might have 16 GB of RAM, an embedded system might have 64 KB - roughly 250,000 times less, so every byte counts. There is no virtual memory (Memory Fundamentals: Virtual Memory), no swap space, and often no memory protection. A bug that wastes a few kilobytes on a desktop is a critical failure on an MCU.
Worked Example: Spending 64 KB
Say you're writing firmware for that Cortex-M4, a sensor hub that reads a few sensors and reports over a radio, under a small RTOS. All the figures below are illustrative, but the shape is typical. The 65,536 bytes of RAM might go like this:
| Region | Size | What lives there |
|---|---|---|
Globals (.data and .bss) | 18 KB | Configuration, sensor state, lookup tables |
| Radio stack buffers | 16 KB | Packets being built or received |
| Heap | 16 KB | Anything allocated at run time |
| Task stacks | 4 x 2 KB = 8 KB | One stack per RTOS task |
| Interrupt stack | 2 KB | Shared by every interrupt handler |
| Headroom | 4 KB | Whatever's left |
Every task gets its own fixed-size stack, chosen by the programmer when the task is created. Nothing grows it later. On a laptop a thread's stack is typically megabytes, backed by virtual memory and fenced off by a guard page that traps the first access past the end. Here there's 2 KB and, unless someone set one up, no fence.
Predict: one task has a 2 KB stack. A colleague adds a local buffer, char line[2048];, to a function that task calls. It compiles without a warning. What happens when it runs?
Usually nothing obvious, at first. The stack pointer simply moves 2 KB further down, past the bottom of the task's stack and into whatever the linker or the RTOS put below it: another task's stack, the heap, a global variable. Writes to line quietly overwrite that memory. The crash, if there is one, comes later and somewhere else, perhaps in a different task whose saved registers just got scribbled on, which makes it miserable to debug.
There are defences, but you have to switch them on. FreeRTOS can check for overflow (configCHECK_FOR_STACK_OVERFLOW) each time a task is switched out, which catches many overflows but not all. An MPU can mark a guard region below each stack, newer Armv8-M cores have stack limit registers, and GCC's -fstack-usage reports how much stack each function needs before you ever flash the chip.
Real-Time Constraints
Many embedded systems live and die by deadlines. An antilock braking system has to read wheel sensors and adjust brake pressure within milliseconds. A cardiac pacemaker delivers electrical pulses with microsecond precision. Miss the deadline and the device hasn't run slowly — it has failed.
Real-time operating systems (RTOS) like FreeRTOS and Zephyr provide scheduling guarantees that general-purpose OSes simply cannot. They rank tasks by urgency and guarantee that high-priority work will preempt lower-priority work within a bounded time.
Examples Everywhere
Embedded systems span an enormous range of complexity:
- Simple: A temperature sensor with an 8-bit AVR running a 500-line C program
- Mid-range: A car's engine control unit (ECU) with an ARM Cortex-R running a certified RTOS
- Complex: A network router with a multi-core MIPS processor running embedded Linux
- Safety-critical: Medical devices, aviation systems, and industrial controllers where software bugs can cause physical harm
The figures in the diagram are typical ranges rather than hard limits, but they give a feel for how far apart the ends of the spectrum sit.
Embedded systems matter for security because so many of them are now online (IoT) and most ship without the protections desktop and server OSes take for granted. Plenty run with no ASLR (Exploit Mitigations), no DEP, and no user authentication of any kind.