Embedded Deep CNN (DCNN) keyword spotting pipeline running PyTorch models via the ExecuTorch runtime on Zephyr RTOS. Designed for bare-metal deployment on the Raspberry Pi Pico 2 with static memory planning (~84 KB RAM footprint).
cooper/
├── CMakeLists.txt # Application build rules and ExecuTorch linkage
├── prj.conf # Zephyr Kconfig profile
├── ml/ # Training & AOT compilation pipeline
│ ├── execuwake_training.ipynb# Model training notebook
│ ├── model.py # PyTorch DCNN architecture
│ ├── convert.py # ExecuTorch .pte export & memory planning
│ ├── pte_to_array.py # Flatbuffer byte array generator
│ └── models/ # Checkpoints (.pth) and exported flatbuffers (.pte)
└── src/ # Firmware execution engine
├── main.c # Application entry point
└── dcnn/ # Runtime wrapper & static memory pools
- Train Model: Execute
execuwake_training.ipynbto generatemodels/best_kws_dscnn.pth. - Export to ExecuTorch: Run
convert.pyto compile the PyTorch model to flatbuffer format (kws_dscnn_portable.pte). - Generate C Header: Run
pte_to_array.pyto embed the binary array directly intosrc/dcnn/model.c.
Compile the firmware for the RP2350 Cortex-M33 target with CDC-ACM USB console support enabled:
west build -p always -b rpi_pico2/rp2350a/m33 -S cdc-acm-console .
To flash:
- Hold BOOTSEL while plugging in the Pico 2 via USB.
- Drag and drop
build/zephyr/zephyr.uf2onto the mounted volume.
- Identify the assigned serial port on macOS/Linux:
ls /dev/cu.usbmodem*
- Connect to the terminal stream:
minicom -D /dev/cu.usbmodem101 -b 115200