Model Onboarding on MCU
This guide covers the complete workflow for integrating a TensorFlow Lite Micro (TFLM) model into the Q2390 / IQ2390 MCU firmware for inference latency benchmarking.Target Platform
| Item | Details |
|---|---|
| Board | Q2390 / IQ2390 |
| MCU CPU | RISC-V SiFive E6 |
| OS | Zephyr RTOS 4.3.0 |
| Toolchain | SDLLVM Clang 21.1.4 |
| RAM | 3 MB total (all code and data loaded to RAM โ no XIP flash) |
| Debug interface | Lauterbach T32 over RISC-V JTAG |
Application Development Workflow
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ โ โ โ
โ 1. Model โ โ 2. TFLM Runtime โ โ 3. Flashing & โ
โ Preparation โโโโโโโโโโบโ Integration โโโโโโโโโโบโ Validation โ
โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Build Keras CNN โ โ โข Clone tflite-micro โ โ โข adb push .mbn โ
โ โข Export int8 TFLite โ โ โข Wire LLVM libc++ โ โ โข Verify remoteproc โ
โ โข Quantize inputs โ โ โข Create infer module โ โ state = running โ
โ โข Flatten with xxd โ โ โข Wire main.c + CMake โ โ โข T32: read latency โ
โ โ โ โข Build firmware โ โ (g_tfli_avg_us ยตs) โ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
HOST HOST ON-DEVICE
xxd step converts the model and input binary files produced in Phase 1 into C arrays (model_data.cpp, input_data.cpp) that are compiled directly into the firmware in Phase 2.
Prerequisites
Host Machine
| Requirement | Purpose |
|---|---|
| Linux machine (Ubuntu 22.04) | Primary host environment โ all build and model preparation steps run on Linux |
| Python 3.x | Model export and input generation for example application |
| MCU firmware workspace (already cloned, configured and compiled) | Compiling the Zephyr firmware |
xxd (standard Unix utility) | Flattening model and input binaries into C arrays |
adb (Android Debug Bridge) | Flashing firmware binaries to the Target Hardware |
| Lauterbach T32 software | Reading inference results and RAM console output over JTAG |
Target Hardware
| Requirement | Purpose |
|---|---|
| Q2390 / IQ2390 board | The target MCU running the TFLM firmware. Make sure MCU is up and running |
| Lauterbach T32 JTAG probe | Connected to the board |
| USB connection to host | Required by adb for flashing firmware |
Phases in This Guide
| Phase | Description |
|---|---|
| 1. Model Preparation | Build the reference 1D-CNN model, export to int8 TFLite, and produce MCU-ready C byte arrays |
| 2. TFLM Runtime Integration | Clone TFLM, wire the C++ toolchain, create the inference module, and register it in firmware |
| 3. Flashing and Validation | Flash firmware onto target, verify the LPAI subsystem is running, and read inference latency from T32 |

