|
| 1 | +# Using the MCUXpresso Example |
| 2 | + |
| 3 | +This example demonstrates how to build and run the ExecuTorch CIFARNet application for the NXP RT700 platform using the MCUXpresso SDK and the GNU Arm Embedded Toolchain. Before building the project, make sure that all required dependencies are installed and that the necessary environment variables are configured correctly. |
| 4 | + |
| 5 | +## 1. Install the Arm GNU Toolchain |
| 6 | + |
| 7 | +First, download the Arm GCC cross-compilation toolchain that is supported by the RT700 platform: |
| 8 | + |
| 9 | +```text |
| 10 | +https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz |
| 11 | +``` |
| 12 | + |
| 13 | +After extracting the archive, create an environment variable called `ARMGCC_DIR` that points to the root directory of the toolchain installation. The build scripts use this variable to locate the compiler, linker, and other required tools. |
| 14 | + |
| 15 | +Example on Linux: |
| 16 | + |
| 17 | +```bash |
| 18 | +export ARMGCC_DIR=/path/to/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi |
| 19 | +``` |
| 20 | + |
| 21 | +To verify the installation, you can run: |
| 22 | + |
| 23 | +```bash |
| 24 | +$ARMGCC_DIR/bin/arm-none-eabi-gcc --version |
| 25 | +``` |
| 26 | + |
| 27 | +The command should print the installed compiler version. |
| 28 | + |
| 29 | +## 2. Download the MCUXpresso SDK |
| 30 | + |
| 31 | +Next, download MCUXpresso SDK version **26.06** for the RT700 device family: |
| 32 | + |
| 33 | +```text |
| 34 | +https://mcuxpresso.nxp.com/builder?hw=MIMXRT700-EVK |
| 35 | +``` |
| 36 | + |
| 37 | +When generating the SDK package, make sure that you select: |
| 38 | + |
| 39 | +- **Toolchain:** ARMGCC |
| 40 | +- **SDK Layout:** Classic Layout |
| 41 | +- **Target Board:** MIMXRT700-EVK |
| 42 | + |
| 43 | +After extracting the SDK package, configure the `SdkRootDirPath` environment variable to point to the SDK root directory. |
| 44 | + |
| 45 | +Example on Linux: |
| 46 | + |
| 47 | +```bash |
| 48 | +export SdkRootDirPath=/path/to/SDK_26_06 |
| 49 | +``` |
| 50 | + |
| 51 | +The build system relies on this variable to locate board support packages, middleware components, startup code, linker scripts, and device-specific libraries. |
| 52 | + |
| 53 | +## 3. Build the Application |
| 54 | + |
| 55 | +Once both environment variables have been configured, build the project by executing the provided build script: |
| 56 | + |
| 57 | +```bash |
| 58 | +./run.sh |
| 59 | +``` |
| 60 | + |
| 61 | +The script configures the build environment, compiles the source code, links the application, and generates the executable image: |
| 62 | + |
| 63 | +```text |
| 64 | +executorch_cifarnet.elf |
| 65 | +``` |
| 66 | + |
| 67 | +If the build completes successfully, the ELF file will be available in the build output directory and ready for programming onto the target board. |
| 68 | + |
| 69 | +## 4. Flash the Application |
| 70 | + |
| 71 | +The generated application can be programmed onto the RT700 device using SEGGER J-Link tools. |
| 72 | + |
| 73 | +### Linux |
| 74 | + |
| 75 | +```bash |
| 76 | +echo "loadfile executorch_cifarnet.elf" | \ |
| 77 | +/opt/SEGGER/JLink_V796k/JLinkExe \ |
| 78 | + -IF SWD \ |
| 79 | + -speed auto \ |
| 80 | + -Device MIMXRT798S_M33_0 |
| 81 | +``` |
| 82 | + |
| 83 | +Before flashing, ensure that: |
| 84 | + |
| 85 | +- The board is powered on. |
| 86 | +- The J-Link debugger is connected to the target. |
| 87 | +- The SWD interface is available and correctly wired. |
| 88 | +- No other debugging application is currently using the J-Link connection. |
| 89 | + |
| 90 | +The programming process typically takes only a few seconds. Once the image has been loaded successfully, the application can be started directly from flash memory. |
| 91 | + |
| 92 | +## 5. Running the Example |
| 93 | + |
| 94 | +After the firmware is programmed, reset the board and open a serial terminal connected to the device's debug UART interface. The application will initialize the hardware, load the embedded CIFARNet model, and begin performing image inference. |
| 95 | + |
| 96 | +During execution, inference results and diagnostic messages are printed to the terminal. The included demonstration image contains a cat, and the model is expected to classify the image accordingly. |
| 97 | + |
| 98 | +A successful run produces output similar to the following: |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +This example serves as a basic validation that the ExecuTorch runtime, model integration, SDK configuration, and hardware platform are all functioning correctly. It can also be used as a starting point for evaluating custom neural network models and experimenting with on-device machine learning workloads on the RT700 platform. |
0 commit comments