|
| 1 | +# Copyright 2026 NXP |
| 2 | +# |
| 3 | +# This source code is licensed under the BSD-style license found in the |
| 4 | +# LICENSE file in the root directory of this source tree. |
| 5 | + |
| 6 | +cmake_minimum_required(VERSION 3.10.0) |
| 7 | + |
| 8 | +# THE VERSION NUMBER |
| 9 | +set(MCUXPRESSO_CMAKE_FORMAT_MAJOR_VERSION 2) |
| 10 | +set(MCUXPRESSO_CMAKE_FORMAT_MINOR_VERSION 0) |
| 11 | + |
| 12 | +set(CMAKE_EXECUTABLE_LIBRARY_PREFIX) |
| 13 | +set(CMAKE_EXECUTABLE_LIBRARY_SUFFIX) |
| 14 | + |
| 15 | +# CURRENT DIRECTORY |
| 16 | +set(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR}) |
| 17 | + |
| 18 | +set(EXECUTABLE_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE}) |
| 19 | +set(LIBRARY_OUTPUT_PATH ${ProjDirPath}/${CMAKE_BUILD_TYPE}) |
| 20 | + |
| 21 | +# Skip link step during compiler check (bare-metal cross-compilation). |
| 22 | +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) |
| 23 | + |
| 24 | +project(executorch_cifarnet) |
| 25 | + |
| 26 | +enable_language(ASM) |
| 27 | + |
| 28 | +set(MCUX_BUILD_TYPES flash_debug flash_release) |
| 29 | + |
| 30 | +set(MCUX_SDK_PROJECT_NAME executorch_cifarnet.elf) |
| 31 | + |
| 32 | +set(EXECUTORCH_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..) |
| 33 | + |
| 34 | +# CPU and FPU flags required for Cortex-M33 with single-precision FPU. |
| 35 | +set(CPU_FLAGS "-mcpu=cortex-m33 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16") |
| 36 | +set(CPU_DEFINES |
| 37 | + "-DCPU_MIMXRT798SGFOA_cm33_core0 -DCPU_MIMXRT798SGFOB_cm33_core0 \ |
| 38 | + -DMIMXRT798S_cm33_core0_SERIES -DMCUXPRESSO_SDK \ |
| 39 | + -D__STARTUP_INITIALIZE_NONCACHEDATA -D__STARTUP_CLEAR_BSS \ |
| 40 | + -DDSP_IMAGE_COPY_TO_RAM=1 -DBOOT_HEADER_ENABLE=1 \ |
| 41 | + -DEIQ_EXAMPLE_HSRUN_CLOCK -DMCUX_META_BUILD \ |
| 42 | + -DPRINTF_ADVANCED_ENABLE=1 -DPRINTF_FLOAT_ENABLE=1 -DNO_HEAP_USAGE=1 \ |
| 43 | + -DSDK_DEBUGCONSOLE=1 -DSDK_I2C_BASED_COMPONENT_USED=1" |
| 44 | +) |
| 45 | +set(CMAKE_C_FLAGS |
| 46 | + "${CMAKE_C_FLAGS} ${CPU_FLAGS} ${CPU_DEFINES} -fno-common -ffunction-sections -fdata-sections -fno-builtin -mapcs -std=gnu99" |
| 47 | +) |
| 48 | +set(CMAKE_CXX_FLAGS |
| 49 | + "${CMAKE_CXX_FLAGS} ${CPU_FLAGS} ${CPU_DEFINES} -fno-common -ffunction-sections -fdata-sections -fno-builtin -mapcs -fno-rtti -fno-exceptions" |
| 50 | +) |
| 51 | +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CPU_FLAGS} ${CPU_DEFINES}") |
| 52 | +set(CMAKE_EXE_LINKER_FLAGS |
| 53 | + "${CMAKE_EXE_LINKER_FLAGS} ${CPU_FLAGS} -fno-common -ffunction-sections -fdata-sections -fno-builtin -mapcs -Wl,--gc-sections -Wl,-static -specs=nano.specs -specs=nosys.specs -T\"${SdkRootDirPath}/examples/_boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0/gcc/MIMXRT798Sxxxx_cm33_core0_flash.ld\" -static" |
| 54 | +) |
| 55 | + |
| 56 | +add_executable( |
| 57 | + ${MCUX_SDK_PROJECT_NAME} |
| 58 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/flash_config/flash_config.c |
| 59 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0/hardware_init.c |
| 60 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0/pin_mux.c |
| 61 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/board.c |
| 62 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/pmic_support.c |
| 63 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/common/clock/cm33_core0/clock_config.c |
| 64 | + ${SdkRootDirPath}/examples/eiq_examples/executorch_cifarnet/main.cpp |
| 65 | + ${SdkRootDirPath}/examples/eiq_examples/executorch_cifarnet/RegisterKernels.cpp |
| 66 | + ${SdkRootDirPath}/examples/eiq_examples/common/timer.c |
| 67 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/startup_MIMXRT798S_cm33_core0.c |
| 68 | + ${EXECUTORCH_ROOT_DIR}/backends/nxp/runtime/NeutronBackend.cpp |
| 69 | + ${SdkRootDirPath}/middleware/tfm/tf-m/platform/ext/common/syscalls_stub.c |
| 70 | + # Device-level drivers (clock, power, reset, system init). |
| 71 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/drivers/fsl_clock.c |
| 72 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/drivers/fsl_power.c |
| 73 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/drivers/fsl_reset.c |
| 74 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/system_MIMXRT798S_cm33_core0.c |
| 75 | + # Common ARM driver (provides SDK_DelayAtLeastUs). |
| 76 | + ${SdkRootDirPath}/drivers/common/fsl_common_arm.c |
| 77 | + # Peripheral drivers. |
| 78 | + ${SdkRootDirPath}/drivers/cache/xcache/fsl_cache.c |
| 79 | + ${SdkRootDirPath}/drivers/lpflexcomm/fsl_lpflexcomm.c |
| 80 | + ${SdkRootDirPath}/drivers/lpflexcomm/lpi2c/fsl_lpi2c.c |
| 81 | + ${SdkRootDirPath}/drivers/lpflexcomm/lpuart/fsl_lpuart.c |
| 82 | + ${SdkRootDirPath}/drivers/gpio/fsl_gpio.c |
| 83 | + ${SdkRootDirPath}/drivers/glikey/fsl_glikey.c |
| 84 | + # UART HAL adapter (provides HAL_UartInit etc.). |
| 85 | + ${SdkRootDirPath}/components/uart/fsl_adapter_lpuart.c |
| 86 | + # PMIC driver. |
| 87 | + ${SdkRootDirPath}/components/pmic/pca9422/fsl_pca9422.c |
| 88 | + # Debug console (provides DbgConsole_Init/Printf). |
| 89 | + ${SdkRootDirPath}/components/debug_console_lite/fsl_debug_console.c |
| 90 | +) |
| 91 | + |
| 92 | +target_include_directories( |
| 93 | + ${MCUX_SDK_PROJECT_NAME} |
| 94 | + PRIVATE |
| 95 | + ${CMAKE_CURRENT_SOURCE_DIR} |
| 96 | + ${SdkRootDirPath}/arch/arm/CMSIS/Core/Include |
| 97 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S |
| 98 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/cm33_core0 |
| 99 | + ${SdkRootDirPath}/devices/RT/RT700/MIMXRT798S/drivers |
| 100 | + ${SdkRootDirPath}/devices/RT/RT700/periph |
| 101 | + ${SdkRootDirPath}/drivers/common |
| 102 | + ${SdkRootDirPath}/components/pmic/pca9422 |
| 103 | + ${SdkRootDirPath}/components/uart |
| 104 | + ${SdkRootDirPath}/components/debug_console_lite |
| 105 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk |
| 106 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/flash_config |
| 107 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0 |
| 108 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/common/clock/cm33_core0 |
| 109 | + ${SdkRootDirPath}/examples/eiq_examples/executorch_cifarnet |
| 110 | + ${SdkRootDirPath}/examples/eiq_examples/common |
| 111 | + ${SdkRootDirPath}/boards/mimxrt700evk/eiq_examples/executorch_cifarnet/cm33_core0 |
| 112 | + ${SdkRootDirPath}/examples/_boards/mimxrt700evk/eiq_examples/executorch_cifarnet/npu |
| 113 | + ${SdkRootDirPath}/drivers/cache/xcache |
| 114 | + ${SdkRootDirPath}/drivers/gpio |
| 115 | + ${SdkRootDirPath}/drivers/lpflexcomm |
| 116 | + ${SdkRootDirPath}/drivers/lpflexcomm/lpuart |
| 117 | + ${SdkRootDirPath}/drivers/lpflexcomm/lpi2c |
| 118 | + ${SdkRootDirPath}/drivers/xspi |
| 119 | + ${SdkRootDirPath}/drivers/reset |
| 120 | + ${SdkRootDirPath}/drivers/clock |
| 121 | + ${SdkRootDirPath}/drivers/glikey |
| 122 | + ${SdkRootDirPath}/drivers/mu1 |
| 123 | + ${SdkRootDirPath}/drivers/power |
| 124 | + ${SdkRootDirPath}/drivers/iopctl |
| 125 | + ${SdkRootDirPath}/components/str |
| 126 | +) |
| 127 | + |
| 128 | +set(EXECUTORCH_BUILD_PYBIND OFF) |
| 129 | +set(EXECUTORCH_BUILD_TESTS OFF) |
| 130 | +set(EXECUTORCH_BUILD_DEVTOOLS OFF) |
| 131 | +set(EXECUTORCH_BUILD_EXECUTOR_RUNNER OFF) |
| 132 | +set(EXECUTORCH_BUILD_CPUINFO OFF) |
| 133 | +set(EXECUTORCH_BUILD_PTHREADPOOL OFF) |
| 134 | +set(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL ON) |
| 135 | +set(EXECUTORCH_BUILD_PORTABLE_OPS ON) |
| 136 | +set(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON) |
| 137 | +set(CMAKE_POSITION_INDEPENDENT_CODE OFF) |
| 138 | +add_subdirectory(${EXECUTORCH_ROOT_DIR} EXCLUDE_FROM_ALL executorch) |
| 139 | + |
| 140 | +target_link_libraries( |
| 141 | + ${MCUX_SDK_PROJECT_NAME} |
| 142 | + PRIVATE -Wl,--start-group |
| 143 | + executorch |
| 144 | + executorch_core |
| 145 | + extension_runner_util |
| 146 | + quantized_kernels |
| 147 | + portable_kernels |
| 148 | + ${NEUTRON_LIB_DIR}/libNeutronDriver.a |
| 149 | + ${NEUTRON_LIB_DIR}/libNeutronFirmware.a |
| 150 | + -Wl,--end-group |
| 151 | +) |
0 commit comments