KWS Inference
TFLite Micro keyword-spotting inference with CMSIS-NN kernels.
| Declared by the example author | Value |
|---|---|
| Tier | Integrations |
| Status | tested |
| Capabilities | ml, tflite, cmsis-nn, helia-rt |
| Boards tested | apollo510_evb |
Build it from a source checkout by name, because the positional app argument resolves
under ./examples:
nsx build kws_infer --board apollo510_evbThe rest of this page is the example’s own README, from
examples/kws_infer/.
End-to-end TFLite Micro inference demo on Apollo510, demonstrating:
- nsx_system modular init (one-call startup with preset config)
- nsx_mem memory placement (tensor arena in TCM, model weights in TCM)
- NsxPmuProfiler per-layer PMU profiling via TFLM’s MicroProfilerInterface
- ITM/SWO printf output at 1 MHz via JLink
Google Speech Commands KWS (12-class): silence, unknown, yes, no, up, down, left, right, on, off, stop, go.
- Input:
[1, 49, 10, 1]int8 - Output:
[1, 12]int8 - Ops: Conv2D, DepthwiseConv2D, AveragePool2D, FullyConnected, Reshape, Softmax
- Arena: ~20 KB of 64 KB allocated
- Inference: ~21 ms @ 192 MHz HP mode with I/D cache
cd neuralspotx/examples/kws_infernsx lock --app-dir .nsx configure --app-dir .nsx build --app-dir .Flash & View Output
Section titled “Flash & View Output”nsx flash --app-dir .nsx view --app-dir .System Init
Section titled “System Init”Uses nsx_system_init() with a modified development preset:
nsx_system_config_t cfg = nsx_system_development;cfg.skip_bsp_init = true; // skip BSP's 2-second delaynsx_system_init(&cfg); // → core, CPDLP, cache, HP mode, SpotMgr, ITMThis replaces ~60 lines of manual DCU/TPIU/ITM/cache/SpotManager init.
Key Files
Section titled “Key Files”| File | Purpose |
|---|---|
src/main.cc |
Application entry — system init, TFLM setup, inference loop |
src/kws_model_data.h |
Model weights as C array (in TCM via default .data) |
src/nsx_pmu_profiler.h |
Per-layer PMU profiler (TFLM MicroProfilerInterface) |
src/nsx_pmu_profiler.cc |
PMU profiler implementation — cycles, dcache misses, icache misses |
CMakeLists.txt |
Build config — links nsx::helia_rt source module + NSX modules |
Dependencies
Section titled “Dependencies”- ARM GCC 14.3 (
arm-none-eabi-gcc) - helia-rt (
nsx-helia-rt) at the packaged registry pin, built from source (release-with-logsvariant by default) - ns-cmsis-nn (
nsx-cmsis-nn) at the packaged registry pin, pulled in bynsx-helia-rt;nsx.lockrecords the exact tags - NSX modules:
nsx-core,nsx-power,nsx-pmu-armv8m(with the PMU API from the standalone module and the local SDK shim supplied bynsx-ambiq-sdk)