Menu

RTOS vs Bare Metal

RTOS vs Bare Metal: The Architecture Decision That Outlives the Prototype

Notes · FirmwareNovember 19, 202616 min readSenova Systems Research

A super-loop runs the jobs one after another, so one long job delays every other, and the moment a blocking operation can stall the one task that must run every millisecond, the loop is no longer a schedule. It is a hope. Use an RTOS when you have 3+ independent concurrent activities with different timing requirements; stick with bare metal for simple, single-purpose devices. On the Example Labs hub, control loop at 1 kHz, BLE every 7.5 ms, the on-device model once a second, the OTA flash writes, the super-loop leaves the control loop 2.6x late, 40.6x late when the model runs, at 385 samples a second instead of 1,000. The RTOS costs ~9 kB of flash and 0.03% of the CPU, and the control loop is never late.

First, a simple picture

One cook, one kitchen, four orders.

A cook works alone in a kitchen. Four orders come in at once: a steak that must be flipped every minute or it burns, a soup that must be stirred every few seconds, a cake that takes forty minutes in the oven, and a delivery that must be packed when the courier arrives. The cook can do only one thing at a time.

If the cook starts the cake and waits forty minutes by the oven, the steak burns. If the cook flips the steak every minute and never starts the cake, the cake never arrives. The cook's problem is not speed.

The cook's problem is that one person can only do one thing at a time, and the orders have different clocks.

A bare-metal super-loop is the cook working alone, in order: steak, soup, cake, delivery, steak, soup, cake, delivery. An RTOS is a head chef who interrupts: the steak is flipped every minute no matter what else is happening, the soup is stirred when its timer goes off, the cake bakes in the oven while the chef does other things, and the delivery is packed when the courier arrives. The head chef does not cook faster. The head chef makes sure the steak never burns, and the steak is the deadline.

What "real-time" actually means, and what it does not

Real-time is a promise about when, not how fast. Real-time means deterministic: the worst-case time between an event and the system's response is bounded, known, and can be written into a specification. A system that answers in 1 millisecond, every time, is real-time. A system that answers in 1 microsecond on average but sometimes takes 100 milliseconds is not, because the worst case is what the specification must survive. The starting point for understanding an RTOS is to distinguish "fast" from "predictable." A general-purpose operating system pursues statistical performance, average latency, throughput. An RTOS is designed and validated against a bounded latency and a worst-case execution time (WCET), the longest a task can possibly take, measured or proven, not the average.

The classification of real-time systems is based on the consequences of missing a deadline, not on how fast the system responds:

  • Hard real-time: missing even a single deadline may lead to complete or catastrophic system failure. Airbag controllers, aircraft flight control, reactor control. The system is considered incorrect if even one deadline is missed, and 100% deadline compliance must be mathematically proven, schedulability analysis, using techniques like Rate Monotonic Analysis or Earliest Deadline First utilisation bounds.
  • Firm real-time: missing a deadline makes the result useless, the value drops instantly to zero, but the overall system does not fail catastrophically. Industrial vision inspection, real-time trade execution.
  • Soft real-time: missing a deadline degrades quality but the result still has diminishing value, and the system continues. Video streaming, VoIP, "99.9% of frames must be delivered within 33 ms" rather than "every single frame must be delivered within 33 ms without exception."

And the scheduling theory behind the guarantee is old and exact: Rate Monotonic scheduling assigns fixed high priority to tasks with short periods, the task that runs most often gets the highest priority, and a set of n periodic tasks is schedulable if the total CPU utilisation satisfies U = Σ(Ci/Ti) ≤ n(2^(1/n) − 1), which tends to about 69.3% as n grows. Earliest Deadline First can achieve 100% CPU utilisation, but collapses catastrophically on overrun.

The demo below runs the Rate Monotonic test on the hub's four jobs, and passes it with room to spare.

The super-loop, and the moment it stops being a schedule

Bare-metal firmware runs directly on the hardware with no operating system layer. The typical structure is a super-loop, an infinite while(1) loop in main() that polls for work and calls handler functions, combined with interrupt service routines (ISRs) that respond to hardware events asynchronously. The jobs run sequentially: job 1, job 2, job 3, back to job 1. The loop is the schedule, and the schedule is the order the jobs are written in.

A super-loop with interrupt service routines is not a primitive design. It is the correct design for a large class of products, and it has properties an RTOS cannot match. It is trivially analyzable: one execution path, no preemption, no shared state between concurrent tasks, so the class of bug an RTOS introduces, race conditions, deadlocks, priority inversion (a low-priority task blocking a high-priority one indefinitely), stack overflow per task, simply cannot occur.

It is the smallest: no kernel, no per-task stacks, no scheduler tick. On a part with single-digit kilobytes of RAM, an RTOS may not even fit. And time-critical hardware responses still belong in ISRs at interrupt priority, whether you use an RTOS or not, an RTOS does not replace the interrupt.

The loop stops being a schedule at one precise moment: the moment a blocking operation can stall the one task that must run every millisecond. A TLS handshake, a flash erase, a USB enumeration, something else takes an unpredictable amount of time, and the loop is no longer a schedule. It is a hope.

An RTOS is what you reach for when hope is not an acceptable timing guarantee. And bare metal is not simpler, it transfers the coordination burden from a kernel to the developer, and the burden compounds as the product grows: a second sensor, a network stack, a display, and without a scheduler the loop becomes a tangle of state machines and timing dependencies that is hard to change safely.

The same four jobs (control loop, BLE, model, OTA write) under two runtimes

Super-loopRTOS
How jobs runOne after anotherThe most important ready task runs first
Cycle2.6 ms typical, 40.6 ms worstControl loop every 1 ms, never late
EffectControl loop 2.6× late; 40.6× when the model runsOTA finishes in 5.2 s; the deadline holds

What an RTOS actually is

An RTOS (Real-Time Operating System) is an operating system designed to honor a timing constraint, responding within a defined deadline without fail. Its core value is not "how fast" but "can we predict when it will finish." An RTOS delivers determinism with two ingredients and almost nothing else: a preemptive priority scheduler, and a set of synchronisation and communication primitives, tasks, queues, semaphores, timers, mutexes.

Everything marketed on top, networking, file systems, device drivers, is convenience, not the core. The core is the promise that the most important ready task is the running task, always.

Preemptive priority scheduling means the scheduler always runs, immediately, the highest-priority task among those in the ready state, and when a higher-priority task wakes up, it immediately preempts the running task. A task is an independent unit of execution, each with its own stack and a priority, blocked when it has nothing to do. A queue passes data between tasks without either task knowing the other's timing. A semaphore signals that an event happened. A mutex protects a shared resource, and the priority inheritance and priority ceiling protocols bound priority inversion, so a low-priority task holding a mutex cannot block a high-priority one indefinitely. Learn these six and you understand 90% of every RTOS you will ever touch, the names change, the concepts do not.

The two kernels that matter for this article are FreeRTOS and Zephyr, and they are different kinds of thing. FreeRTOS is a real-time kernel maintained by Amazon since 2017 under an MIT licence, the most-deployed RTOS in the world, and the natural entry point for most real-time embedded projects. It is the kernel only: tasks, queues, semaphores, timers, a minimalist scheduler, no drivers, no networking built in.

Its footprint is small: a minimal scheduler is around 9 kB of flash and 2 kB of RAM on a Cortex-M4, and the kernel is 6 to 15 kB of ROM depending on configuration, with less than 1 kB of RAM per task and interrupt latency under 1 µs on a Cortex-M4 at 80 MHz. It runs on 40+ architectures, Cortex-M, Cortex-R, RISC-V, AVR, PIC, Xtensa. And it dominates the RTOS landscape: among engineers who use an RTOS, 82% use FreeRTOS (JetBrains, State of Embedded Development 2025), against 14% for Zephyr, though only 18% of embedded developers overall use FreeRTOS at all, against 21% on bare metal and 58% on Linux-based systems, so the honest statement is that FreeRTOS is the most-deployed RTOS, not that it is on 40% of all embedded devices.

(The pipeline file's "40%+" figure could not be verified in any source checked and is NOT used here; the verified figures are the ones in this paragraph.)

Zephyr is a Linux Foundation open-source RTOS for resource-constrained devices, and it is the full system, not just the kernel: a unified driver model for SPI, I²C, UART, ADC, PWM, GPIO, sensors, and displays, one set of driver APIs covering all platforms, so changing the SoC means modifying the device-tree overlay, not the application code, plus native BLE 5.4, Thread, Matter, and LoRaWAN stacks, built in rather than bolted on, and a modular microkernel whose footprint scales down to under 8 to 10 kB of RAM and ROM on memory-constrained Cortex-M0+ parts. Nordic Semiconductor's official SDK (nRF Connect SDK) is built entirely on Zephyr, and Texas Instruments now contributes drivers upstream to the Zephyr Project, the upstream-first model, where the code is reviewed by the community and tested in continuous integration before any vendor packages it. The price is size: a kernel-only Zephyr image lands near 18 kB flash and 4 kB RAM against FreeRTOS's ~9 kB and ~2 kB, and with BLE, MQTT, TLS, and OTA added, the gap narrows to ~220 kB / ~48 kB against ~195 kB / ~44 kB, a difference of 15–25 kB of flash and 4–6 kB of RAM. The lesson is the one the comparison guides state plainly: stop comparing kernels. Compare the full system image for your actual feature set.

The decision: a count, and a question about blocking

The choice is a count of independent jobs, and what happens when one blocks

JobsUseExample
1 or 2, one timer, under 16 kB RAMBare metalA temperature logger: wake, read, write, sleep
3 or more, different timing, one blocksRTOS (the worked example's hub sits here)Control loop, radio, model and OTA
Wireless stack, blocking work, several developersRTOSA BLE device reading sensors, holding a cloud link, logging

Rule of thumb: use an RTOS when you have 3+ independent concurrent activities with different timing requirements. Stick with bare metal for simple, single-purpose devices. The rule is stated the same way in guide after guide, because it is the shape of the problem: at three activities the manual coordination becomes complex and fragile, and the kernel is cheaper than the developer's time spent holding the coordination in their head.

Bare metal is the right choice when there are one or two main activities (a super-loop handles them cleanly without scheduling overhead), when the MCU is very small (under 16 kB RAM), when all timing is driven by a single timer or interrupt, and when the timing is sub-microsecond, motor control loops, high-speed ADC sampling, precision timing, where the RTOS context switch itself becomes a liability. A battery-powered temperature logger that wakes on a timer, reads a sensor, writes to flash, and sleeps again is a textbook bare-metal application: it does exactly one thing in a predictable sequence.

An RTOS is the right choice when there are three or more independent activities with different timing, when activities block, waiting for a network, a flash write, a UI input, because RTOS blocking is efficient and polling wastes CPU and complicates timing, when there is a wireless protocol stack (BLE, Wi-Fi), most BLE and Wi-Fi stacks are RTOS-native and assume task-based concurrency, and when multiple developers work on one firmware codebase, because RTOS tasks partition ownership cleanly.

A BLE-connected device reading three sensors, maintaining a cloud connection, processing user commands, and logging data to flash simultaneously is a strong RTOS candidate. And the middle option exists and is underrated: a simple cooperative scheduler, no preemption, gives you task organisation without the complexity of a full RTOS, for the product that has outgrown the loop but does not yet need preemption.

Example Labs is a made-up company we use for worked examples.

Four jobs, one CPU: Example Labs' hub, two ways

This product is made up. Call it the Example Labs field sensor hub again: the fence-post unit from Articles #6, #7, #9, #11, and #12, the weather sensor, the event camera, the battery, the enclosure, the radio, now choosing its firmware architecture. The hub has four jobs, each with its own clock, and the demo's arithmetic is the article's own, verified before writing, on the published figures cited above; the hub and its jobs are the worked example, not a measured product.

The four jobs:

  1. The control loop (Article #3), the PID loop, running at 1 kHz, one run every 1 ms, taking 0.1 ms of work per run. Its deadline is hard in the practical sense: miss it and the estimate goes stale, and the loop's output is wrong. CPU: 10%.
  2. The BLE radio (Article #12), a connection event every 7.5 ms (the Bluetooth minimum connection interval), taking 0.5 ms of work per event. CPU: 6.7%.
  3. The on-device model (Article #9), the visual wake-words model, 38 ms of work, running once a second (the CLRO paper's measured 38 ms latency). CPU: 3.8%.
  4. The OTA download (Article #11), the 512 kB firmware image, written in 256-byte chunks, each chunk costing 2 ms of CPU while the flash is being written. That is 2,048 chunks × 2 ms = 4.1 seconds of CPU, and the flash write is a blocking operation: while it runs, nothing else runs.

Step 1, The super-loop. The jobs run one after another: control loop, BLE, OTA chunk, control loop, BLE, OTA chunk, and once a second, the model. A typical cycle is 0.1 + 0.5 + 2.0 = 2.6 ms, so the control loop, which must run every 1 ms, runs every 2.6 ms: 2.6× late, at 385 samples a second instead of 1,000. And once a second, when the model runs, the cycle is 0.1 + 0.5 + 38 + 2.0 = 40.6 ms, the control loop is 40.6× late, and for the whole 5.3 seconds the download takes, the loop never once meets its deadline. The loop is not a schedule. It is a hope, and the hope fails for the entire download.

Step 2, The RTOS. The control loop is the highest-priority task, so it preempts everything: it runs every 1 ms, takes 0.1 ms, and returns. The BLE task preempts the OTA task at its 7.5 ms interval. The model runs once a second in the gaps. The OTA task runs in whatever CPU is left, and the CPU is not the constraint: control 10% + BLE 6.7% + model 3.8% = 20.5%, so the OTA task gets 79.5% of the CPU, and the 4.1 seconds of CPU work finishes in 5.2 seconds of wall time, against 5.3 seconds in the super-loop. The download takes the same time. The control loop is never late. And the Rate Monotonic test agrees: for four tasks the schedulability bound is 75.7%, and the hub's three periodic jobs use 20.5%, under the bound with room to spare. The RTOS does not make the work faster. It makes the deadline hold.

Step 3, What the RTOS costs on this chip. The hub runs on an STM32H7, 512 kB SRAM, 2 MB flash, 480 MHz (Article #9's CLRO paper). The FreeRTOS kernel is ~9 kB of flash, 0.4% of the 2 MB, and ~2 kB of RAM plus three task stacks at under 1 kB each, ~5 kB total, 1.0% of the 512 kB SRAM. The context switch, under 300 ns on a Cortex-M4 at 80 MHz, per the comparison guide, at 1,000 preemptions a second costs 300 µs per second, 0.03% of the CPU. The kernel is nearly free on this chip. The deadline is not. (On a part with single-digit kilobytes of RAM, the arithmetic reverses, and that is why the decision test asks about the MCU first.)

What an RTOS costs on the worked example's STM32H7 (512 kB SRAM, 2 MB flash, 480 MHz), and what the super-loop costs instead

CostShare of the chip
FreeRTOS kernelAbout 9 kB flash0.4% of flash
Kernel RAM and three stacksAbout 5 kB1.0% of SRAM
Context switchesUnder 300 ns each; 1,000 a second0.03% of the CPU
Super-loop insteadControl loop 2.6× late (40.6× when the model runs)385 samples a second instead of 1,000

The decision test

Four questions. They sort the products that need an RTOS from the ones that do not:

  1. How many independent activities, and do they have different timing requirements? One or two, with simple timing: bare metal. Three or more, with different clocks: RTOS. The hub has four, and it sits exactly on the rule's threshold.
  2. Does anything block, a TLS handshake, a flash erase, a USB enumeration, while another job has a deadline? No: the loop is a schedule. Yes: the loop is a hope, and the RTOS is what you reach for when hope is not an acceptable timing guarantee.
  3. Is there a wireless stack, BLE, Wi-Fi, or a network stack that assumes task-based concurrency? No: the loop is free to stay a loop. Yes: the stack is RTOS-native, and fighting that assumption creates more bugs than it solves.
  4. What is the MCU, and what is the cost of the kernel on it? Single-digit kilobytes of RAM: the RTOS may not fit, and bare metal is the answer. Hundreds of kilobytes: the kernel is ~1% of the memory and 0.03% of the CPU, and the deadline is the expensive thing, not the kernel.

If the answers are three or more jobs, something blocks, there is a radio stack, and the MCU has room, the RTOS is the answer, and the choice between FreeRTOS and Zephyr is the next question: FreeRTOS for the smallest kernel and the AWS path, Zephyr for the upstream driver model and the native BLE/Thread/Matter stacks. If the answers are one job, nothing blocks, no stack, and a tiny MCU, bare metal is the answer, and the RTOS would buy concurrency bugs in exchange for nothing.

And if the answer to question 1 is "we don't know yet", the problem is not the kernel. The problem is that the product's jobs were not listed before the architecture was chosen, and the review starts by listing them.

"But an RTOS is too complex for our team", and two more fair doubts

"But an RTOS is too complex for our team." It adds complexity, and the complexity it adds is the kind you can learn once and reuse forever: tasks, queues, semaphores, mutexes, six concepts that do not change between kernels. The complexity it replaces is the kind that grows every time the product grows: a tangle of state machines and timing dependencies that is hard to change safely, held in one developer's head, and lost when they leave. The RTOS is not simpler than the loop. It is simpler than the loop after the third job arrives, and the third job always arrives.

"But the RTOS will eat our battery." The kernel's tick is a cost, and the RTOS's sleep is the saving: a task that has nothing to do blocks, and the CPU sleeps until the next event, instead of polling in a loop. The demo's numbers are the answer: the context switch costs 0.03% of the CPU, the kernel costs 1% of the SRAM, and the control loop's 10% is the same either way. The battery budget from Article #6 does not change when the RTOS arrives, because the RTOS does not add work, it orders the work that was already there.

"But we already have a super-loop that works." It works, and the question is whether it works under the next feature, not the current one. The wrong architecture after the hardware is built and a roadmap committed is expensive: the firmware has to be rewritten around a scheduler, the timing re-proven, the tests re-run, and the product's roadmap stalls while the rewrite happens. A working super-loop is the right answer until the third job arrives. The review is the moment to ask whether the third job is already on the roadmap, because if it is, the architecture decision is already overdue, and the prototype is the cheapest place to make it.

Sources

  1. Wasil Zafar, "Embedded Systems Series Part 3: RTOS Fundamentals (FreeRTOS/Zephyr)"
    What we used

    Bare-metal super-loop runs tasks sequentially, RTOS enables concurrent execution with preemptive scheduling; "Rule of Thumb: Use RTOS when you have 3+ independent concurrent activities with different timing requirements. Stick with bare-metal for simple, single-purpose devices."

  2. ElectronicsDesign.au, "Bare-Metal vs RTOS: Choosing the Right Firmware Approach"
    What we used

    The choice is a firmware architecture decision, not a capability question; bare metal is right for one or two main activities, a very small MCU (<16 kB RAM), and timing driven by a single timer or interrupt; RTOS is right for 3+ independent activities with different timing, activities that block, wireless protocol stacks (most BLE/Wi-Fi stacks are RTOS-native), and multiple developers; "Don't add an RTOS pre-emptively: start with bare-metal and add an RTOS when you encounter a specific concurrency problem that's genuinely hard to solve without one"; ISRs remain outside the RTOS

  3. Crab Labs, "RTOS vs Bare Metal: A Decision Framework"
    What we used

    Hard real-time with tight margins (sub-microsecond determinism, motor control loops, high-speed ADC sampling) is often better served by bare metal; RTOS wins at 3+ independent tasks, complex communication stacks (TCP/IP, BLE, USB), team development, and soft real-time requirements; a bare-metal cooperative scheduler is an underrated middle option

  4. Yunus Kurt, "Do you need an RTOS?"
    What we used

    "Real-time means deterministic: the worst-case time between an event and the system's response is bounded, known, and can be written into a specification"; the Cortex-M with a small RTOS can be real-time because its scheduler guarantees the highest-priority ready task runs within a known number of microseconds, every time; an RTOS delivers determinism with two ingredients, a preemptive priority scheduler and synchronisation/communication primitives; "The moment a blocking operation, a TLS handshake, a flash erase, a USB enumeration, can stall the one task that must run every millisecond, the loop is no longer a schedule. It is a hope"; a super-loop with ISRs is trivially analyzable (no race conditions, deadlocks, priority inversion, stack overflow per task) and the smallest (no kernel, no per-task stacks, no scheduler tick)

  5. Aavico, "Bare Metal, RTOS or Embedded Linux: Choosing a Software Foundation"
    What we used

    A product that starts as a simple loop tends to grow (a second sensor, a network stack, a display) and without a scheduler the loop becomes a tangle of state machines and timing dependencies that is hard to change safely; stay on bare metal for one or two things with simple timing, move to an RTOS when several activities must run concurrently with different deadlines or a network/wireless stack is involved

  6. AES Techno, "Zephyr vs FreeRTOS vs real-time Linux: RTOS comparison (2026)"
    What we used

    FreeRTOS ~9 kB kernel maintained by Amazon since 2017, context switch under 300 ns on Cortex-M4 at 80 MHz, 6–15 kB ROM footprint, sub-microsecond ISR latency, 40+ architectures, MIT licence, the most-deployed RTOS in the world; Zephyr ships native BLE 5.4, Thread, Matter, and LoRaWAN, 500+ boards, IEC 61508 safety-certification effort in progress; Linux PREEMPT_RT targets 30–100 µs but demands 50–200 MB RAM

  7. Hubble, "Zephyr vs FreeRTOS for IoT in 2026"
    What we used

    FreeRTOS minimal scheduler around 9 kB flash and 2 kB RAM on Cortex-M4 with GCC 13 at -Os; Zephyr kernel-only near 18 kB flash and 4 kB RAM under the same conditions; with BLE + MQTT + TLS + OTA on nRF52840-DK, FreeRTOS ~195 kB / ~44 kB against Zephyr ~220 kB / ~48 kB, "stop comparing kernels. Compare the full system image for your actual feature set."

  8. JetBrains, "The State of Embedded Development 2025"
    What we used

    Linux-based operating systems 58%, Windows 22%, bare-metal systems 21%, FreeRTOS 18%, other RTOS 7%; among RTOS users, FreeRTOS dominates at 82%, Zephyr 14%, VxWorks 4%

  9. Eclipse Foundation, "2024 IoT & Embedded Developer Survey" (via C-Double)
    What we used

    Operating-system use led by Linux 46%, FreeRTOS 29%, Zephyr 21%, ThreadX 13% (reported use, not market shares)

  10. Inovasense, "Zephyr RTOS, Glossary"
    What we used

    Linux Foundation open-source RTOS; built-in networking (BLE 5.3-compliant host and controller, Thread/OpenThread up to 1.4, Wi-Fi, LoRaWAN, LwM2M, CoAP, MQTT, TCP/IP); unified driver model for SPI, I²C, UART, ADC, PWM, GPIO, sensors, displays; Nordic's nRF Connect SDK built entirely on Zephyr; FreeRTOS is kernel-only (no drivers, no networking built-in), BLE via external NimBLE or vendor SDK

  11. Forlinx, "Zephyr RTOS on NXP i.MX93"
    What we used

    Zephyr v4.x, 700+ development boards, ARM/ARM64/RISC-V/ARC/Xtensa/x86; a driver developed once can be reused across multiple chip vendors; protocol stacks like Bluetooth, Wi-Fi, and Matter are plug-and-play and isolated from hardware

  12. TI / Electronics-USA, "TI expands Zephyr RTOS support"
    What we used

    Upstream-first, production-ready runtime; Zephyr's modular microkernel scales down to under 8–10 kB RAM and ROM on Cortex-M0+; FreeRTOS lacks an integrated device driver model, native multi-protocol wireless stacks, and centralised hardware abstraction

  13. CopyProgramming, "Hard Real-Time vs. Soft Real-Time Systems"
    What we used

    Hard real-time: missing a deadline constitutes system failure, potentially causing loss of life or equipment damage; soft real-time tolerates occasional deadline misses with degraded performance; firm real-time: the result loses value once the deadline passes; preemptive multitasking, higher-priority tasks immediately interrupt lower-priority ones

  14. Nerdyelectronics, "Real-Time Systems Explained: Hard, Soft, and Firm"
    What we used

    Definitions follow Laplante & Ovaska, *Real-Time Systems Design and Analysis*, 4th ed. (IEEE Press/Wiley, 2012): hard real-time, failure to meet even a single deadline may lead to complete or catastrophic system failure; soft, performance is degraded but not destroyed; firm, a few missed deadlines will not lead to total failure, but missing more than a few may; Rate Monotonic schedulability bound U = Σ(Ci/Ti) ≤ n(2^(1/n) − 1); EDF can achieve 100% CPU utilisation but collapses on overrun

  15. CosmicLearn, "What is an RTOS? Hard vs Soft Real-Time"
    What we used

    Priority-based preemption: the highest-priority task that is ready to run will immediately preempt lower-priority tasks, regardless of how long lower-priority tasks have been waiting; safety certification DO-178C, ISO 26262, IEC 61508

More in software meets hardware

Secure BootA device cannot verify its own first instruction with software. The chain starts in immutable ROM, each stage verifies a signature on the next, and a monotonic counter in fuses refuses every old image, even one signed with your own key. The CRA's main obligations apply from 11 December 2027, and its reporting duty is already live.22 minThe Firmware That Doesn't Get LostMost reactive programs start out simple, but as features are grafted on, more and more flags and variables are introduced, until no human being really has a good idea what part of the code gets executed in response to any given event. The fix is one variable that can only hold one value at a time. This is the method: the state machine, the table, and the rules that keep it from becoming spaghetti again.26 minWatchdog timer embeddedA watchdog is a counter on its own clock that resets the processor when it reaches its limit, but a watchdog kicked from a timer interrupt is faithfully serviced by a dead product, and a reset that returns the device to the state that hung it produces a boot loop, which is worse than a freeze. The internal watchdog is free and shares the die; the external supervisor IC costs $0.30–$1.50 and cannot be disabled by confused firmware. This is the watchdog, the brownout, and the recovery ladder, worked through on the Example Labs field sensor hub.28 minThe Update That Cannot Brick the DeviceAn over-the-air firmware update can either extend the life of an embedded product or brick an entire fleet in the field. The difference is not the transport, it is the architecture: A/B partitions so the old firmware is never touched until the new one proves itself, signing and secure boot so the image is yours and unmodified, trial-then-confirm so a bad build reverts automatically, and a staged rollout with a kill switch. The safety costs one extra flash slot, 512 kB on a 2 MB chip, and its payoff is that a bad build costs one reboot instead of one scrapped unit, one truck roll, and one lost customer.11 minAlarm managementA plant with 400 configured alarms, 60 active at any moment, and operators who acknowledge the horn without reading the screen. EEMUA 191 says an operator can handle about one alarm every ten minutes, and at Milford Haven, two operators had to recognise, acknowledge, and act on 275 alarms in 11 minutes. The warning is a design problem, not a discipline problem.27 min