|
| 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