diff options
Diffstat (limited to 'cmake/cortex_m52.cmake')
| -rw-r--r-- | cmake/cortex_m52.cmake | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cmake/cortex_m52.cmake b/cmake/cortex_m52.cmake new file mode 100644 index 00000000..21a7d487 --- /dev/null +++ b/cmake/cortex_m52.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2026 Eclipse ThreadX contributors +# SPDX-License-Identifier: MIT +# Portions of this file were generated with AI assistance. +# +# Toolchain file for Arm Cortex-M52 using GNU tools. +# +# The FPU and the MVE unit come with the core, so the hard float ABI +# is selected here rather than left to the caller. scripts/check_clang.sh +# builds this core the same way. + +# Name of the target +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR cortex-m52) + +set(THREADX_ARCH "cortex_m52") +set(THREADX_TOOLCHAIN "gnu") + +# The hard float ABI is not optional here: -mcpu=cortex-m52 implies Helium, and +# the soft-float variant has no matching library. +set(MCPU_FLAGS "-mthumb -mcpu=cortex-m52") +set(VFP_FLAGS "-mfloat-abi=hard") +set(SPEC_FLAGS "--specs=nosys.specs") + +include(${CMAKE_CURRENT_LIST_DIR}/arm-none-eabi.cmake) + +# Pin the reference cross toolchain, as cmake/cortex_r52.cmake does. This core +# needs it rather than merely preferring it: arm-none-eabi-gcc only learned +# -mcpu=cortex-m52 in GCC 14, so a distribution compiler on PATH is likely to +# reject the port outright. Override with -DARM_TOOLCHAIN_PATH=<dir containing +# arm-none-eabi-gcc> to build with a different compiler. The check leaves PATH +# alone when the pinned directory is absent. +# +# As in cortex_r52.cmake, the default below serves local builds and nothing +# else -- no CI job has that directory, so on a runner the EXISTS check falls +# through and the compiler comes from PATH. See the longer note there. +if(NOT DEFINED ARM_TOOLCHAIN_PATH) + set(ARM_TOOLCHAIN_PATH + "$ENV{HOME}/toolchains/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin") +endif() +if(EXISTS "${ARM_TOOLCHAIN_PATH}/arm-none-eabi-gcc") + set(CMAKE_C_COMPILER "${ARM_TOOLCHAIN_PATH}/arm-none-eabi-gcc") + set(CMAKE_CXX_COMPILER "${ARM_TOOLCHAIN_PATH}/arm-none-eabi-g++") + set(CMAKE_ASM_COMPILER "${ARM_TOOLCHAIN_PATH}/arm-none-eabi-gcc") +endif() |
