Summary
Embedded firmware development — the full lifecycle from architecture and coding to testing, flashing, and production programming.
A board without firmware is just powered copper. The sensors may be wired right, the power rails may be clean, and the PCB may pass inspection, but nothing useful happens until the embedded firmware brings the hardware to life. Good embedded firmware development isn’t just writing C until an LED blinks. It’s the work of turning a schematic into timing, interrupts, drivers, fault handling, production test hooks, and a field-update path that still works five years later.
For hardware teams, firmware is where many board problems first become visible. A noisy ADC channel. A motor driver that trips on startup. A UART that drops bytes only at high temperature. The firmware engineer sees those failures first, but the root cause may sit in the layout, the component choice, or the timing budget. That’s why firmware and hardware should be developed together, not passed over a wall at the end.
What Embedded Firmware Has to Do
Firmware sits between the physical board and the product behavior. On a typical MCU board it handles:
- Startup — clock tree, memory setup, watchdog, peripheral reset, boot mode selection.
- Drivers — GPIO, UART, SPI, I2C, CAN, USB, ADC, PWM, timers, DMA.
- Control logic — motor loops, sensor sampling, state machines, safety interlocks.
- Communication — Modbus, CANopen, BLE, Ethernet, custom packet protocols.
- Storage — calibration data, counters, logs, serial numbers, settings.
- Fault handling — brownout, overcurrent, watchdog reset, sensor open/short, communication timeout.
- Update path — bootloader, rollback, image check, secure update where needed.
The important point: firmware is not an afterthought. If the board has no test points, no boot pin access, no debug header, and no stable reset circuit, firmware development slows down before the first driver is written.
Bare Metal vs RTOS
Most MCU firmware falls into two styles. Both are valid. Pick based on timing and complexity, not fashion.
| Approach | Best fit | Watch out for |
| Bare metal | Simple products, tight loops, low cost MCUs | State machines can become tangled as features grow |
| RTOS | Many tasks, communications, UI, logging, control loops | Priority bugs, stack sizing, race conditions |
| Hybrid | Hard real-time loop plus RTOS for background work | Needs a clean boundary between ISR, control loop, and tasks |
Bare metal is often enough for a small sensor, a relay controller, or a simple power supply. An RTOS starts making sense when the firmware has several things happening at once: a control loop, a communication stack, data logging, a display, and a firmware update task. FreeRTOS is the common choice on Cortex-M parts, but the same rule applies to any RTOS: if task timing isn’t designed, the scheduler won’t save you.
The Development Flow
1. Bring-up plan before boards arrive
Before the prototype shows up, the firmware team should already know the bring-up order. Power rails first. Clock and reset next. Debug attach. GPIO sanity. Then one peripheral at a time. This avoids the classic mistake: trying to run the whole application on day one and not knowing which layer failed.
2. Board support package
The BSP maps the schematic into code: pin names, clock settings, ADC channels, SPI chip selects, timer outputs, interrupt lines. Good BSP naming follows the board function, not the MCU pin name. Use MOTOR_PWM_U, not PA8, everywhere above the pin map.
3. Driver layer
Each device gets a small driver with a clear API. Sensor read. Flash write. CAN send. Motor enable. Keep protocol details inside the driver. The application should not know which SPI register wakes up the accelerometer.
4. Application state machine
Most embedded products are state machines. Idle. Self-test. Run. Fault. Update. Sleep. Write the states down first, including allowed transitions. Many firmware bugs are really missing state transitions.
5. Test hooks and logs
Production needs a way to test the board. Field support needs a way to know why it failed. Add test commands, reset-cause logging, firmware version strings, and fault counters early. Adding them after a product ships is painful.
Hardware Features Firmware Needs
If firmware engineers could add five things to every board, they would pick these:
- Debug access — SWD or JTAG pads, with reset and ground nearby.
- Bootloader entry — a reachable boot pin, button combo, jumper, or software command.
- Stable reset and brownout — no half-boot state when power ramps slowly.
- Test points — UART logs, key power rails, critical interrupts, programming lines.
- Nonvolatile storage plan — where serial number, calibration, and counters live, and how writes are wear-leveled.
These cost almost nothing during layout. They cost weeks when missing.
Firmware bring-up is fastest when the board was designed to be talked to. Hide the debug port, bury the boot pin, and skip test points, and every bug becomes a guessing game.
A Bring-Up That Got Stuck for a Week
A customer had a battery-powered controller that would boot on the bench but fail after a cold start in the enclosure. The team suspected firmware. They rewrote the startup sequence twice. Nothing changed.
The real issue was hardware timing. The MCU came out of reset before the 3.3 V sensor rail was stable. Firmware tried to initialize the sensor over I2C, got no response, and entered a permanent fault state. On the bench the rail came up faster because the supply was cleaner. In the enclosure it lagged by 40 ms.
The fix was simple: enable brownout reset correctly, add a rail-good check before sensor init, and let the firmware retry the sensor for 200 ms before declaring a fault. The next build also added a proper power-good signal. The lesson was simple too: not every firmware bug is in firmware, but firmware needs to be written to survive real hardware timing.
Testing Firmware Properly
Testing has layers:
- Unit tests for logic that does not touch hardware: protocol parsers, CRC, state transitions.
- Hardware-in-loop tests for real peripherals, timing, and fault injection.
- Production tests that verify each assembled board: programming, serial number, rails, sensors, outputs, communication.
- Regression tests before every release so a fixed bug does not come back.
For safety or medical products, this becomes formal. IEC 62304, ISO 26262, or IEC 61508 may apply. Even when no standard is required, the habit is the same: know what version is on the unit, know what was tested, and keep the release reproducible.
Related Reading
- Firmware Reverse Engineering
- Microcontroller Firmware Extraction
- Chip Programming and IC Burning
- Schematic to PCB Layout Workflow
- PCB Design Best Practices
Frequently Asked Questions
When should firmware development start?
Before the PCB is finished. Firmware needs debug access, boot pins, test points, timing information, and a storage plan. Those decisions belong in schematic and layout review, not after the board arrives.
Should I use an RTOS?
Use one when the product has multiple tasks with real timing needs: communication, logging, UI, control loops, and updates. For a simple sensor or relay board, bare metal may be cleaner and safer.
What makes firmware production-ready?
A stable boot path, watchdog handling, reset-cause logging, test hooks, version tracking, update strategy, and a repeatable programming process with verification.
Can firmware fix hardware mistakes?
Sometimes. Firmware can add retries, filters, delays, and calibration. It cannot fix a missing connection, a bad power path, or a layout that violates signal integrity.
Need Firmware Built Around Your Board?
Send us the schematic, MCU part number, and product behavior you need. We can help with bring-up, drivers, bootloaders, production test hooks, and long-term maintenance. See our embedded firmware development service or contact us to scope the work.
References
- Embedded system reference: https://en.wikipedia.org/wiki/Embedded_system
- FreeRTOS documentation: https://www.freertos.org/Documentation/RTOS_book.html
- IEC 62304 reference: https://en.wikipedia.org/wiki/IEC_62304
- Serial Wire Debug reference: https://en.wikipedia.org/wiki/Serial_Wire_Debug


