What hardware-software co-design means
Hardware-software co-design is the practice of developing an embedded system’s hardware and software together, with each side informing the other, rather than finishing one and then handing it over. The goal is a system where the split of work between circuits and code is deliberate, and where the two halves fit together with as few surprises as possible.
It is one of the central ideas in embedded system design, because in an embedded product neither half is useful alone. The board is inert without firmware, and the firmware is meaningless without the specific board it controls.
Sequential vs concurrent development
In a strictly sequential approach, the hardware team designs and builds a board, and only then does the software team start writing code for it. Problems discovered in software, such as a missing peripheral or a pin that can’t do what’s needed, then require another board spin, which costs time and money.
In a co-design approach, the teams agree on the architecture together, firmware work starts early on development boards or emulators, and hardware decisions are reviewed with firmware needs in mind. Problems surface while they are still cheap to fix.
Hardware vs software: the trade-offs behind every decision
People often ask about the “differences between hardware and software.” For embedded design, the useful differences are the ones that drive trade-offs:
| Aspect | Implemented in hardware | Implemented in software |
|---|---|---|
| Speed and timing | Fast and highly deterministic | Slower; timing depends on code paths, interrupts and scheduling |
| Flexibility | Fixed once built (except FPGAs) | Can be changed and updated in the field |
| Unit cost | Extra components or silicon cost money on every unit | Code adds little per-unit cost if it fits the existing memory |
| Development cost and time | Board spins take weeks and cost money | Changes can be made and tested quickly |
| Power | Dedicated logic can be very efficient for a fixed task | A CPU running code may use more energy for the same task |
| Fixing defects | Usually requires a rework or a new revision | Often fixable with a firmware update |
None of these is absolute. A modern microcontroller’s built-in peripherals are hardware that you configure from software, and that blurring is exactly what co-design exploits.
Hardware-software partitioning
Partitioning is the decision about which functions are implemented in hardware and which in software. It is usually made early, during architecture, and revisited as the design matures.
Criteria for deciding where a function belongs
Questions that help:
- What is the timing requirement? If a signal must be generated or captured with microsecond precision, a hardware timer, PWM unit or capture peripheral is usually more reliable than software toggling a pin.
- How much data flows through it? High-rate data, such as audio samples or a camera stream, often needs DMA or dedicated hardware so the CPU isn’t overwhelmed.
- Is it likely to change? Protocols, business logic and anything regulators or customers might revise belong in software, where they can be updated.
- What does it cost per unit? Adding a dedicated chip may simplify firmware but adds to the bill of materials on every device.
- What does it do to power? Offloading repetitive work to a peripheral lets the CPU sleep, which can matter more than raw speed.
- Is the function safety-relevant? Some designs add an independent hardware path, such as a hardware overcurrent cutoff, so a software fault can’t defeat a safety function.
Partitioning examples
- Motor control. PWM generation, dead-time insertion and fast overcurrent shutdown typically go to hardware peripherals. The control algorithm and fault handling run in software.
- Communication. The physical layer and byte-level timing of UART, SPI or CAN are handled by peripherals. Packet framing, retries and application protocols are software.
- Cryptography. Many MCUs include hardware accelerators for algorithms such as AES or SHA-256. Using them can speed up encryption and reduce energy use compared with a pure software implementation.
- User input. Debouncing a few buttons is usually done in software. Capacitive touch sensing often uses a dedicated peripheral or controller.
FPGAs and SoCs blur the line
Field-programmable gate arrays (FPGAs) let you implement custom hardware logic that can be reconfigured. System-on-chip devices that combine processor cores with programmable logic on one die let teams move functions between code and logic late in the project, or even after shipping. That flexibility comes with added design complexity and toolchain cost, so it tends to appear in demanding applications such as signal processing, vision and high-speed interfaces.
Interfaces: the contract between hardware and firmware
Most integration pain comes from mismatched assumptions at the boundary. Writing those assumptions down, and keeping them current, is one of the most effective co-design practices. Useful shared documents include:
- A pin map listing every MCU pin, its function, direction, pull-up or pull-down, default state at reset and the net it connects to.
- Register maps and device addresses for every chip the firmware talks to over I2C, SPI or similar buses.
- Timing budgets: how long the firmware has to respond to each event, and how fast each bus runs.
- Power sequencing and reset behaviour: which rails come up in which order, and what state pins must be in during boot.
- Memory maps for flash and RAM, including bootloader and update partitions.
Treat these as living documents. A pin quietly reassigned in the schematic, without the firmware team knowing, can cost days of debugging.
Starting firmware before the hardware exists
Firmware work doesn’t have to wait for the custom board:
- Development boards using the same MCU family let you write and test drivers and application logic early.
- Breakout boards for sensors and peripherals let you confirm device behaviour and register settings.
- Emulators and virtual platforms, such as QEMU or Renode, can run firmware for supported processors on a PC, which is useful for automated tests.
- A hardware abstraction layer (HAL) separates application logic from board-specific details, so most code can be tested on a host PC and moved to the real board with limited changes.
Hardware and software integration
Integration is the point where the real board and the real firmware meet. It is often the riskiest phase of a project, because it exposes every unstated assumption.
A practical board bring-up order
Bringing up a new board in a deliberate order makes faults easier to isolate:
- Inspect and power up carefully. Check for shorts between rails and ground before applying power. Use a current-limited bench supply and watch the current draw.
- Verify the power rails. Measure each voltage, and check ripple and sequencing with an oscilloscope if the design requires it.
- Check clocks and reset. Confirm the oscillator or crystal is running and the reset line behaves as expected.
- Connect the debugger. Make sure you can halt the CPU, read registers and program flash through SWD or JTAG.
- Blink an LED and print over a serial port. These two simple tests confirm that code is running and give you a debug channel.
- Bring up peripherals one at a time. Start with the simplest bus device, confirm it responds at the expected address, then move on.
- Run the full application only after the individual pieces work.
Common integration failures
Some problems show up again and again:
- Wrong pin assignment or alternate function, so a peripheral never sees its signal.
- Missing or incorrect pull-up resistors on I2C lines or open-drain signals.
- Power sequencing issues, where a peripheral starts before its supply is stable, or the MCU boots before a sensor is ready.
- Clock configuration errors, which make baud rates and timers wrong in confusing ways.
- Watchdog resets because initialisation takes longer than the watchdog timeout.
- Noise and grounding problems that cause intermittent faults, especially near motors, relays or radios.
- Errata. Silicon sometimes behaves differently from its datasheet; vendors publish errata sheets that are worth reading early.
Hardware-in-the-loop testing
Hardware-in-the-loop (HIL) testing puts the real board in a test rig where a host computer controls its inputs and power and watches its outputs. The rig can simulate sensors, inject faults such as a power cut during a flash write or a burst of bus traffic, and check that the device reacts correctly. Because many integration faults depend on timing and state, HIL tests are valuable for catching problems that only appear occasionally. We cover HIL alongside other methods in testing and validating embedded software.
Team practices that make co-design work
- Hold joint design reviews. Firmware engineers should review schematics, and hardware engineers should understand the firmware architecture.
- Prototype risky parts early. If a design depends on an unfamiliar sensor or a tight timing requirement, test it on a breakout board before committing to a layout.
- Add debug access to the board. Test points, a debug header, a spare UART and an LED or two cost little and save a lot of time.
- Plan for more than one board revision. First boards almost always reveal something.
- Use models where they help. Simulation and model-based design can check control behaviour and partitioning choices before hardware is built.
These practices fit naturally into the broader embedded development life cycle, where integration is one phase among several.
Summary
Hardware-software co-design means treating the board and the firmware as one system from the start. Partitioning decisions should be based on timing, data rates, flexibility, unit cost, power and safety. Clear interface documents prevent most integration surprises, early firmware work on dev boards and emulators keeps the schedule moving, and a methodical bring-up order plus hardware-in-the-loop testing makes integration far less painful.