Skip to content

Commit fdefda9

Browse files
authored
Merge pull request #2484 from fidel-makatia/main
Observing-ethos-u-on-nxp
2 parents 1590a3b + e5e1179 commit fdefda9

14 files changed

Lines changed: 1266 additions & 0 deletions
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
## Software Overview - NXP's MCUXpresso IDE
35+
36+
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).
37+
38+
## Software Overview - Visual Studio Code
39+
40+
[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.
41+
42+
## Software Overview - TinyML.
43+
44+
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.
45+
46+
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/)
47+
48+
## Benefits and applications
49+
50+
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:
51+
- visual confirmation that your ML model is running on the physical device
52+
- image and video inputs for computer vision models running on the device
53+
- clearly indicated instruction counts
54+
- confirmation of total execution time and
55+
- visually appealing output for prototypes and demos
Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
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+
{{< tabpane code=false >}}
18+
{{< tab header="Windows/Linux" >}}
19+
```bash
20+
ssh root@192.168.1.24
21+
```
22+
23+
Alternative with PuTTY on Windows:
24+
- Host: `192.168.1.24`
25+
- Port: `22`
26+
- Connection type: SSH
27+
- Username: `root`
28+
{{< /tab >}}
29+
{{< tab header="macOS" >}}
30+
```bash
31+
ssh root@192.168.1.24
32+
```
33+
{{< /tab >}}
34+
{{< /tabpane >}}
35+
36+
Replace `192.168.1.24` with your board's IP address.
37+
38+
## Copy the firmware to the board
39+
40+
Copy the built firmware file to the board's firmware directory:
41+
42+
{{< tabpane code=false >}}
43+
{{< tab header="Windows/Linux" >}}
44+
```bash
45+
scp debug/executorch_runner_cm33.elf root@192.168.1.24:/lib/firmware/
46+
```
47+
{{< /tab >}}
48+
{{< tab header="macOS" >}}
49+
```bash
50+
scp debug/executorch_runner_cm33.elf root@192.168.1.24:/lib/firmware/
51+
```
52+
{{< /tab >}}
53+
{{< /tabpane >}}
54+
55+
Verify the file was copied:
56+
57+
```bash { command_line="root@frdm-imx93" output_lines="2" }
58+
ls -lh /lib/firmware/executorch_runner_cm33.elf
59+
-rw-r--r-- 1 root root 601K Oct 24 10:30 /lib/firmware/executorch_runner_cm33.elf
60+
```
61+
62+
## Load the firmware on Cortex-M33
63+
64+
The Cortex-M33 firmware is managed by the RemoteProc framework running on Linux.
65+
66+
Stop any currently running firmware:
67+
68+
```bash { command_line="root@frdm-imx93" }
69+
echo stop > /sys/class/remoteproc/remoteproc0/state
70+
```
71+
72+
Set the new firmware:
73+
74+
```bash { command_line="root@frdm-imx93" }
75+
echo executorch_runner_cm33.elf > /sys/class/remoteproc/remoteproc0/firmware
76+
```
77+
78+
Start the Cortex-M33 with the new firmware:
79+
80+
```bash { command_line="root@frdm-imx93" }
81+
echo start > /sys/class/remoteproc/remoteproc0/state
82+
```
83+
84+
Verify the firmware loaded successfully:
85+
86+
```bash { command_line="root@frdm-imx93" output_lines="2-5" }
87+
dmesg | grep remoteproc | tail -n 5
88+
[12345.678] remoteproc remoteproc0: powering up imx-rproc
89+
[12345.679] remoteproc remoteproc0: Booting fw image executorch_runner_cm33.elf, size 614984
90+
[12345.680] remoteproc remoteproc0: header-less resource table
91+
[12345.681] remoteproc remoteproc0: remote processor imx-rproc is now up
92+
```
93+
94+
The message "remote processor imx-rproc is now up" confirms successful loading.
95+
96+
## Load a model to DDR memory
97+
98+
The executor_runner loads `.pte` model files from DDR memory at address 0x80100000.
99+
100+
Copy your `.pte` model to the board:
101+
102+
{{< tabpane code=false >}}
103+
{{< tab header="Windows/Linux" >}}
104+
```bash
105+
scp model.pte root@192.168.1.24:/tmp/
106+
```
107+
{{< /tab >}}
108+
{{< tab header="macOS" >}}
109+
```bash
110+
scp model.pte root@192.168.1.24:/tmp/
111+
```
112+
{{< /tab >}}
113+
{{< /tabpane >}}
114+
115+
Write the model to DDR memory:
116+
117+
```bash { command_line="root@frdm-imx93" }
118+
dd if=/tmp/model.pte of=/dev/mem bs=1M seek=2049
119+
```
120+
121+
The seek value of 2049 corresponds to address 0x80100000 (2049 MB = 0x801 in hex).
122+
123+
Verify the model was written:
124+
125+
```bash { command_line="root@frdm-imx93" output_lines="2-5" }
126+
xxd -l 64 -s 0x80100000 /dev/mem
127+
80100000: 504b 0304 1400 0000 0800 0000 2100 a3b4 PK..........!...
128+
80100010: 7d92 5801 0000 6c04 0000 1400 0000 7661 }.X...l.......va
129+
80100020: 6c75 652f 7061 7261 6d73 2e70 6b6c 6500 lue/params.pkl.
130+
80100030: ed52 cd4b 0241 1cfd 66de 49b6 9369 1ad9 .R.K.A..f.I..i..
131+
```
132+
133+
Non-zero bytes confirm the model is present in memory.
134+
135+
## Monitor Cortex-M33 output
136+
137+
The executor_runner outputs debug information via UART. Connect a USB-to-serial adapter to the M33 UART pins on the FRDM board.
138+
139+
Open a serial terminal (115200 baud, 8N1):
140+
141+
{{< tabpane code=false >}}
142+
{{< tab header="Windows/Linux" >}}
143+
```bash
144+
screen /dev/ttyUSB0 115200
145+
```
146+
147+
Alternative with minicom:
148+
```bash
149+
minicom -D /dev/ttyUSB0 -b 115200
150+
```
151+
{{< /tab >}}
152+
{{< tab header="macOS" >}}
153+
```bash
154+
screen /dev/tty.usbserial-* 115200
155+
```
156+
157+
Alternative with minicom:
158+
```bash
159+
minicom -D /dev/tty.usbserial-* -b 115200
160+
```
161+
{{< /tab >}}
162+
{{< /tabpane >}}
163+
164+
You should see output from the ExecuTorch runtime:
165+
166+
```output
167+
ExecuTorch Runtime Starting...
168+
Loading model from 0x80100000
169+
Model loaded successfully
170+
Initializing Ethos-U NPU delegate
171+
NPU initialized
172+
Running inference...
173+
Inference complete: 45.2ms
174+
```
175+
176+
{{% notice Tip %}}
177+
If you don't see UART output, verify the serial connection settings (115200 baud, 8N1) and check that the UART pins are correctly connected.
178+
{{% /notice %}}
179+
180+
## Test inference
181+
182+
The executor_runner automatically runs inference when it starts. Check the UART output for inference results and timing.
183+
184+
To restart inference, you can reload the firmware:
185+
186+
```bash { command_line="root@frdm-imx93" }
187+
echo stop > /sys/class/remoteproc/remoteproc0/state
188+
echo start > /sys/class/remoteproc/remoteproc0/state
189+
```
190+
191+
Monitor the UART console to see the new inference run.
192+
193+
## Verify deployment success
194+
195+
Confirm your deployment is working correctly:
196+
197+
1. **RemoteProc status shows "running":**
198+
199+
```bash { command_line="root@frdm-imx93" output_lines="2" }
200+
cat /sys/class/remoteproc/remoteproc0/state
201+
running
202+
```
203+
204+
2. **Firmware is loaded:**
205+
206+
```bash { command_line="root@frdm-imx93" output_lines="2" }
207+
cat /sys/class/remoteproc/remoteproc0/firmware
208+
executorch_runner_cm33.elf
209+
```
210+
211+
3. **Model is in DDR memory** (non-zero bytes at 0x80100000)
212+
213+
4. **UART shows inference output** with timing information
214+
215+
## Troubleshooting
216+
217+
**RemoteProc fails to load firmware:**
218+
219+
Check file permissions:
220+
221+
```bash { command_line="root@frdm-imx93" }
222+
chmod 644 /lib/firmware/executorch_runner_cm33.elf
223+
```
224+
225+
Verify the file exists:
226+
227+
```bash { command_line="root@frdm-imx93" }
228+
ls -la /lib/firmware/executorch_runner_cm33.elf
229+
```
230+
231+
**Model not found error:**
232+
233+
Verify the model was written to memory:
234+
235+
```bash { command_line="root@frdm-imx93" }
236+
xxd -l 256 -s 0x80100000 /dev/mem | head
237+
```
238+
239+
If all zeros, re-run the `dd` command to write the model.
240+
241+
**No UART output:**
242+
243+
Check the serial connection:
244+
- Baud rate: 115200
245+
- Data bits: 8
246+
- Parity: None
247+
- Stop bits: 1
248+
249+
Try a different USB port or serial terminal program.
250+
251+
**Firmware crashes or hangs:**
252+
253+
Check kernel logs for errors:
254+
255+
```bash { command_line="root@frdm-imx93" }
256+
dmesg | grep -i error | tail
257+
```
258+
259+
This might indicate memory configuration issues. Reduce the memory pool sizes in `CMakeLists.txt` and rebuild.
260+
261+
## Update the firmware
262+
263+
To deploy a new version of the firmware:
264+
265+
1. Build the updated firmware on your development machine
266+
2. Copy to the board:
267+
268+
{{< tabpane code=false >}}
269+
{{< tab header="Windows/Linux" >}}
270+
```bash
271+
scp debug/executorch_runner_cm33.elf root@<board-ip>:/lib/firmware/
272+
```
273+
{{< /tab >}}
274+
{{< tab header="macOS" >}}
275+
```bash
276+
scp debug/executorch_runner_cm33.elf root@<board-ip>:/lib/firmware/
277+
```
278+
{{< /tab >}}
279+
{{< /tabpane >}}
280+
281+
3. Restart RemoteProc:
282+
283+
```bash { command_line="root@frdm-imx93" }
284+
echo stop > /sys/class/remoteproc/remoteproc0/state
285+
echo start > /sys/class/remoteproc/remoteproc0/state
286+
```
287+
288+
4. Monitor UART output to verify the new firmware is running

0 commit comments

Comments
 (0)