Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions docs/source/backends/nxp/nxp-mcuxpresso-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Using the MCUXpresso Example

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.

## 1. Install the Arm GNU Toolchain

First, download the Arm GCC cross-compilation toolchain that is supported by the RT700 platform:

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

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.

Example on Linux:

```bash
export ARMGCC_DIR=/path/to/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi
```

To verify the installation, you can run:

```bash
$ARMGCC_DIR/bin/arm-none-eabi-gcc --version
```

The command should print the installed compiler version.

## 2. Download the MCUXpresso SDK

Next, download MCUXpresso SDK version **26.06** for the RT700 device family:

```text
https://mcuxpresso.nxp.com/builder?hw=MIMXRT700-EVK
```

When generating the SDK package, make sure that you select:

- **Toolchain:** ARMGCC
- **SDK Layout:** Classic Layout
- **Target Board:** MIMXRT700-EVK

After extracting the SDK package, configure the `SdkRootDirPath` environment variable to point to the SDK root directory.

Example on Linux:

```bash
export SdkRootDirPath=/path/to/SDK_26_06
```

The build system relies on this variable to locate board support packages, middleware components, startup code, linker scripts, and device-specific libraries.

## 3. Build the Application

Once both environment variables have been configured, build the project by executing the provided build script:

```bash
cd examples/nxp/mcuxpresso/imxrt700/executorch_cifarnet
./run.sh
```

The script configures the build environment, compiles the source code, links the application, and generates the executable image:

```text
executorch_cifarnet.elf
```

If the build completes successfully, the ELF file will be available in the build output directory and ready for programming onto the target board.

## 4. Flash the Application

The generated application can be programmed onto the RT700 device using SEGGER J-Link tools.

### Linux

```bash
echo "loadfile executorch_cifarnet.elf" | \
/opt/SEGGER/JLink_V796k/JLinkExe \
-IF SWD \
-speed auto \
-Device MIMXRT798S_M33_0
```

Before flashing, ensure that:

- The board is powered on.
- The J-Link debugger is connected to the target.
- The SWD interface is available and correctly wired.
- No other debugging application is currently using the J-Link connection.

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.

## 5. Running the Example

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.

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.

A successful run produces output similar to the following:

![example](terminal.png "Example")

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.
5 changes: 5 additions & 0 deletions docs/source/backends/nxp/nxp-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ For more finegrained tutorial, visit [this manual page](https://mcuxpresso.nxp.c
For guideline how to update the eIQ Neutron Runtime on MCUXpresso SDK, follow the instructions from the eIQ Neutron SDK package `docs/NeutronSDKUserGuide.md` available
here https://www.nxp.com/design/design-center/software/eiq-ai-development-environment/eiq-toolkit-for-end-to-end-model-development-and-deployment:EIQ-TOOLKIT.

## Using the MCUXpresso Example

[This page](nxp-mcuxpresso-example.md) demonstrates how to build and run the ExecuTorch CIFARNet example from MCUXpresso SDK.


## Reference

**→{doc}`nxp-partitioner` — Partitioner options.**
Expand Down
Binary file added docs/source/backends/nxp/terminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2026 NXP
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

cmake_minimum_required(VERSION 3.10.0)

# THE VERSION NUMBER
set(MCUXPRESSO_CMAKE_FORMAT_MAJOR_VERSION 2)
set(MCUXPRESSO_CMAKE_FORMAT_MINOR_VERSION 0)

set(CMAKE_EXECUTABLE_LIBRARY_PREFIX)
set(CMAKE_EXECUTABLE_LIBRARY_SUFFIX)

# CURRENT DIRECTORY
set(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR})

set(EXECUTABLE_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE})
set(LIBRARY_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE})

project(executorch_cifarnet)

enable_language(ASM)

set(MCUX_BUILD_TYPES flash_debug flash_release)

set(MCUX_SDK_PROJECT_NAME executorch_cifarnet.elf)

set(EXECUTORCH_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)

file(
GLOB
example_sources
${SdkRootDirPath}/boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0/*
)

add_executable(
${MCUX_SDK_PROJECT_NAME}
${example_sources}
${EXECUTORCH_ROOT_DIR}/backends/nxp/runtime/NeutronBackend.cpp
${SdkRootDirPath}/middleware/tfm/tf-m/platform/ext/common/syscalls_stub.c
)

add_config_file(
${SdkRootDirPath}/devices/MIMXRT798S/mcuxpresso/startup_MIMXRT798S_cm33_core0.c
""
device_startup.MIMXRT798S
)

include(${SdkRootDirPath}/tools/cmake_toolchain_files/mcux_config.cmake)
include(config.cmake)
include(flags.cmake)
include(${SdkRootDirPath}/devices/MIMXRT798S/all_lib_device.cmake)

set(EXECUTORCH_BUILD_PYBIND OFF)
set(EXECUTORCH_BUILD_TESTS OFF)
set(EXECUTORCH_BUILD_DEVTOOLS OFF)
set(EXECUTORCH_BUILD_EXECUTOR_RUNNER OFF)
set(EXECUTORCH_BUILD_CPUINFO OFF)
set(EXECUTORCH_BUILD_PTHREADPOOL OFF)
set(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON)
set(EXECUTORCH_BUILD_PORTABLE_OPS ON)
set(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
add_subdirectory(${EXECUTORCH_ROOT_DIR} EXCLUDE_FROM_ALL executorch)

target_link_libraries(
${MCUX_SDK_PROJECT_NAME}
PRIVATE
-Wl,--start-group
executorch
executorch_core
extension_runner_util
quantized_kernels
portable_kernels
${SdkRootDirPath}/middleware/eiq/neutron/rt700/cm33/libNeutronDriver.a
${SdkRootDirPath}/middleware/eiq/neutron/rt700/cm33/libNeutronFirmware.a
-Wl,--end-group
)

# wrap all libraries with -Wl,--start-group -Wl,--end-group to prevent link
# order issue
group_link_libraries()
Loading
Loading