|
| 1 | +--- |
| 2 | +title: Deploy the project |
| 3 | +weight: 3 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## Prepare the target |
| 10 | + |
| 11 | +Before deploying the Template, confirm that the FRDM i.MX 93 board is reachable from your host and that it's ready for deployment: |
| 12 | + |
| 13 | +```bash |
| 14 | +topo health --target <user>@<target-ip> |
| 15 | +``` |
| 16 | +Replace `<target-ip>` with the IP address or hostname of your board. |
| 17 | + |
| 18 | +Resolve any errors before continuing. |
| 19 | + |
| 20 | +The target section should include successful checks similar to: |
| 21 | + |
| 22 | +```output |
| 23 | +Host |
| 24 | +---- |
| 25 | +Topo: ✅ (topo) |
| 26 | +SSH: ✅ (ssh) |
| 27 | +Curl: ✅ (curl) |
| 28 | +Container Engine: ✅ (docker) |
| 29 | +
|
| 30 | +Target |
| 31 | +------ |
| 32 | +Destination: ssh://<target-ip> |
| 33 | +Connectivity: ✅ |
| 34 | +Container Engine: ✅ (docker) |
| 35 | +Remoteproc Runtime: ✅ (remoteproc-runtime) |
| 36 | +Remoteproc Shim: ✅ (containerd-shim-remoteproc-v1) |
| 37 | +Hardware Info: ✅ (lscpu) |
| 38 | +Subsystem Driver (remoteproc): ✅ (imx-rproc) |
| 39 | +``` |
| 40 | + |
| 41 | +If `remoteproc-runtime` is missing, install it with Topo: |
| 42 | + |
| 43 | +```bash |
| 44 | +topo install remoteproc-runtime --target <user>@<target-ip> |
| 45 | +``` |
| 46 | + |
| 47 | +Run the health check again: |
| 48 | + |
| 49 | +```bash |
| 50 | +topo health --target <user>@<target-ip> |
| 51 | +``` |
| 52 | + |
| 53 | +## Reserve memory in the device tree |
| 54 | + |
| 55 | +The web application and Cortex-M33 firmware exchange data through reserved physical memory. The target device tree must reserve memory for the model/input buffer and for Ethos-U65. We are now goint to modify the device tree and reboot the target so that this modifications take place. |
| 56 | + |
| 57 | +{{% notice Warning %}} |
| 58 | +Back up the board's original device tree before modifying it. The exact boot partition can differ between Linux images, so check the paths on your board before copying files. |
| 59 | +{{< /notice >}} |
| 60 | + |
| 61 | +On your host, create a working directory and dump the live device tree from the target: |
| 62 | + |
| 63 | +```bash |
| 64 | +mkdir -p devicetree |
| 65 | +ssh <user>@<target-ip> 'cat /sys/firmware/fdt' > devicetree/live.dtb |
| 66 | +dtc -I dtb -O dts -o devicetree/live.dts devicetree/live.dtb |
| 67 | +``` |
| 68 | + |
| 69 | +Open `devicetree/live.dts` in an editor. |
| 70 | + |
| 71 | +Under `remoteproc-cm33`, add the CM33 power domain if it is not already present: |
| 72 | + |
| 73 | +```dts |
| 74 | +power-domains = <0x61>; |
| 75 | +``` |
| 76 | + |
| 77 | +Under `reserved-memory`, add the model memory range: |
| 78 | + |
| 79 | +```dts |
| 80 | +model@c0000000 { |
| 81 | + reg = <0x00 0xc0000000 0x00 0x400000>; |
| 82 | + no-map; |
| 83 | +}; |
| 84 | +``` |
| 85 | + |
| 86 | +Update the Ethos-U reserved-memory node so it is reserved and not reusable: |
| 87 | + |
| 88 | +```dts |
| 89 | +ethosu_region@A8000000 { |
| 90 | + compatible = "shared-dma-pool"; |
| 91 | + reg = <0x00 0xa8000000 0x00 0x8000000>; |
| 92 | + no-map; |
| 93 | + phandle = <0x60>; |
| 94 | +}; |
| 95 | +``` |
| 96 | + |
| 97 | +Add `iomem=relaxed` to `chosen.bootargs`. For example: |
| 98 | + |
| 99 | +```dts |
| 100 | +bootargs = "clk-imx93.mcore_booted console=ttyLP0,115200 earlycon root=/dev/mmcblk1p2 rootwait rw iomem=relaxed"; |
| 101 | +``` |
| 102 | + |
| 103 | +Build the patched device tree: |
| 104 | + |
| 105 | +```bash |
| 106 | +dtc -I dts -O dtb -o devicetree/patched.dtb devicetree/live.dts |
| 107 | +``` |
| 108 | + |
| 109 | +Copy it to the board: |
| 110 | + |
| 111 | +```bash |
| 112 | +scp devicetree/patched.dtb <user>@<target-ip>:/tmp/patched.dtb |
| 113 | +``` |
| 114 | + |
| 115 | +Install it on the board. Adjust the boot partition path if your image uses a different location: |
| 116 | + |
| 117 | +```bash |
| 118 | +ssh <user>@<target-ip> |
| 119 | +cp /run/media/boot-mmcblk1p1/imx93-11x11-frdm.dtb \ |
| 120 | + /run/media/boot-mmcblk1p1/imx93-11x11-frdm.dtb.bak |
| 121 | +cp /tmp/patched.dtb \ |
| 122 | + /run/media/boot-mmcblk1p1/imx93-11x11-frdm.dtb |
| 123 | +sync |
| 124 | +reboot |
| 125 | +``` |
| 126 | + |
| 127 | +After the board reboots, run the Topo health check again from the host: |
| 128 | + |
| 129 | +```bash |
| 130 | +topo health --target <user>@<target-ip> |
| 131 | +``` |
| 132 | + |
| 133 | +## Clone the Template |
| 134 | + |
| 135 | +Clone the Template onto your host: |
| 136 | + |
| 137 | +```bash |
| 138 | +topo clone https://github.com/Arm-Examples/topo-imx93-npu-deployment.git |
| 139 | +``` |
| 140 | + |
| 141 | +Topo prompts for optional build cache image arguments: |
| 142 | + |
| 143 | +```output |
| 144 | +EXECUTORCH_BASE_CACHE_IMAGE |
| 145 | +IMX93_RUNNER_BUILD_CACHE_IMAGE |
| 146 | +``` |
| 147 | + |
| 148 | +Accept the defaults unless you have your own cache images. |
| 149 | + |
| 150 | +Enter the project directory: |
| 151 | + |
| 152 | +```bash |
| 153 | +cd topo-imx93-npu-deployment |
| 154 | +``` |
| 155 | + |
| 156 | +## Deploy to the board |
| 157 | + |
| 158 | +Deploy the project to your target: |
| 159 | + |
| 160 | +```bash |
| 161 | +topo deploy --target <user>@<target-ip> |
| 162 | +``` |
| 163 | + |
| 164 | +If not pulling from the cache, the first build can take a long time and requires about 25 GB of free disk space. It downloads and builds ExecuTorch, the Arm GNU toolchain, MCUX SDK components, RPMsg-Lite, and the Cortex-M33 runner sources. Later builds are faster when Docker can reuse local cache layers or import the configured GHCR cache layers. |
| 165 | + |
| 166 | +During deployment, Topo builds the required images, transfers them to the target, starts the Cortex-M33 firmware through `remoteproc-runtime`, and starts the web application. |
| 167 | + |
| 168 | +When deployment succeeds, the output includes a successful service startup. You can also check the deployed services: |
| 169 | + |
| 170 | +```bash |
| 171 | +topo ps --target <user>@<target-ip> |
| 172 | +``` |
| 173 | + |
| 174 | +## Open the web application |
| 175 | + |
| 176 | +Open the web application in a browser: |
| 177 | + |
| 178 | +```output |
| 179 | +http://<target-ip>:3001 |
| 180 | +``` |
| 181 | + |
| 182 | +The application shows: |
| 183 | + |
| 184 | +- an image selector |
| 185 | +- a **Classify** button |
| 186 | +- board prerequisite checks |
| 187 | +- classification results |
| 188 | +- an expandable analysis section with runtime details |
| 189 | + |
| 190 | +Select an image from an ImageNet-supported class, then click **Classify**. A successful run returns top-1 and top-5 ImageNet classifications. |
| 191 | + |
| 192 | +If you need to use a different target port, set `WEBAPP_PORT` when deploying: |
| 193 | + |
| 194 | +```bash |
| 195 | +WEBAPP_PORT=3002 topo deploy --target <user>@<target-ip> |
| 196 | +``` |
| 197 | + |
| 198 | +Then open: |
| 199 | + |
| 200 | +```output |
| 201 | +http://<target-ip>:3002 |
| 202 | +``` |
| 203 | + |
| 204 | +You should see something similar to: |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | +## What you've accomplished |
| 210 | + |
| 211 | +You have prepared an FRDM i.MX 93 board for shared-memory NPU inference, deployed the `topo-imx93-npu-deployment` Template with Topo, started Cortex-M33 firmware through `remoteproc-runtime`, and used a browser-based application to run MobileNetV2 classification with Ethos-U65 acceleration. |
| 212 | +Next, you will review the toolchains used to build the model artifact, firmware runner, and web application. |
0 commit comments