|
| 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 |
0 commit comments