Skip to content

Commit c39c426

Browse files
committed
docs(learning-paths/observing-ethos-u-on-nxp): add deployment guide and assets (Deploy Executorch runtime)
1 parent 2b30581 commit c39c426

22 files changed

Lines changed: 1517 additions & 0 deletions
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Overview
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Hardware Overview - NXP's FRDM i.MX 93 Board
10+
11+
Selecting the best hardware for machine learning (ML) models depends on effective tools. You can visualize ML performance early in the development cycle by using NXP's [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) board.
12+
13+
<center>
14+
<iframe src='//players.brightcove.net/4089003392001/Sk5u9ln3l_default/index.html?videoId=6366294691112' allowfullscreen frameborder=0 width="800" height="400"></iframe>
15+
16+
*Unboxing NXP's FRDM i.MX 93 board*
17+
</center>
18+
19+
![NXP FRDM i.MX 93 Board SoC Highlighted alt-text#center](./nxp-frdm-imx-93-board-soc-highlighted.png "Arm Ethos-U65 NPU location")
20+
21+
### NXP's FRDM i.MX 93 Processor Decoded
22+
23+
![i.MX 93 Processor SoC alt-text#center](./imx-93-application-processor-soc.png "NXP's FRDM i.MX 93 processor")
24+
25+
**NXP's Processor Labeling Convention:**
26+
|Line|Meaning|
27+
|----|-------|
28+
|MIMX9352|• MI – Microcontroller IC<br>• MX93 – i.MX 93 family<br>• 52 – Variant:<br>• Dual-core Arm Cortex-A55<br> • Single Cortex-M33<br>• Includes **Ethos-U65 NPU**|
29+
|CVVXMAB|• C - Commercial temperature grade (0°C to 95°C)<br>• VVX - Indicates package type and pinout (BGA, pitch, etc.)<br>• MAB - Specific configuration (e.g., NPU present, security level, memory interfaces)
30+
|
31+
|1P87F|• Silicon mask set identifier|
32+
|SBBM2410E|• NXP traceability code|
33+
34+
## Hardware Overview - NXP's MCU-Link Pro Debug Probe
35+
36+
The [MCU-Link Pro Debug Probe](https://www.nxp.com/design/design-center/software/software-library/mcu-link-pro-debug-probe:MCU-LINK-PRO) is a debugging tool for NXP boards. NXP's [MCUXpresso Integrated Development Environment (IDE)](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE) depends on this debug probe, when deploying ExecuTorch models to the above FRDM i.MX 93 board.
37+
38+
![NXP MCU-Link Pro Debug Probe alt-text#center](./mcu-link-pro-guide-img.jpg "NXP's MCU-Link Pro Debug Probe")
39+
40+
## Software Overview - NXP's MCUXpresso IDE
41+
42+
NXP generously provides free software for working with their boards, the [MCUXpresso Integrated Development Environment (IDE)](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE). In this learning path, you will instead use [MCUXpresso for Visual Studio Code](https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-for-visual-studio-code:MCUXPRESSO-VSC).
43+
44+
## Software Overview - Visual Studio Code
45+
46+
[Visual Studio Code](https://code.visualstudio.com/) is a free integrated development environment provided by Microsoft. It is platform independent, full featured, and accomodating of many engineering frameworks. You will use Visual Studio Code to both configure NXP's software and connect to NXP's hardware.
47+
48+
## Software Overview - TinyML
49+
50+
This Learning Path uses TinyML. TinyML is machine learning tailored to function on devices with limited resources, constrained memory, low power, and fewer processing capabilities.
51+
52+
For a learning path focused on creating and deploying your own TinyML models, please see [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm/)
53+
54+
## Benefits and applications
55+
56+
NPUs, like Arm's [Ethos-U65](https://www.arm.com/products/silicon-ip-cpu/ethos/ethos-u65) NPU are available on physical devices specifically made for developers. Development boards like NXP's [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) also connect to displays via a HDMI cable. Additionally the board accepts video inputs. This is useful for for ML performance visualization due to:
57+
- visual confirmation that your ML model is running on the physical device,
58+
- image and video inputs for computer vision models running on the device,
59+
- clearly indicated instruction counts,
60+
- confirmation of total execution time and
61+
- visually appealing output for prototypes and demos.
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
title: Deploy and test on FRDM-IMX93
3+
weight: 11
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Connect to the FRDM-IMX93 board
10+
11+
The FRDM-IMX93 board runs Linux on the Cortex-A55 cores. You need network or serial access to deploy the firmware.
12+
13+
Find your board's IP address using the serial console or check your router's DHCP leases.
14+
15+
Connect via SSH:
16+
17+
```bash
18+
ssh root@192.168.1.24
19+
```
20+
21+
Replace `192.168.1.24` with your board's IP address.
22+
23+
## Copy the firmware to the board
24+
25+
Copy the built firmware file to the board's firmware directory:
26+
27+
```bash
28+
scp build/executorch_runner_cm33.elf root@192.168.1.24:/lib/firmware/
29+
```
30+
31+
Verify the file was copied:
32+
33+
```bash { command_line="root@frdm-imx93" output_lines="2" }
34+
ls -lh /lib/firmware/executorch_runner_cm33.elf
35+
-rw-r--r-- 1 root root 601K Oct 24 10:30 /lib/firmware/executorch_runner_cm33.elf
36+
```
37+
38+
## Load the firmware on Cortex-M33
39+
40+
The Cortex-M33 firmware is managed by the RemoteProc framework running on Linux.
41+
42+
Stop any currently running firmware:
43+
44+
```bash { command_line="root@frdm-imx93" }
45+
echo stop > /sys/class/remoteproc/remoteproc0/state
46+
```
47+
48+
Set the new firmware:
49+
50+
```bash { command_line="root@frdm-imx93" }
51+
echo executorch_runner_cm33.elf > /sys/class/remoteproc/remoteproc0/firmware
52+
```
53+
54+
Start the Cortex-M33 with the new firmware:
55+
56+
```bash { command_line="root@frdm-imx93" }
57+
echo start > /sys/class/remoteproc/remoteproc0/state
58+
```
59+
60+
Verify the firmware loaded successfully:
61+
62+
```bash { command_line="root@frdm-imx93" output_lines="2-5" }
63+
dmesg | grep remoteproc | tail -n 5
64+
[12345.678] remoteproc remoteproc0: powering up imx-rproc
65+
[12345.679] remoteproc remoteproc0: Booting fw image executorch_runner_cm33.elf, size 614984
66+
[12345.680] remoteproc remoteproc0: header-less resource table
67+
[12345.681] remoteproc remoteproc0: remote processor imx-rproc is now up
68+
```
69+
70+
The message "remote processor imx-rproc is now up" confirms successful loading.
71+
72+
## Load a model to DDR memory
73+
74+
The executor_runner loads `.pte` model files from DDR memory at address 0x80100000.
75+
76+
Copy your `.pte` model to the board:
77+
78+
```bash
79+
scp model.pte root@192.168.1.24:/tmp/
80+
```
81+
82+
Write the model to DDR memory:
83+
84+
```bash { command_line="root@frdm-imx93" }
85+
dd if=/tmp/model.pte of=/dev/mem bs=1M seek=2049
86+
```
87+
88+
The seek value of 2049 corresponds to address 0x80100000 (2049 MB = 0x801 in hex).
89+
90+
Verify the model was written:
91+
92+
```bash { command_line="root@frdm-imx93" output_lines="2-5" }
93+
xxd -l 64 -s 0x80100000 /dev/mem
94+
80100000: 504b 0304 1400 0000 0800 0000 2100 a3b4 PK..........!...
95+
80100010: 7d92 5801 0000 6c04 0000 1400 0000 7661 }.X...l.......va
96+
80100020: 6c75 652f 7061 7261 6d73 2e70 6b6c 6500 lue/params.pkl.
97+
80100030: ed52 cd4b 0241 1cfd 66de 49b6 9369 1ad9 .R.K.A..f.I..i..
98+
```
99+
100+
Non-zero bytes confirm the model is present in memory.
101+
102+
## Monitor Cortex-M33 output
103+
104+
The executor_runner outputs debug information via UART. Connect a USB-to-serial adapter to the M33 UART pins on the FRDM board.
105+
106+
Open a serial terminal (115200 baud, 8N1):
107+
108+
```bash
109+
screen /dev/ttyUSB0 115200
110+
```
111+
112+
On macOS:
113+
114+
```bash
115+
screen /dev/tty.usbserial-* 115200
116+
```
117+
118+
You should see output from the ExecuTorch runtime:
119+
120+
```output
121+
ExecuTorch Runtime Starting...
122+
Loading model from 0x80100000
123+
Model loaded successfully
124+
Initializing Ethos-U NPU delegate
125+
NPU initialized
126+
Running inference...
127+
Inference complete: 45.2ms
128+
```
129+
130+
{{% notice Tip %}}
131+
If you don't see UART output, verify the serial connection settings (115200 baud, 8N1) and check that the UART pins are correctly connected.
132+
{{% /notice %}}
133+
134+
## Test inference
135+
136+
The executor_runner automatically runs inference when it starts. Check the UART output for inference results and timing.
137+
138+
To restart inference, you can reload the firmware:
139+
140+
```bash { command_line="root@frdm-imx93" }
141+
echo stop > /sys/class/remoteproc/remoteproc0/state
142+
echo start > /sys/class/remoteproc/remoteproc0/state
143+
```
144+
145+
Monitor the UART console to see the new inference run.
146+
147+
## Verify deployment success
148+
149+
Confirm your deployment is working correctly:
150+
151+
1. **RemoteProc status shows "running":**
152+
153+
```bash { command_line="root@frdm-imx93" output_lines="2" }
154+
cat /sys/class/remoteproc/remoteproc0/state
155+
running
156+
```
157+
158+
2. **Firmware is loaded:**
159+
160+
```bash { command_line="root@frdm-imx93" output_lines="2" }
161+
cat /sys/class/remoteproc/remoteproc0/firmware
162+
executorch_runner_cm33.elf
163+
```
164+
165+
3. **Model is in DDR memory** (non-zero bytes at 0x80100000)
166+
167+
4. **UART shows inference output** with timing information
168+
169+
## Troubleshooting
170+
171+
**RemoteProc fails to load firmware:**
172+
173+
Check file permissions:
174+
175+
```bash { command_line="root@frdm-imx93" }
176+
chmod 644 /lib/firmware/executorch_runner_cm33.elf
177+
```
178+
179+
Verify the file exists:
180+
181+
```bash { command_line="root@frdm-imx93" }
182+
ls -la /lib/firmware/executorch_runner_cm33.elf
183+
```
184+
185+
**Model not found error:**
186+
187+
Verify the model was written to memory:
188+
189+
```bash { command_line="root@frdm-imx93" }
190+
xxd -l 256 -s 0x80100000 /dev/mem | head
191+
```
192+
193+
If all zeros, re-run the `dd` command to write the model.
194+
195+
**No UART output:**
196+
197+
Check the serial connection:
198+
- Baud rate: 115200
199+
- Data bits: 8
200+
- Parity: None
201+
- Stop bits: 1
202+
203+
Try a different USB port or serial terminal program.
204+
205+
**Firmware crashes or hangs:**
206+
207+
Check kernel logs for errors:
208+
209+
```bash { command_line="root@frdm-imx93" }
210+
dmesg | grep -i error | tail
211+
```
212+
213+
This might indicate memory configuration issues. Reduce the memory pool sizes in `CMakeLists.txt` and rebuild.
214+
215+
## Update the firmware
216+
217+
To deploy a new version of the firmware:
218+
219+
1. Build the updated firmware on your development machine
220+
2. Copy to the board: `scp build/executorch_runner_cm33.elf root@<board-ip>:/lib/firmware/`
221+
3. Restart RemoteProc:
222+
223+
```bash { command_line="root@frdm-imx93" }
224+
echo stop > /sys/class/remoteproc/remoteproc0/state
225+
echo start > /sys/class/remoteproc/remoteproc0/state
226+
```
227+
228+
4. Monitor UART output to verify the new firmware is running
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
# User change
3+
title: "Deploy the ExecuTorch Files to the NXP Board"
4+
5+
weight: 12 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
11+
1. Copy the `executor_runner_aarch64_linux_gnu` and `mv2_arm.pte` files to the NXP board using a USB thumb drive:
12+
13+
{{% notice macOS %}}
14+
15+
First copy the two files from your Docker container to your local machine:
16+
```bash
17+
docker cp <containerId>:/executorch/examples/arm/executor_runner_aarch64_linux_gnu/cmake-out/executor_runner_aarch64_linux_gnu .
18+
docker cp <containerId>:/path/to/executorch/mv2/mv2_arm.pte .
19+
```
20+
21+
{{% /notice %}}
22+
23+
- Transfer the two files from your computer to the thumb drive (drag-and-drop, etc.)
24+
- Transfer the two files from the thumb drive to the NXP board:
25+
- Insert the USB thumb drive into the NXP board's USB A port
26+
- Mount the thumb drive and then copy the files to the board:
27+
```bash { output_lines = "1" }
28+
# Execute these commands on the board, individually
29+
mount /dev/sda1 /mnt
30+
cp /mnt/executor_runner_aarch64_linux_gnu .
31+
cp /mnt/mv2_arm.pte .
32+
```
33+
34+
- [optional] Unmount the thumbdrive and then remove it from the NXP board
35+
```bash
36+
umount /mnt
37+
```
38+
39+
2. Run inference, executing all of the following commands on the NXP board:
40+
- Enable debugging and profiling, logs should appear in `/sys/class/ethosu`:
41+
```bash
42+
export ET_LOG_LEVEL=debug
43+
```
44+
45+
- Make sure the `executor_runner_aarch64_linux_gnu` is executable:
46+
```bash
47+
chmod +x ./executor_runner_aarch64_linux_gnu
48+
```
49+
50+
- Run inference:
51+
```bash
52+
./executor_runner_aarch64_linux_gnu --model_path=mv2_arm.pte
53+
```
54+
55+
The NXP output should be similar to an [Arm Fixed Virtual Platform's output](http://localhost:1313/learning-paths/embedded-and-microcontrollers/visualizing-ethos-u-performance/6-evaluate-output/) (see section "Observe Test Batch Performance"):
56+
57+
```bash { output_lines = "1-3" }
58+
Model loaded
59+
Running method forward...
60+
Inference complete. Output: [class logits]
61+
```
62+
63+
3. Validate correctness:
64+
- Compare the output logits from i.MX93 to those you got on FVP
65+
- They should match closely (within quantization tolerance)

0 commit comments

Comments
 (0)