An embedded system is a computer built into a larger product to do one job, or a small set of jobs. A thermostat, a washing machine controller, a car’s anti-lock braking module and a fitness tracker all qualify. The computer usually isn’t visible. It sits on a circuit board inside the product, reading inputs, making decisions and driving outputs.
Embedded system architecture is the way that computer is organized. It covers which hardware blocks are on the board, how they connect, and how the software is layered on top. This guide covers both halves: the physical parts of an embedded system, then the software components and the main architecture patterns used to structure firmware.
What embedded system architecture means
People use “architecture” for two related things:
- Hardware architecture: the processor, memory, clocks, power circuitry, peripherals and interfaces, and how they’re wired together.
- Software architecture: how the code is divided into layers and modules, and how it decides what runs when. That might be a simple loop, interrupts, a scheduler or a full operating system.
The two are tightly coupled. A chip with 2 KB of RAM rules out a full operating system. A product that has to respond to an event within microseconds pushes you toward interrupts, a real-time operating system or dedicated hardware. Good embedded design treats hardware and software as one system rather than two separate projects.
A common way to picture it is as a stack:
| Layer | Examples |
|---|---|
| Application | Control logic, state machines, user interface |
| Middleware | TCP/IP stack, USB stack, file system, Bluetooth stack |
| Operating system / scheduler | Bare-metal loop, FreeRTOS, Zephyr, embedded Linux |
| Drivers, HAL, BSP | GPIO, UART, SPI, I2C, ADC drivers; board configuration |
| Startup code / bootloader | Reset handler, clock setup, memory initialization |
| Hardware | Processor, memory, clocks, power, peripherals, sensors, actuators |
Not every system has every layer. A small 8-bit controller might have only startup code, a few drivers and an application loop. A networked camera might have all six, with a Linux kernel in the middle.
The hardware components of an embedded system
Processor: microcontroller, microprocessor, DSP, FPGA or SoC
The processor executes the firmware. Embedded designs draw on several kinds:
- Microcontroller (MCU): a processor core, flash memory, RAM and peripherals on a single chip. Most small and mid-sized embedded systems use one. Examples include the AVR ATmega328P on the classic Arduino Uno, STM32 parts based on Arm Cortex-M cores, and the RP2040 on the Raspberry Pi Pico.
- Microprocessor (MPU): a more powerful core that usually relies on external RAM and storage. It’s typically used when the design needs an operating system like Linux, a graphical display or heavy networking.
- Digital signal processor (DSP): optimized for maths-heavy work like audio filtering or motor control. Many modern MCUs include DSP instructions.
- FPGA: reconfigurable logic. Used when you need custom hardware behaviour, very high-speed parallel processing or unusual interfaces.
- System on chip (SoC): a chip that combines one or more processor cores with memory controllers, radios, graphics and peripherals. Phones, routers and single-board computers use SoCs.
Choosing the core is one of the biggest architecture decisions. Our comparison of Arm Cortex-M, Cortex-A and Cortex-R cores explains how the three Arm families split this space. Our piece on Harvard vs von Neumann architecture covers how processors connect to their memory.
Memory
Embedded systems generally need two kinds of memory:
- Non-volatile memory keeps its contents with the power off. It holds the program and persistent settings, usually as flash, sometimes with EEPROM or FRAM alongside.
- Volatile memory loses its contents at power-off and is used for working data: variables, the stack and buffers. On microcontrollers this is usually SRAM. Larger systems add external DRAM.
Memory sizes on microcontrollers are small by PC standards, from a few kilobytes to a few megabytes. Our explainer on flash, SRAM and EEPROM in microcontrollers covers what goes where and why.
Clock and reset circuitry
Many component lists skip these, but no processor runs without them.
- Clock source: an internal RC oscillator, an external crystal or a crystal oscillator module. A phase-locked loop (PLL) often multiplies a slower reference up to the core frequency. Crystals give better accuracy, which matters for USB, accurate UART baud rates and timekeeping. A separate low-frequency 32.768 kHz crystal is common for real-time clocks.
- Reset circuitry: holds the processor in reset until the supply voltage is stable, and lets it restart cleanly. Many MCUs include brown-out detection, which resets the chip if the supply sags too low to run reliably.
- Watchdog timer: a hardware timer that resets the system if the software stops checking in. Our article on what a watchdog timer is and how it works covers it in detail.
Power supply and power management
The power section converts whatever the product receives into the voltages the chips need. That might be a battery, USB, a wall adapter or a 12 V or 24 V industrial supply. It typically includes:
- Voltage regulators. Linear regulators (LDOs) are simple and quiet. Switching regulators are more efficient.
- Protection against reverse polarity, overvoltage and electrostatic discharge.
- Battery charging and fuel-gauge circuitry in portable products.
- Power-switching circuitry so sections of the board can be turned off.
On the software side, power management means putting the processor and peripherals into sleep modes whenever possible. In battery-powered devices this often decides battery life more than the hardware does.
Peripherals and I/O
Peripherals are the hardware blocks that let the processor interact with the world without doing everything in software:
- GPIO (general-purpose input/output) pins for reading switches and driving LEDs or logic signals
- ADCs (analog-to-digital converters) for reading analog sensors
- DACs (digital-to-analog converters) for producing analog voltages
- Timers and PWM for precise timing, measuring pulses and controlling motor speed or LED brightness
- DMA controllers that move data between peripherals and memory without tying up the CPU
- Interrupt controllers that let peripherals signal the CPU when something happens
Communication interfaces and buses
Inside the chip, the core, memory and peripherals share one or more internal buses. On the board, the processor talks to other chips and to the outside world over communication interfaces. Common ones include UART, SPI, I2C, CAN, USB and Ethernet, plus wireless radios like Wi-Fi, Bluetooth Low Energy, LoRa or cellular.
Our guide to embedded communication protocols compares the main wired protocols. Our explainer on what a bus is in embedded systems covers address, data and control buses, plus how bus arbitration works.
Sensors, actuators and the user interface
Sensors turn physical quantities like temperature, light, motion and pressure into electrical signals. Actuators do the reverse: they turn electrical commands into motion, light, sound or heat. Between them and the processor sits interface circuitry such as signal conditioning, level shifting and driver stages. See our guide to sensors, actuators and real-world interfacing for how that layer is designed, and our rundown of sensor types commonly used in embedded systems for specific examples.
The user interface can range from nothing at all, to a few buttons and LEDs, to a touchscreen. Some devices skip local controls entirely and expose a web page or phone app instead.
Debug and programming interface
Almost every board needs a way to load firmware and debug it. On Arm Cortex-M parts that’s usually SWD (Serial Wire Debug). Many other processors use JTAG. Some microcontrollers also include a factory bootloader that accepts firmware over UART or USB. A hardware debug probe lets you set breakpoints, step through code and inspect memory on the real hardware. That’s one reason development boards with an on-board debugger are popular for learning.
The software components of an embedded system
Embedded software is often called firmware. That’s especially common when it’s stored in the device’s non-volatile memory and closely tied to the hardware. Some people separate low-level firmware from higher-level embedded software. Our article on embedded system vs embedded software untangles the terms. Either way, the code usually breaks into the layers below.
Startup code and bootloader
When the processor comes out of reset, the first code to run is the startup code. It typically:
- Sets up the stack pointer (on Cortex-M this is loaded from the vector table automatically)
- Copies initialized variables from flash into RAM and zeroes uninitialized ones
- Configures clocks, and sometimes memory controllers
- Calls
main()
Many products also have a bootloader: a small, separate program that runs first and can update the main application, often over UART, USB, CAN or a network. Bootloaders are central to field firmware updates.
Hardware abstraction layer, drivers and BSP
- Device drivers handle a specific peripheral or external chip. Examples are a UART driver, an SPI flash driver or a temperature sensor driver.
- A hardware abstraction layer (HAL) gives a consistent API across a chip family, so higher layers don’t touch registers directly. Chip vendors usually supply one, such as ST’s STM32 HAL or the Espressif ESP-IDF drivers.
- A board support package (BSP) describes a particular board: which pins connect to what, which external chips are fitted, and how clocks are configured.
Separating these layers makes it much easier to move application code to a new board or chip.
Operating system or scheduler
This layer decides what code runs when. Options range from no operating system at all (“bare metal”) to a real-time operating system (RTOS) such as FreeRTOS or Zephyr, up to a general-purpose OS like embedded Linux. The next section compares the patterns.
Middleware
Middleware is reusable software that sits between the OS and the application:
- Network stacks (TCP/IP, MQTT clients, TLS libraries)
- USB device or host stacks
- Bluetooth stacks
- File systems for SD cards or flash (FAT, LittleFS)
- Graphics libraries for displays
- Protocol stacks like Modbus or CANopen
Middleware is often licensed or open source rather than written from scratch.
Application code
This is the code that makes the product that product: the thermostat’s control algorithm, the motor controller’s speed loop, the data logger’s sampling schedule. Well-structured application code talks to the hardware only through the layers below it.
Software architecture patterns for embedded systems
The software architecture of an embedded system is mostly about how work gets scheduled. These are the main patterns, roughly in order of complexity.
Superloop (simple control loop)
The simplest structure is an infinite loop that calls each task in turn:
int main(void) {
hardware_init();
while (1) {
read_sensors();
update_control();
update_outputs();
handle_serial();
}
}
It’s easy to understand and debug, and it’s the default structure of an Arduino sketch (setup() and loop()). The weakness is timing. If one task takes a long time, every other task waits. The response time to any event depends on how long the whole loop takes.
Interrupt-driven (foreground/background)
Here, time-critical events are handled by interrupt service routines (ISRs) triggered by hardware: a byte arriving on a UART, a timer expiring, a pin changing state. The ISRs do the minimum work, such as capturing data or setting a flag. The main loop (the “background”) handles the slower processing.
This gives fast responses to events while keeping the structure fairly simple. It needs care with data shared between ISRs and the main loop. Typical tools are volatile variables, briefly disabling interrupts, or lock-free buffers.
Cooperative scheduler
A cooperative scheduler runs tasks from a list, often at fixed periods. Each task runs to completion or voluntarily gives up control. It’s more organized than a raw superloop and makes timing more predictable. But a task that doesn’t yield promptly can still hold up everything else.
Preemptive RTOS
A real-time operating system can interrupt (preempt) a running task to switch to a higher-priority one, typically on a timer tick or when an event arrives. Each task gets its own stack. The RTOS provides queues, semaphores, mutexes and timers for coordination.
An RTOS makes it easier to structure complex firmware with many concurrent activities, such as networking, a user interface, sensor sampling and logging. The costs are RAM for each task’s stack, more complexity, and new classes of bugs like race conditions, deadlocks and priority inversion.
Embedded Linux and other full operating systems
On more capable processors (typically application-class cores with a memory management unit and external RAM), a full operating system like embedded Linux gives you processes, memory protection, file systems, networking, drivers and a large software ecosystem. It’s common in routers, cameras, gateways, infotainment systems and industrial HMIs. The trade-offs are higher hardware cost and power use, longer boot times, and less predictable timing than a small RTOS unless real-time extensions are used.
Choosing a software architecture
| Pattern | Good fit | Watch out for |
|---|---|---|
| Superloop | Simple devices, few tasks, relaxed timing | Slow tasks delay everything |
| Interrupt-driven | Simple devices that must react quickly to events | Shared-data bugs, long ISRs |
| Cooperative scheduler | Several periodic tasks with predictable run times | A task that doesn’t yield |
| Preemptive RTOS | Many concurrent activities, networking, mixed priorities | RAM use, race conditions, priority inversion |
| Embedded Linux | Rich UIs, complex networking, large software stacks | Cost, power, boot time, timing predictability |
Many real products mix patterns. An RTOS-based design still uses interrupts. A Linux system might hand hard real-time work to a separate microcontroller.
How hardware and software work together: a worked example
Consider a simple smart thermostat:
- Sensing: a digital temperature and humidity sensor on the I2C bus. The I2C driver reads it, and a sensor driver converts raw readings into degrees.
- Processing: a Cortex-M microcontroller runs the control logic, comparing the reading against the setpoint with some hysteresis so the heating doesn’t rapidly cycle on and off.
- Actuation: a GPIO pin drives a transistor that switches a relay to turn the heating on or off.
- User interface: a small display on SPI and two buttons on GPIO pins, with interrupts for button presses and software debouncing.
- Connectivity: a Wi-Fi module or on-chip radio, with a TCP/IP stack and MQTT client as middleware.
- Timing: an RTOS runs separate tasks for sensing, control, display and networking. A watchdog resets the system if any of them hangs.
- Memory: firmware lives in flash, the setpoint and Wi-Fi credentials go in a reserved flash area or EEPROM, and buffers and task stacks use SRAM.
- Power: a regulator supplies the logic rails, and the processor sleeps between sensor readings.
Every hardware block on the board has a matching piece of software, and the architecture defines how they connect.
The embedded system design process
Most embedded projects follow a similar arc, though teams iterate between steps:
- Requirements: what the product must do, its timing limits, power budget, cost target, operating environment and any safety or regulatory requirements.
- Hardware/software partitioning: decide which functions go in dedicated hardware and which in software. Faster or more deterministic behaviour may justify hardware. Flexibility and updatability favour software.
- Component selection: processor, memory, sensors, communication interfaces and power architecture.
- Prototyping: often on development boards and breakout modules before a custom PCB exists.
- Firmware development: drivers, then middleware integration, then application logic.
- Integration and testing: on real hardware, including edge cases like power loss, brown-outs and communication errors.
- Production and maintenance: manufacturing test, firmware programming in the factory, and a plan for updates in the field.
Key design constraints and trade-offs
Embedded architecture decisions usually balance:
- Cost: in high-volume products, small per-unit savings add up, so designers often pick the smallest part that does the job.
- Power: battery life can dominate every other decision.
- Real-time behaviour: whether deadlines are hard (missing one is a failure) or soft (occasional lateness is tolerable).
- Reliability: many embedded systems run unattended for years, so watchdogs, brown-out detection and careful error handling matter.
- Safety: automotive, medical and industrial systems may need to follow functional safety standards and coding guidelines such as MISRA C.
- Security: connected devices need secure boot, authenticated updates and protected credentials.
- Size, heat and environment: board area, enclosure, temperature range, vibration and electrical noise.
Types of embedded systems
Introductory courses often classify embedded systems in two ways.
By function:
- Standalone: works on its own without a host computer, such as a microwave oven controller or digital watch.
- Real-time: must respond within defined time limits. Usually split into hard real-time (a missed deadline counts as failure, as in airbag control) and soft real-time (occasional delays reduce quality but aren’t catastrophic, as in media playback).
- Networked: connected to other systems over a wired or wireless network, such as IoT sensors, IP cameras or building controllers.
- Mobile: portable and battery-powered, such as fitness trackers or handheld instruments.
By scale: small-scale systems (8- or 16-bit MCUs with minimal resources), medium-scale (16- or 32-bit MCUs, often with an RTOS) and sophisticated systems (multiple processors or SoCs running full operating systems).
These categories overlap. A smartwatch is mobile, networked and has real-time parts.
Common questions
Is embedded programming done in C or C++? Both. C has long been the most widely used language for firmware because it’s small, predictable and close to the hardware. C++ is increasingly common, especially in larger codebases, often with features like exceptions and dynamic allocation limited or disabled. Rust is gaining interest for its memory-safety guarantees. MicroPython and CircuitPython are popular for prototyping and education on capable microcontrollers. Assembly is still used for small, timing-critical sections and startup code.
What are the typical hardware components of an embedded system? A processor, non-volatile and volatile memory, a clock source, reset and power circuitry, peripherals (GPIO, timers, ADC), communication interfaces, sensors and actuators, and a debug/programming interface.
What are examples of devices running embedded software? Home appliances, thermostats, routers, printers, cars (engine control, braking, infotainment), medical monitors, industrial controllers, drones, wearables, and the controllers inside SSDs and keyboards.
Where to go next
This guide is the hub for our embedded architecture articles. Good next steps: