This example demonstrates running ExecuTorch inference on Arm Cortex-M with Ethos-U NPU acceleration using Zephyr RTOS, built and managed through the CMSIS Toolbox.
The example runs a simple Add model on the Arm Corstone-300 FVP (Fixed Virtual Platform) with Ethos-U55 NPU. It showcases:
- ExecuTorch runtime integration with Zephyr RTOS
- Ethos-U NPU delegate for hardware acceleration
- CMSIS Toolbox for build management
- Docker-based AI layer generation workflow
| Tool | Version | Purpose |
|---|---|---|
| Docker | Latest | AI layer build environment |
| VS Code | Latest | Development environment |
| Arm CMSIS Solution | ≥1.64.0 | Build and debug integration |
| Zephyr SDK | 0.17.x | Zephyr build tools |
The workspace will automatically prompt to install required extensions:
- Arm CMSIS Solution
- Arm CMSIS Debugger
├── executorch-example/ # Main application
│ ├── CMakeLists.txt # Zephyr application CMake
│ ├── prj.conf # Zephyr configuration
│ ├── Kconfig # Application Kconfig
│ ├── boards/ # Board overlays and FVP config
│ ├── model/ # Model files and toolchain
│ ├── src/ # Application source code
│ ├── ai_layer/ # Generated ExecuTorch libraries (after build)
│ └── zephyr/ # Zephyr module
│ ├── module.yml # Zephyr module definition
│ ├── .docker/ # Docker build environment
│ └── scripts/ # Build and workflow scripts
├── zephyr.csolution.yml # CMSIS solution file
└── README.md # This file
Build the Docker image containing the ExecuTorch build environment:
docker build -f executorch-example/zephyr/.docker/Dockerfile -t executorch-arm-builder .Run the Docker-based workflow to generate the ExecuTorch libraries and model:
docker run --rm -v $(pwd)/executorch-example:/workspace2 \
executorch-arm-builder:latest \
/workspace2/zephyr/scripts/local_workflow.shThis generates:
- Pre-compiled ExecuTorch static libraries
- Model converted to
.pteformat and C header - Build configuration and reports
Using VS Code with CMSIS extensions:
- Open the workspace in VS Code
- In the CMSIS view, open solution
zephyr.csolution.yml - Select target:
AVH-SSE-300and build type:Debug - Click Build Solution
Or use command line:
cbuild zephyr.csolution.yml --context executorch-example.Debug+AVH-SSE-300You can use the Run button in the CMSIS view, to start the preconfigured FVP run.
I executorch:arm_executor_runner.cpp:427] method_allocator_input: 16 bytes
I executorch:arm_executor_runner.cpp:428] method_allocator_executor: 0 bytes
I executorch:arm_executor_runner.cpp:438] Model executed successfully.
I executorch:arm_executor_runner.cpp:445] Model outputs:
I executorch:arm_executor_runner.cpp:452] output[0]: tensor scalar_type=Float numel=1
I executorch:arm_executor_runner.cpp:469] [0] = 2.000000
I executorch:arm_executor_runner.cpp:487] SUCCESS: Program complete, exiting.
The workspace includes pre-configured tasks:
| Task | Description |
|---|---|
Docker: Build Image |
Build the Docker image |
Docker: Run AI Layer Generation |
Generate AI layer libraries |
CMSIS Load+Run |
Run on Corstone-300 FVP (local) |
FVP Run |
Run on Corstone-300 FVP (Docker) |
Access via Terminal → Run Task or the CMSIS panel.
- Modify
executorch-example/model/aot_model.pywith your PyTorch model - Update operator list in
executorch-example/model/operators_minimal.txt - Regenerate AI layer (Step 2)
- Rebuild application (Step 3)
Edit executorch-example/prj.conf:
# Stack and heap
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_HEAP_MEM_POOL_SIZE=32768
# ExecuTorch memory pools
CONFIG_EXECUTORCH_METHOD_ALLOCATOR_POOL_SIZE=65536
CONFIG_EXECUTORCH_TEMP_ALLOCATOR_POOL_SIZE=262144