<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shuran Xu</title>
    <description>The latest articles on DEV Community by Shuran Xu (@shuran_xu_21cce007f2e27b8).</description>
    <link>https://dev.to/shuran_xu_21cce007f2e27b8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2191897%2Fc29f84f3-9562-42e7-9af8-7550199788cc.jpg</url>
      <title>DEV Community: Shuran Xu</title>
      <link>https://dev.to/shuran_xu_21cce007f2e27b8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shuran_xu_21cce007f2e27b8"/>
    <language>en</language>
    <item>
      <title>Edge AI for Firmware Engineers: Why It Matters and How to Start</title>
      <dc:creator>Shuran Xu</dc:creator>
      <pubDate>Wed, 05 Aug 2026 19:21:31 +0000</pubDate>
      <link>https://dev.to/shuran_xu_21cce007f2e27b8/edge-ai-for-firmware-engineers-why-it-matters-and-how-to-start-1lkj</link>
      <guid>https://dev.to/shuran_xu_21cce007f2e27b8/edge-ai-for-firmware-engineers-why-it-matters-and-how-to-start-1lkj</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction: What is Edge AI
&lt;/h2&gt;

&lt;p&gt;If you work in firmware, you have probably noticed that AI is no longer staying in the cloud.&lt;/p&gt;

&lt;p&gt;It is showing up in cameras, wearables, factory sensors, appliances, vehicles, gateways, medical devices, smart speakers, and even microcontrollers. The interesting part is not that these devices are running AI but many of them are running AI locally, close to the sensor, without waiting for a cloud server to make every decision.&lt;/p&gt;

&lt;p&gt;That is Edge AI.&lt;/p&gt;

&lt;p&gt;For firmware engineers, this is a big shift. We are used to reading sensors, filtering signals, managing buffers, handling interrupts, writing drivers, and making sure devices behave reliably in the field. &lt;strong&gt;Edge AI does not replace those skills. It adds a new layer on top of them.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of writing a threshold like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temperature&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;LIMIT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;raise_alarm&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we may start asking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Does the recent sensor pattern look normal?
Is this vibration signature changing?
Will the temperature exceed the safe range soon?
Is this sound, motion, image, or current waveform similar to a known fault?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That kind of question is hard to solve with one threshold because it often depends on history, context, sensor combinations, noise, drift, and patterns over time. This is where Edge AI becomes useful.&lt;/p&gt;

&lt;p&gt;But there is a catch: firmware engineers cannot treat AI as a magic model file. On a real embedded device, the model is only one part of a system. You still need to care about memory, latency, input format, timing, validation, failure modes, updates, and field behavior.&lt;/p&gt;

&lt;p&gt;So in this post, let us take a firmware-first look at Edge AI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;what is happening in the industry right now&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;why firmware engineers should learn it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;how Edge AI differs from traditional cloud-style AI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;what models are commonly used at the edge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;how to design an Edge AI model workflow&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;how to test and validate the model on a real board&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end, I will also introduce a Udemy course, &lt;a href="https://www.udemy.com/course/edge-ai-for-firmware-engineer/" rel="noopener noreferrer"&gt;&lt;strong&gt;Edge AI for Firmware Engineer&lt;/strong&gt;&lt;/a&gt;, for readers who want a hands-on path from sensor data to a deployable model.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. The current trend: AI is moving closer to the sensor&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For many years, the common IoT pattern was simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;device collects data -&amp;gt; send data to cloud -&amp;gt; cloud analyzes -&amp;gt; cloud sends decision back
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That architecture still makes sense for many products. The cloud is excellent for heavy training jobs, fleet analytics, dashboards, long-term storage, and model management, but it is not always the best place for every decision.&lt;/p&gt;

&lt;p&gt;As of 2026, the trend is clear: &lt;strong&gt;more intelligence is moving onto the device itself&lt;/strong&gt;. This is not just marketing language. You can see it in the silicon, the software stacks, and the way embedded products are being designed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, hardware is getting better.&lt;/strong&gt; Microcontrollers and embedded processors are no longer just small CPUs with GPIO. Many now include DSP instructions, vector extensions, or dedicated neural processing units. Arm's Cortex-M and Ethos-U ecosystem is built around running AI on constrained embedded devices. STMicroelectronics now has STM32 devices with an embedded Neural-ART accelerator for edge inference. On the higher-performance side, Qualcomm continues to push on-device AI across phones, wearables, XR, automotive, and IoT platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second, AI frameworks and tooling have improved&lt;/strong&gt;. Engineers can train in PyTorch or TensorFlow, export to formats such as ONNX or LiteRT/TensorFlow Lite, inspect the graph, quantize the model, and run it through optimized runtimes. Google documents LiteRT for Microcontrollers as a runtime designed for devices with only a few kilobytes of memory, without requiring an operating system, standard C/C++ libraries, or dynamic memory allocation. Arm's CMSIS-NN provides optimized neural network kernels for Cortex-M devices. ONNX Runtime also has IoT and edge deployment guidance for running ONNX models across different device platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Third, many products cannot afford cloud-only intelligence&lt;/strong&gt;. A factory sensor may need to react immediately. A wearable may not want to stream private health data continuously. A battery device may not want to keep its radio awake. A vehicle or medical device may need local behavior even when connectivity is poor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And finally, the market is shifting&lt;/strong&gt;. Customers are starting to expect devices that are not just connected, but intelligent. A sensor that only reports raw numbers is useful. A sensor that reports "something is changing, and here is the likely condition" is often more valuable.&lt;/p&gt;

&lt;p&gt;Put another way, Edge AI is becoming a normal part of embedded design, not a strange research add-on, so the more state-of-the-art mental model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cloud: train, manage, improve, analyze at scale
edge: sense, react, filter, protect privacy, survive connectivity gaps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two work together but the device is getting smarter, and that changes what firmware engineers need to know.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Why should firmware engineers learn Edge AI?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Firmware engineers already sit at the boundary between hardware and software. We understand the physical system, the sensors, the buses, the timing, the power budget, and the ugly details that high-level software often ignores. That makes firmware engineers unusually well-positioned to build practical Edge AI systems.&lt;/p&gt;

&lt;p&gt;Edge AI needs people who can ask questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Is the sensor data trustworthy?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Is the sampling rate stable?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What happens during startup?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What happens when the device sleeps?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can the model run within the sampling period?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How much RAM does the input window need?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What happens if the model produces a bad output?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How will this be updated in the field?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are firmware questions. So learning Edge AI does not mean every firmware engineer must become a machine learning researcher. That is not the point. You do not need to invent a new neural network architecture to build useful embedded AI products. But you should understand the workflow well enough to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;prepare sensor data correctly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;avoid data leakage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;choose a reasonable model size&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;export a model into a deployable format&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;verify that the exported model behaves correctly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;understand quantization and accuracy tradeoffs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;validate behavior on real hardware&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;debug failures when the board result differs from the desktop result&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, you need enough ML knowledge to make engineering decisions. That is the practical value. &lt;strong&gt;Edge AI is not just "AI knowledge", it is a new tool in the embedded engineer's toolbox.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. How Edge AI is different from traditional AI&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Traditional AI development often assumes the model runs on a server, GPU, or cloud platform. In that world, the model can be large, the runtime can be heavy, and power consumption may be someone else's problem. On the contrary, edge AI is different because the model lives inside a constrained system.&lt;/p&gt;

&lt;p&gt;Here is the firmware-friendly comparison:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Topic&lt;/th&gt;
&lt;th&gt;Traditional / cloud AI&lt;/th&gt;
&lt;th&gt;Edge AI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Main goal&lt;/td&gt;
&lt;td&gt;High accuracy, scale, rich services&lt;/td&gt;
&lt;td&gt;Useful local decisions under constraints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Typical hardware&lt;/td&gt;
&lt;td&gt;GPU servers, cloud VMs, data centers&lt;/td&gt;
&lt;td&gt;MCU, MPU, NPU, DSP, gateway, embedded Linux&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Power budget&lt;/td&gt;
&lt;td&gt;Often large&lt;/td&gt;
&lt;td&gt;Often tight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;Network + server latency may be acceptable&lt;/td&gt;
&lt;td&gt;Local response may be required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data movement&lt;/td&gt;
&lt;td&gt;Data often uploaded for processing&lt;/td&gt;
&lt;td&gt;Data often stays near the sensor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model size&lt;/td&gt;
&lt;td&gt;Can be very large&lt;/td&gt;
&lt;td&gt;Usually small or optimized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runtime&lt;/td&gt;
&lt;td&gt;Python/cloud frameworks are common&lt;/td&gt;
&lt;td&gt;C/C++, vendor runtime, TFLM, ONNX runtime variants&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failure mode&lt;/td&gt;
&lt;td&gt;Service error, bad prediction, scaling issue&lt;/td&gt;
&lt;td&gt;Bad prediction plus real-world device behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation&lt;/td&gt;
&lt;td&gt;Dataset metrics, service tests&lt;/td&gt;
&lt;td&gt;Dataset metrics + hardware timing + memory + field behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The biggest mindset shift is this: &lt;strong&gt;&lt;em&gt;in Edge AI, accuracy is not the only metric.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A model that is 2% more accurate but uses 4x more RAM may be a bad embedded model. A model that works in Python but misses the real-time deadline on the board is not deployable. A model that expects floating-point support on a device without efficient floating point may not survive the product review.&lt;/p&gt;

&lt;p&gt;Another difference is ownership. In a cloud AI system, the ML team may own most of the serving stack. In Edge AI, ownership gets mixed. The firmware team may be responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;sensor acquisition&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;preprocessing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;feature extraction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;runtime integration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;memory allocation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;timing measurements&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;board validation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;field logging&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;model update safety&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why firmware engineers do not need to become ML researchers, but they do need to understand the model pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. Typical Edge AI models and where they are used&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Not all Edge AI models are deep neural networks, and not all embedded AI needs to be complicated. Before reviewing common model families, it is useful to separate Edge AI by device class:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device class&lt;/th&gt;
&lt;th&gt;Typical examples&lt;/th&gt;
&lt;th&gt;What usually matters most&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tiny MCU&lt;/td&gt;
&lt;td&gt;Cortex-M, ESP32-class devices&lt;/td&gt;
&lt;td&gt;memory, fixed-point math, simple runtime, low power&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI-capable MCU&lt;/td&gt;
&lt;td&gt;Cortex-M + NPU/DSP, STM32N6-style devices&lt;/td&gt;
&lt;td&gt;model conversion, accelerator support, tensor memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Embedded Linux&lt;/td&gt;
&lt;td&gt;
&lt;a href="http://i.MX" rel="noopener noreferrer"&gt;i.MX&lt;/a&gt;, Jetson, Raspberry Pi-class systems&lt;/td&gt;
&lt;td&gt;runtime packaging, GPU/NPU drivers, container/service integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gateway / industrial edge&lt;/td&gt;
&lt;td&gt;x86/Arm gateway, local server&lt;/td&gt;
&lt;td&gt;multi-sensor fusion, fleet updates, local analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The model choice depends heavily on which row you are in.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Typical Edge AI models&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model Name&lt;/th&gt;
&lt;th&gt;Application&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1D CNNs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1D convolutional neural networks are useful for time-series signals.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Applications:&lt;/strong&gt;&lt;br&gt;- vibration analysis&lt;br&gt;- motor current signature analysis&lt;br&gt;- ECG or biomedical waveforms&lt;br&gt;- acoustic events&lt;br&gt;- IMU gesture recognition&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;LSTM and GRU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LSTM and GRU models are recurrent neural networks. They are useful when recent history matters.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Applications:&lt;/strong&gt;&lt;br&gt;- sensor prediction&lt;br&gt;- anomaly detection&lt;br&gt;- environmental monitoring&lt;br&gt;- battery or energy forecasting&lt;br&gt;- motion sequences&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Autoencoders&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;An autoencoder learns to reconstruct normal data. If the reconstruction error becomes large, the input may be abnormal.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Applications:&lt;/strong&gt;&lt;br&gt;- anomaly detection&lt;br&gt;- equipment monitoring&lt;br&gt;- sensor fault detection&lt;br&gt;- detecting unusual vibration or current patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Keyword spotting and audio models&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Audio is one of the classic TinyML use cases. The model may not process raw audio directly. Often the firmware first computes features such as MFCCs or spectrograms, then feeds those into the model.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Applications:&lt;/strong&gt;&lt;br&gt;- wake word detection&lt;br&gt;- machine sound classification&lt;br&gt;- glass break detection&lt;br&gt;- cough or breathing pattern detection&lt;br&gt;- acoustic condition monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;6. General steps in designing an Edge AI model&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let us now talk about the workflow. Suppose we are working on a project that uses BME280-style time-series data with three channels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;temperature_c&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;humidity_pct&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pressure_hpa&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to predict the next sensor reading from the recent history.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Define the embedded problem clearly&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Do not start with "I want to use AI."&lt;/p&gt;

&lt;p&gt;Start with the product question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What decision should the device make?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What sensor data is available?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How often is the decision needed?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What happens if the decision is wrong?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Is the model predicting a value, classifying a state, or detecting an anomaly?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the BME280-style example, the task is next-step prediction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Given recent temperature, humidity, and pressure history,
predict the next reading.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For another product, the task may be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;classify vibration as normal or abnormal&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;detect a wake word&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;estimate battery health&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;detect whether a machine is entering a fault condition&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;The clearer the task, the easier the model design.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At this stage, also write down the deployment constraints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;target board&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;available RAM and flash&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;required sample rate&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inference deadline&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;power budget&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;acceptable false positives and false negatives&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;update mechanism&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This prevents the classic mistake of training a model that is accurate on a laptop and useless on the board.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Collect and Inspect Sensor Data
&lt;/h3&gt;

&lt;p&gt;This step is easy to underestimate: sensor data is messy, timestamps can be missing, samples can be duplicated, etc. Before training, make sure to inspect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;timestamp gaps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;min/max values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;missing samples&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;outliers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;drift&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;periodic patterns&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;correlation between channels&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this sample project, the sample data contains daily temperature patterns, humidity changes, pressure variation, and noise. That gives us the model realistic structure to learn.&lt;/p&gt;

&lt;p&gt;For real projects, this is where firmware knowledge helps a lot. You know what the sensor should physically do. If the data says otherwise, investigate before training.&lt;/p&gt;

&lt;p&gt;This is also where you should decide how much data comes from real hardware. Synthetic data can help you build the pipeline early, but real sensor logs are where the product truth lives.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Split Time-Series Data Chronologically
&lt;/h3&gt;

&lt;p&gt;For time-series data, avoid random splitting before train/test separation. Use chronological split:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;past data -&amp;gt; training
later data -&amp;gt; validation
newest data -&amp;gt; test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project uses 70% training, 15% validation, and 15% test.&lt;/p&gt;

&lt;p&gt;This matters because firmware deployment is always future-facing. Your device will not see a random historical sample but whatever happens next. &lt;strong&gt;Random splitting can make the test score look better than it really is.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Normalize Data and Save the Scaler
&lt;/h3&gt;

&lt;p&gt;We can use MinMax normalization in this project. The scaler is fitted on the training set only, then applied to validation and test data. The scaler values are saved:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data_min"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;18.52&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;34.79&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1009.45&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"data_max"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;26.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;64.92&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1016.06&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sensor_columns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"temperature_c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"humidity_pct"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"pressure_hpa"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"seq_len"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file is part of the firmware contract.&lt;/p&gt;

&lt;p&gt;If the model was trained with one scaler and the board uses another, the model may still run but produce bad outputs. That is one of the most common and painful Edge AI mistakes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Convert Streaming Data into Windows
&lt;/h3&gt;

&lt;p&gt;Most sensor models need history, not just one sample.&lt;/p&gt;

&lt;p&gt;In the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequence length = 24
feature count = 3
input shape = 1 x 24 x 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the sample data is hourly, it means one input window contains one day of history. In Python this is called a &lt;strong&gt;sliding window&lt;/strong&gt;. On the board, it becomes a &lt;strong&gt;ring buffer&lt;/strong&gt;. This is where firmware and ML meet directly. The model shape becomes an actual memory layout.&lt;/p&gt;

&lt;p&gt;For a junior firmware engineer, this is one of the easiest ways to understand Edge AI: &lt;em&gt;a model input tensor is just a structured buffer with strict rules.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Train a Model Small Enough for the Target
&lt;/h3&gt;

&lt;p&gt;For this sample project, we can use a compact LSTM:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;one LSTM layer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;hidden size 32&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;output size 3&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;best validation checkpoint saved&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The exported ONNX model is around 22 KB. That is small enough to make embedded deployment feel realistic.&lt;/p&gt;

&lt;p&gt;We certainly should use different models if project changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For vibration, maybe use a 1D CNN.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For images, maybe use a tiny CNN.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For anomaly detection, maybe use an autoencoder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For simple sensor classification, maybe a decision tree is enough.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start small. Measure. Then increase complexity only when the baseline is not good enough.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Export to a Deployable Format
&lt;/h3&gt;

&lt;p&gt;Training usually happens in Python. Firmware cannot ship a Python training script. We need a deployable artifact, and common options include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;ONNX&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;LiteRT / TensorFlow Lite&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;LiteRT for Microcontrollers / TensorFlow Lite for Microcontrollers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vendor-specific converted formats&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;generated C arrays or optimized runtime blobs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this sample project, the PyTorch model is exported to ONNX with fixed input shape and named input/output tensors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input:  1 x 24 x 3
output: 1 x 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fixed shape is useful for embedded work because it makes memory planning easier.&lt;/p&gt;

&lt;p&gt;Depending on the target, ONNX may be the final runtime format, or it may be an intermediate artifact before conversion to a vendor-specific representation. The important idea is the same: once the model leaves Python, verify the exported artifact as its own thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 8: Verify the Exported Model Before Going to Hardware
&lt;/h3&gt;

&lt;p&gt;For verification, we can compare PyTorch output and ONNX Runtime output on the PC. If they disagree, the workflow stops. This is exactly the kind of habit firmware engineers already understand. When something can be tested on the comfortable machine, test it there first.&lt;/p&gt;

&lt;p&gt;Do not debug an export bug through JTAG unless you enjoy pain as a hobby.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9: Evaluate the Model in Real Units
&lt;/h3&gt;

&lt;p&gt;Normalized loss is useful for training but it is not enough for engineering decisions. The project converts predictions back to real sensor units and reports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;temperature_c    MAE=0.398  RMSE=0.496  MAPE=1.71%  R2=0.946
humidity_pct     MAE=1.499  RMSE=1.949  MAPE=3.08%  R2=0.930
pressure_hpa     MAE=0.237  RMSE=0.299  MAPE=0.02%  R2=0.974
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the result means something. A temperature error of 0.4 degC may be fine for one product and unacceptable for another. It is obvious that we cannot answer that from normalized loss alone.&lt;/p&gt;

&lt;p&gt;In the project, we compare against a simple persistence baseline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;next value = previous value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LSTM improves MAE by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;35.0% for temperature&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;40.2% for humidity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;20.1% for pressure&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is important. A model should beat a simple baseline before it earns space in firmware.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. How to Test and Validate an Edge AI Model on Board
&lt;/h2&gt;

&lt;p&gt;Desktop validation is necessary, but not sufficient. Once the model moves to the board, we are no longer testing only machine learning but testing the full embedded path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sensor -&amp;gt; driver -&amp;gt; buffer -&amp;gt; preprocessing -&amp;gt; model runtime -&amp;gt; decision logic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a practical validation plan:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;1. Start with Known-Good Test Vectors&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before using live sensor data, feed the board a few fixed input windows. These should be the same windows tested on the PC. Store the expected output from PyTorch or ONNX Runtime.&lt;/p&gt;

&lt;p&gt;On the board, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;same input window -&amp;gt; board inference -&amp;gt; compare output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result will not always match bit-for-bit, especially after quantization, but it should be within an acceptable tolerance.&lt;/p&gt;

&lt;p&gt;This catches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;input shape mistakes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;channel-order mistakes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;endian or data-layout issues&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wrong scaler values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;runtime conversion errors&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I like to keep these vectors in the repository. They become regression tests. If a future model conversion, compiler option, or runtime update changes the result, we find out quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. Verify Preprocessing on the Board&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do not only verify the model, make sure also verify the code that prepares model input:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;sensor unit conversion&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MinMax or standard scaling&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;clipping behavior&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ring buffer order&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;missing-sample handling&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;float vs fixed-point differences&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Many Edge AI bugs are not model bugs but preprocessing bugs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;3. Replay Recorded Sensor Logs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A useful test is sensor replay:&lt;/p&gt;

&lt;p&gt;Take a recorded CSV log, feed it through the firmware path, and compare board predictions against PC predictions.&lt;/p&gt;

&lt;p&gt;This is excellent for debugging because the input is repeatable and allow us to test firmware changes without waiting for the physical environment to reproduce the same condition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4. Measure Latency&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The model must finish before the next decision is needed.&lt;/p&gt;

&lt;p&gt;Measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;preprocessing time&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inference time&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;postprocessing time&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;worst-case latency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;jitter&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not measure only the average. Firmware fails in the worst case. At minimum, measure with a GPIO toggle, cycle counter, trace, or timestamp log. Keep the number in a report, not only in a screenshot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;5. Measure Memory Usage&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;model storage size&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;tensor arena or runtime memory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;input window buffer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;stack usage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;heap usage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fragmentation risk&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Provided an RTOS is used, we need to test with the real task configuration. A model that works in an isolated demo may fail in the real product when communication stacks, logging, filesystems, and other tasks are running.&lt;/p&gt;

&lt;p&gt;For TFLM/LiteRT Micro-style deployments, pay attention to the tensor arena. For ONNX-style deployments, pay attention to runtime allocations and operator support. For NPU deployments, also check alignment and memory placement requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;6. Test Bad Inputs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Real sensors misbehave.&lt;/p&gt;

&lt;p&gt;Test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;missing samples&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;repeated samples&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;out-of-range values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;saturated values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;startup transients&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sensor disconnects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;bus read failures&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NaN or invalid values if your platform can produce them&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model should not be the first line of defense against broken input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;7. Compare Float and Quantized Models&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we quantize the model for size minimization, we need to validate accuracy again. Quantization can reduce memory and improve speed, but it can also change predictions. The only honest answer is measurement.&lt;/p&gt;

&lt;p&gt;Compare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;float desktop model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;exported float model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;quantized desktop model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;board runtime result&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make the differences visible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;8. Run Long-Duration Tests&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some issues only show up over time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;drift&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;memory leaks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;thermal effects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sensor aging&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;buffer rollover bugs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;watchdog resets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;changing environmental conditions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For deployed Edge AI, a one-minute demo is not validation. This is especially true for environmental sensors and industrial systems. Drift is not a theoretical problem; it is what the real world does while your demo is sleeping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;9. Validate the Decision Logic&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The model output is rarely the final product behavior. Maybe the model predicts temperature. Maybe it outputs an anomaly score. Maybe it classifies a state. Firmware still has to decide what to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;trigger an alarm&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;log an event&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;send a message&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;shut down a subsystem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;request cloud confirmation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ignore a noisy sample&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Validate that decision layer carefully, because a good model wrapped in bad decision logic is still a bad product.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Key Takeaways for Firmware Engineers
&lt;/h2&gt;

&lt;p&gt;If you take only a few ideas from this article, take these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Edge AI is not magic. It is an embedded workflow with a model inside it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The model input contract matters as much as the model file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data leakage can make a weak model look strong.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The scaler is a firmware artifact.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A small model that is verified is better than a large model that is mysterious.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always compare against a simple baseline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Desktop parity checks should happen before board debugging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On-board validation must include timing, memory, preprocessing, and bad-input behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not just train a model. Build evidence that the model can survive firmware reality.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the mindset that makes Edge AI practical.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Want a Hands-On Path? Learn Edge AI Step by Step
&lt;/h2&gt;

&lt;p&gt;If this topic sounds useful but still feels a little too abstract, that is exactly why I created my Udemy course:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.udemy.com/course/edge-ai-for-firmware-engineer/" rel="noopener noreferrer"&gt;&lt;strong&gt;Edge AI for Firmware Engineer on Udemy&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The course is not a high-level AI buzzword tour but a hands-on engineering workflow built for firmware, embedded systems, and software engineers who want to understand how Edge AI actually gets prepared for deployment.&lt;/p&gt;

&lt;p&gt;You will work through a complete time-series sensor pipeline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;generate or load BME280-style sensor data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inspect temperature, humidity, and pressure signals&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;identify data-quality problems&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;split time-series data correctly without leaking the future&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;normalize sensor channels and save the scaler contract&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;convert continuous readings into sliding windows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;train a compact PyTorch LSTM&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;save the best checkpoint&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;export the model to ONNX&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;inspect and verify the exported model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;compare PyTorch and ONNX predictions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;evaluate the model using MAE, RMSE, MAPE, and R2 in real sensor units&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;understand deployment risks such as scaler mismatch, data leakage, quantization effects, and distribution drift&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The course is designed to give you a repeatable workflow, not just a notebook that works once.&lt;/p&gt;

&lt;p&gt;If you are a junior firmware engineer, this course will help you build the missing bridge between "I know embedded systems" and "I can participate in an Edge AI project."&lt;/p&gt;

&lt;p&gt;If you are an experienced firmware engineer, it will help you understand the ML pipeline well enough to ask better questions, review model artifacts, and avoid common deployment traps.&lt;/p&gt;

&lt;p&gt;And if you are working on IoT, industrial monitoring, sensor products, predictive maintenance, smart devices, or embedded Linux gateways, this is exactly the kind of workflow you will increasingly see in real products.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.arm.com/edge-ai/arm-cortex-m-and-ethos-u" rel="noopener noreferrer"&gt;Arm: Edge AI on Arm Cortex-M and Ethos-U&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.arm.com/products/silicon-ip-cpu/ethos/ethos-u55" rel="noopener noreferrer"&gt;Arm Ethos-U55 NPU&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://arm-software.github.io/CMSIS_6/latest/NN/index.html" rel="noopener noreferrer"&gt;Arm CMSIS-NN&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series.html" rel="noopener noreferrer"&gt;STMicroelectronics: STM32N6 series&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.qualcomm.com/artificial-intelligence" rel="noopener noreferrer"&gt;Qualcomm: AI products and on-device AI&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developers.google.com/edge/litert/microcontrollers/overview" rel="noopener noreferrer"&gt;Google AI Edge: LiteRT for Microcontrollers&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://onnx.ai/" rel="noopener noreferrer"&gt;ONNX&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://onnxruntime.ai/docs/" rel="noopener noreferrer"&gt;ONNX Runtime&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://onnxruntime.ai/docs/tutorials/iot-edge/" rel="noopener noreferrer"&gt;ONNX Runtime: Deploy ML Models on IoT and Edge Devices&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.pytorch.org/docs/stable/generated/torch.nn.LSTM.html" rel="noopener noreferrer"&gt;PyTorch LSTM documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://netron.app/" rel="noopener noreferrer"&gt;Netron model viewer&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>iot</category>
      <category>programming</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>A Practical Bare-Metal Secure Boot Kit for Cortex-M</title>
      <dc:creator>Shuran Xu</dc:creator>
      <pubDate>Sat, 21 Feb 2026 22:41:56 +0000</pubDate>
      <link>https://dev.to/shuran_xu_21cce007f2e27b8/a-practical-bare-metal-secure-boot-kit-for-cortex-m-1nll</link>
      <guid>https://dev.to/shuran_xu_21cce007f2e27b8/a-practical-bare-metal-secure-boot-kit-for-cortex-m-1nll</guid>
      <description>&lt;h2&gt;
  
  
  What is secure boot ?
&lt;/h2&gt;

&lt;p&gt;Secure boot is one of those topics that sits at the intersection of embedded software, system security, and real products. Everyone has heard of it. Many projects mention it. Fewer actually implement it correctly — especially on bare-metal microcontrollers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This post does two things:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Explains what secure boot really means on a bare-metal Cortex-M MCU&lt;/li&gt;
&lt;li&gt;Introduces a reference kit that demonstrates this flow end-to-end&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;⭐ If you’re a hobbyist or learner, this will help you understand why secure boot exists and how it works.&lt;br&gt;
⭐ If you’re working on a serious prototype or early product, it will also show what a minimal, correct baseline looks like.&lt;/p&gt;
&lt;h2&gt;
  
  
  What “secure boot” actually means on a bare-metal MCU
&lt;/h2&gt;

&lt;p&gt;At its core, secure boot answers one simple question:&lt;/p&gt;

&lt;p&gt;Should this firmware be allowed to run on this device?&lt;/p&gt;

&lt;p&gt;On a PC or smartphone, secure boot is handled by firmware layers, ROM code, and complex certificate chains. On a bare-metal Cortex-M MCU, you are responsible for that decision.&lt;/p&gt;

&lt;p&gt;➡️There is no OS.&lt;br&gt;
➡️There is no background service.&lt;br&gt;
➡️There is no safety net.&lt;/p&gt;

&lt;p&gt;Whatever runs after reset is whatever your boot code allows to run.&lt;/p&gt;

&lt;p&gt;It’s tempting to think secure boot only matters for commercial or high-security devices. In reality, secure boot teaches foundational embedded concepts that apply everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flash layout discipline: Where does the bootloader end and the application begin?&lt;/li&gt;
&lt;li&gt;Image formats: How does code identify what it’s about to execute?&lt;/li&gt;
&lt;li&gt;Failure behavior: What happens if validation fails? Do you crash? Loop? Halt safely?&lt;/li&gt;
&lt;li&gt;Determinism: Can you reproduce and test failure cases reliably?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are not “security-only” ideas — they are core embedded engineering skills.&lt;/p&gt;

&lt;p&gt;That’s why secure boot is such a valuable topic for learners: it forces you to think clearly about reset-time behavior, memory ownership, and control flow.&lt;/p&gt;


&lt;h2&gt;
  
  
  Minimum bare-metal secure boot flow
&lt;/h2&gt;

&lt;p&gt;A minimal secure boot flow on a microcontroller looks like the following diagram:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9gcmaho7mzxvdno5on7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9gcmaho7mzxvdno5on7.png" alt="Minimum boot flow" width="629" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This diagram shows what happens when a bare-metal MCU powers up: after reset, the CPU starts at the boot address and runs the bootloader. The bootloader finds the firmware in flash, checks whether it’s valid, then makes a simple decision—run it if it passes, or stop / go to a safe state if it fails. One thing to be noted is that &lt;strong&gt;there is no scheduler, no daemon, no fallback process.&lt;/strong&gt; If you get this logic wrong, the device will happily execute corrupted or malicious firmware.&lt;/p&gt;
&lt;h2&gt;
  
  
  Where most secure-boot tutorials fall short
&lt;/h2&gt;

&lt;p&gt;If you search for “Cortex-M secure boot,” you’ll usually find one of two things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High-level explanations&lt;/strong&gt;&lt;br&gt;
Hashes, signatures, threat models — but no runnable code&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vendor-specific examples&lt;/strong&gt;&lt;br&gt;
Tightly coupled to a specific ROM bootloader, SDK, or TrustZone flow&lt;/p&gt;

&lt;p&gt;What’s usually missing is the middle ground:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;portable bare-metal reference&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;written in plain C&lt;/li&gt;
&lt;li&gt;with a clear boot decision point&lt;/li&gt;
&lt;li&gt;observable pass/fail behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words: something you can &lt;strong&gt;flash, break, and reason about&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Bridging theory to practice: what a real demo should show
&lt;/h2&gt;

&lt;p&gt;A useful secure boot example should let you answer these questions confidently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What exactly is verified at boot?&lt;/li&gt;
&lt;li&gt;What happens if the image is modified?&lt;/li&gt;
&lt;li&gt;Where does the bootloader stop and the application begin?&lt;/li&gt;
&lt;li&gt;How do I prove the system refuses to run bad firmware?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can’t deliberately corrupt the image and watch the system reject it, you don’t really know if secure boot is working.&lt;/p&gt;

&lt;p&gt;That gap between theory and practice is what motivated the kit described below.&lt;/p&gt;
&lt;h2&gt;
  
  
  Proof first: what actually happens at boot
&lt;/h2&gt;

&lt;p&gt;The reference implementation demonstrates the following behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A valid firmware image boots normally&lt;/li&gt;
&lt;li&gt;A single-byte modification causes validation failure&lt;/li&gt;
&lt;li&gt;Control never jumps to the application on failure&lt;/li&gt;
&lt;li&gt;The failure path is deterministic and testable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This diagram explains what secure boot means in the embedded world:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v9vkvlj2vttdchza7a4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v9vkvlj2vttdchza7a4.png" alt="boot flow 1" width="589" height="678"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On a bare-metal MCU, secure boot is not a service or a background task.&lt;br&gt;
&lt;strong&gt;It is a single decision point executed immediately after reset.&lt;/strong&gt;&lt;br&gt;
If verification passes, execution continues. If it fails, execution must not proceed.&lt;/p&gt;

&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[BOOT] Image header found
[BOOT] Hash computed
[BOOT] Image validation OK
[BOOT] Jumping to application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for a tampered image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[BOOT] Image header found
[BOOT] Hash mismatch
[BOOT] Validation FAILED
[BOOT] System halted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a conceptual diagram — &lt;strong&gt;it is compiled, flashed, and exercised code.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Introducing the Cortex-M Bare-Metal Secure Boot Kit
&lt;/h2&gt;

&lt;p&gt;To make this flow reusable and easy to study, I packaged it into a small &lt;strong&gt;Cortex-M bare-metal secure boot reference kit&lt;/strong&gt;. This secure boot kit gives you a small, readable bare-metal bootloader for Cortex-M that makes one clear decision at reset: &lt;em&gt;&lt;strong&gt;run the firmware if it’s intact, or refuse to run it if it’s been modified&lt;/strong&gt;&lt;/em&gt;. You can flash it, break the firmware on purpose, and watch the system reject it. It’s meant to help learners understand secure boot by running real code, and to give startups a clean baseline they can extend and harden later.&lt;/p&gt;

&lt;p&gt;The goal is not to sell a "&lt;em&gt;black box&lt;/em&gt;,” but to provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;readable C code&lt;/li&gt;
&lt;li&gt;a concrete image format&lt;/li&gt;
&lt;li&gt;a clear validation decision&lt;/li&gt;
&lt;li&gt;and documentation that explains why things are done this way&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This following diagram shows what makes this kit concrete and educational:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4jxb07ntgbz9kyirg6q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4jxb07ntgbz9kyirg6q.png" alt="boot flow 2" width="627" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above flow makes three important points:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key Highlight&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The boot decision is explicit&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;No fall-through&lt;/li&gt;
&lt;li&gt;No undefined behavior&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tampering is observable&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;A one-byte change forces the failure path&lt;/li&gt;
&lt;li&gt;This is testable, not theoretical&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The failure path is intentional&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;The system refuses to execute&lt;/li&gt;
&lt;li&gt;Not “crash and hope”&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;🔥This is exactly the behavior beginners struggle to visualize without a real reference !&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s inside the kit
&lt;/h2&gt;

&lt;p&gt;The kit is delivered as a clean ZIP and includes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Bare-metal bootloader reference&lt;/td&gt;
&lt;td&gt;explicit flow: locate → validate → decide → handoff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Firmware image format&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Header layout&lt;/li&gt;
&lt;li&gt;Versioning fields&lt;/li&gt;
&lt;li&gt;Integrity metadata&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validation logic&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Hash-based integrity check&lt;/li&gt;
&lt;li&gt;Explicit failure behavior (no silent fall-through)&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flash layout &amp;amp; linker examples&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Bootloader vs application regions&lt;/li&gt;
&lt;li&gt;Alignment and vector-table considerations&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runnable demo&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Valid image boots&lt;/li&gt;
&lt;li&gt;Modified image is rejected&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Negative tests&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Corruption scenarios&lt;/li&gt;
&lt;li&gt;Boundary conditions&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Beginner-friendly documentation&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;
&lt;li&gt;Boot flow explanation&lt;/li&gt;
&lt;li&gt;Flash layout rationale&lt;/li&gt;
&lt;li&gt;Notes on how to adapt the design&lt;/li&gt;
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;➡️For learners, this is a study-and-flash kit.&lt;br&gt;
➡️For indie developers, this is a serious baseline for a prototype.&lt;br&gt;
➡️For startups, it’s a clean baseline to build and harden further.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this kit is — and is not
&lt;/h2&gt;

&lt;p&gt;This kit &lt;strong&gt;IS&lt;/strong&gt;: ✔️&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a Cortex-M bare-metal secure boot &lt;strong&gt;reference&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;readable, modifiable, and educational&lt;/li&gt;
&lt;li&gt;suitable for prototypes and early designs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This kit is &lt;strong&gt;NOT&lt;/strong&gt;:❌&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a turnkey production secure-boot solution&lt;/li&gt;
&lt;li&gt;a full PKI or signing infrastructure&lt;/li&gt;
&lt;li&gt;a vendor ROM or TrustZone replacement&lt;/li&gt;
&lt;li&gt;a certified security product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it as the missing middle layer between theory and production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the Secure Boot Kit
&lt;/h2&gt;

&lt;p&gt;The Cortex-M Bare-Metal Secure Boot Kit is available as a one-time download.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Price: $49.99 CAD&lt;/li&gt;
&lt;li&gt;Format: ZIP package&lt;/li&gt;
&lt;li&gt;License: personal / internal use (no redistribution)&lt;/li&gt;
&lt;li&gt;Support: documentation + community discussion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Buy the Secure Boot Kit on &lt;a href="https://xushuran.gumroad.com/l/yvdcoa" rel="noopener noreferrer"&gt;Gumroad&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever wanted a secure-boot example that goes beyond slides — and actually &lt;strong&gt;refuses to run modified firmware&lt;/strong&gt; — this kit gives you a clean, practical starting point.&lt;/p&gt;

</description>
      <category>firmware</category>
      <category>iot</category>
      <category>software</category>
      <category>security</category>
    </item>
    <item>
      <title>Reverse Engineering Firmware at Scale with IDA Pro</title>
      <dc:creator>Shuran Xu</dc:creator>
      <pubDate>Fri, 30 Jan 2026 04:43:36 +0000</pubDate>
      <link>https://dev.to/shuran_xu_21cce007f2e27b8/reverse-engineering-firmware-at-scale-with-ida-pro-nk3</link>
      <guid>https://dev.to/shuran_xu_21cce007f2e27b8/reverse-engineering-firmware-at-scale-with-ida-pro-nk3</guid>
      <description>&lt;h1&gt;
  
  
  Why reverse engineering matters
&lt;/h1&gt;

&lt;p&gt;If you’ve ever stared at a stripped firmware image and asked, “Where does this boot? What does it talk to? Why does it lock up?”—you’ve already brushed against reverse engineering (RE).&lt;/p&gt;

&lt;p&gt;I got into RE the same way many engineers do: not because it sounded glamorous, but because I had a binary, a bug, and not enough documentation. The reality is that modern engineering constantly runs into black boxes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3rd‑party libraries you can’t fully audit&lt;/li&gt;
&lt;li&gt;legacy devices where the original team is long gone&lt;/li&gt;
&lt;li&gt;production firmware that differs from “the source” you were given&lt;/li&gt;
&lt;li&gt;security features (secure boot, update verification, anti‑rollback) you need to validate incident response—when something suspicious happens and you need answers fast&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reverse engineering is the discipline that turns those black boxes into something you can reason about. It’s not magic—it's a set of workflows that convert raw bytes into evidence: control flow, data flow, memory maps, and behavioral clues.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Reverse Engineering?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdajmlne04qyp3e1jbzm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdajmlne04qyp3e1jbzm.jpg" alt=" " width="275" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reverse engineering (RE) is the process of understanding how a system works by studying the thing you already have — often a compiled program or firmware image — even when you don’t have the original source code or documentation.&lt;/p&gt;

&lt;p&gt;In software, RE typically means taking a binary (EXE/ELF/firmware), inspecting its machine code and data, and reconstructing higher-level meaning: which functions exist, how control flows, what protocols or file formats are used, and where key features live.&lt;/p&gt;

&lt;p&gt;You can think of it as turning an opaque blob into a map you can navigate, reason about, and communicate to others.&lt;/p&gt;

&lt;h1&gt;
  
  
  How RE Helps Solve Real-World Software Problems
&lt;/h1&gt;

&lt;p&gt;In embedded and firmware work, reverse engineering isn’t just a security hobby — it’s often the fastest way to unblock real engineering tasks when the usual inputs are missing.&lt;/p&gt;

&lt;p&gt;Common situations where RE helps:&lt;/p&gt;

&lt;p&gt;• Vendor documentation is incomplete (or NDA-bound), but you still need to integrate hardware features correctly.&lt;/p&gt;

&lt;p&gt;• You inherit a device/board with unknown firmware behavior and need to debug boot failures, watchdog resets, or update issues.&lt;/p&gt;

&lt;p&gt;• A field unit behaves differently across versions and you must identify what changed (protocol handling, safety checks, timing).&lt;/p&gt;

&lt;p&gt;• You need to validate security properties (secure boot checks, key rotation, update signatures) from the actual binary — not just a spec.&lt;/p&gt;

&lt;p&gt;• You’re interfacing with a black-box peripheral/protocol and want to reconstruct message formats from code paths and memory accesses.&lt;/p&gt;

&lt;p&gt;The key outcome is actionable understanding: which functions implement a feature, what inputs they expect, what states they maintain, and where to patch, instrument, or monitor.&lt;/p&gt;

&lt;h1&gt;
  
  
  What RE actually looks like in practice
&lt;/h1&gt;

&lt;p&gt;At a high level, most firmware RE sessions follow the same arc:&lt;/p&gt;

&lt;p&gt;• Disassembly: you start from instructions, not source code.&lt;/p&gt;

&lt;p&gt;• Structure discovery: entry points, init code, interrupt vectors, call relationships.&lt;/p&gt;

&lt;p&gt;• Meaning extraction: names, parameters, “what this function is really doing.”&lt;/p&gt;

&lt;p&gt;• Hardware context: memory‑mapped I/O (MMIO), peripheral registers, boot ROM expectations.&lt;/p&gt;

&lt;p&gt;• Failure &amp;amp; edge behavior: loops, asserts, error handlers, watchdog patterns.&lt;/p&gt;

&lt;p&gt;The catch is: doing this once is doable. Doing it repeatedly—across many builds or many devices—is where the pain lives. If your workflow is 90% manual clicking, you’ll spend most of your time re‑doing the same extraction steps instead of thinking like an engineer.&lt;/p&gt;

&lt;h1&gt;
  
  
  RE Automation vs Manual RE
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzi8pn21b0y3n2avtpn2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzi8pn21b0y3n2avtpn2.png" alt=" " width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Manual RE is you driving the investigation interactively: following cross-references, renaming functions, annotating structures, and tracing control flow until the behavior makes sense.&lt;/p&gt;

&lt;p&gt;Automation RE uses scripts to perform repeatable extraction and reporting tasks — things that are tedious by hand or easy to forget — such as:&lt;/p&gt;

&lt;p&gt;• exporting function lists, call graphs, and string inventories&lt;br&gt;
• extracting key regions (tables, vectors, jump dispatch) into structured artifacts&lt;br&gt;
• generating Markdown/JSON reports so results are comparable across versions&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;best&lt;/strong&gt; workflow is hybrid:&lt;/p&gt;

&lt;p&gt;• Use automation to generate a reliable “baseline map” fast.&lt;br&gt;
• Use manual analysis to answer the hard questions (intent, state machines, edge cases).&lt;br&gt;
• Feed your manual findings back into automation (naming, annotations, extraction rules) so your next target is faster.&lt;/p&gt;

&lt;p&gt;In other words: automation gives you consistency and speed; manual RE gives you judgment. This kit is designed to teach both, with a pipeline that produces artifacts you can keep.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tooling landscape: why IDA Pro keeps showing up
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyz6mdwbu32gqtey0nez7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyz6mdwbu32gqtey0nez7.png" alt=" " width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many solid tools in the RE ecosystem: Ghidra, Binary Ninja, radare2/rizin, objdump + GDB, Frida, and more. Each has strengths. But for firmware and bare‑metal work, I keep coming back to one practical truth:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you want an interactive GUI and a programmable analysis engine in the same place, IDA Pro is hard to beat.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;IDA’s value isn’t only in the UI. It’s in the ecosystem: a mature database model, rich cross‑references, and—most importantly for scale—automation via IDAPython scripts. Once you can script extraction, you stop “re‑discovering” facts and start generating artifacts.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why I recommend IDA Pro (or Home) for automation—not IDA Free
&lt;/h1&gt;

&lt;p&gt;This is the part many people miss when they first start: there’s a difference between using IDA as a viewer and using IDA as a pipeline engine.&lt;/p&gt;

&lt;p&gt;For automation, you typically want to run IDA in a headless or unattended mode: load a binary, let analysis complete, run scripts, export reports, and exit. That’s how you scale to multiple targets, integrate with CI, or run overnight batches.&lt;/p&gt;

&lt;p&gt;IDA Free is great for getting familiar with the UI, but it becomes a dead end when you want proper automation:&lt;/p&gt;

&lt;p&gt;You can’t rely on IDAPython availability for tooling the way you can with licensed editions.&lt;/p&gt;

&lt;p&gt;Headless scripting flags may be ignored, which means your script never executes and the process won’t terminate cleanly.&lt;/p&gt;

&lt;p&gt;That makes “batch RE” fragile unless you add external timeouts and manual fallbacks.&lt;/p&gt;

&lt;p&gt;If your goal is to learn repeatable reverse engineering—not just one‑off browsing—start with an edition that supports the workflow you eventually want.&lt;/p&gt;

&lt;h1&gt;
  
  
  The mindset shift: stop “looking” and start “producing artifacts”
&lt;/h1&gt;

&lt;p&gt;When RE becomes part of your engineering workflow, the deliverable isn’t “I clicked around and I think I understand it.” The deliverable is a folder of artifacts you can diff, review, and share with your team:&lt;/p&gt;

&lt;p&gt;• Call graphs (DOT/JSON) to see boot and initialization flows&lt;br&gt;
• Memory access reports to highlight MMIO regions and suspicious reads/writes&lt;br&gt;
• Failure path reports to flag dead loops, error handlers, watchdog patterns&lt;br&gt;
• Per‑function summaries you can use as a navigation index&lt;br&gt;
• A run log that tells you exactly what happened (and what didn’t)&lt;/p&gt;

&lt;p&gt;Once you have those, your RE sessions become shorter and sharper. Instead of spending 45 minutes finding the boot path again, you open a graph, pick the interesting node, and move straight to the questions that matter.&lt;/p&gt;

&lt;h1&gt;
  
  
  Where my eBook fits: IDA Pro headless automation, taught as a workflow
&lt;/h1&gt;

&lt;p&gt;That gap—between “I can use IDA” and “I can automate IDA”—is exactly why I wrote my eBook:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zu4uyt6zz6963q5q4op.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zu4uyt6zz6963q5q4op.png" alt=" " width="464" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xushuran.gumroad.com/l/xkzecq" rel="noopener noreferrer"&gt;&lt;strong&gt;IDA Reverse Engineering Automation Kit&lt;/strong&gt;&lt;/a&gt; — a practical guide and solution kit for building a repeatable IDA Pro pipeline (GUI + headless) aimed at firmware/bare‑metal targets.&lt;/p&gt;

&lt;p&gt;Instead of treating RE like a purely manual art, the kit teaches an engineering workflow: configuration‑driven runs that produce predictable outputs. It also includes hands-on labs using a toy RISC‑V firmware so you can validate what the artifacts mean without guessing.&lt;/p&gt;

&lt;h1&gt;
  
  
  What you’ll be able to do after working through it
&lt;/h1&gt;

&lt;p&gt;• Run a full analysis pipeline in a single command (ideal for batch processing).&lt;br&gt;
• Export boot‑path call graphs in DOT/JSON so you can visualize control flow quickly.&lt;br&gt;
• Generate MMIO‑focused memory access reports to spot peripheral interactions fast.&lt;br&gt;
• Automatically detect failure loops / dead‑end paths to accelerate debugging and security review.&lt;br&gt;
• Customize a target config (entry points, memory maps, graph depth) and see how outputs change.&lt;/p&gt;

&lt;h1&gt;
  
  
  Who this is for
&lt;/h1&gt;

&lt;p&gt;• Firmware engineers debugging boot issues without full source context&lt;br&gt;
• Security researchers looking for verification gates, error handlers, and suspicious IO&lt;br&gt;
• Embedded engineers who want an “artifact-first” workflow that scales&lt;br&gt;
• Students who want to learn RE beyond screenshots—by running a pipeline and interpreting outputs&lt;/p&gt;

&lt;p&gt;If you’re curious, the best way to judge whether this style fits you is simple: ask yourself whether you’d rather spend your time clicking through the same discovery steps—or start each session with a clean set of generated facts.&lt;/p&gt;

&lt;h1&gt;
  
  
  References
&lt;/h1&gt;

&lt;p&gt;IDA is developed by &lt;a href="https://hex-rays.com/" rel="noopener noreferrer"&gt;Hex-Rays&lt;/a&gt;. Download IDA from Hex-Rays’ official site:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hex-rays.com/ida-home" rel="noopener noreferrer"&gt;IDA Home&lt;/a&gt; (for hobbyist/non-commercial use): download and purchase from the official IDA Home page on Hex-Rays (the page provides the purchase + download path).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hex-rays.com/ida-pro" rel="noopener noreferrer"&gt;IDA Pro&lt;/a&gt; (commercial): download via the My Hex-Rays customer portal after purchase (this is where you get the installer and license file / activation details).&lt;/p&gt;

&lt;p&gt;Tip: Always prefer the official Hex-Rays download sources to avoid tampered installers.&lt;/p&gt;

&lt;p&gt;As for my eBook Reverse Engineering Study Kit, You can purchase the eBook on Gumroad &lt;a href="https://xushuran.gumroad.com/l/xkzecq" rel="noopener noreferrer"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;! After purchase, Gumroad will email you the download link.&lt;/p&gt;

&lt;h1&gt;
  
  
  Closing thoughts
&lt;/h1&gt;

&lt;p&gt;Reverse engineering isn’t just for malware analysts. It’s an engineering tool for clarity. And like any tool, it becomes dramatically more powerful when you can automate the boring parts.&lt;/p&gt;

&lt;p&gt;If you want to learn how to build a repeatable IDA Pro workflow that generates real artifacts—call graphs, MMIO reports, failure paths—and do it in a way you can scale, my eBook is designed to be the shortest path from “I’m curious about RE” to “I can run a pipeline and get answers.”&lt;/p&gt;

</description>
      <category>software</category>
      <category>python</category>
      <category>programming</category>
      <category>reverseengineering</category>
    </item>
  </channel>
</rss>
