diff options
Diffstat (limited to 'cmake/aarch64-none-elf.cmake')
| -rw-r--r-- | cmake/aarch64-none-elf.cmake | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cmake/aarch64-none-elf.cmake b/cmake/aarch64-none-elf.cmake new file mode 100644 index 00000000..dada9fec --- /dev/null +++ b/cmake/aarch64-none-elf.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2026 Eclipse ThreadX contributors +# SPDX-License-Identifier: MIT +# Portions of this file were generated with AI assistance. +# +# Shared settings for the AArch64 bare metal ports, the counterpart of +# arm-none-eabi.cmake beside it. The two differ by more than the tool prefix: +# AArch64 has no -marm or -mthumb to choose between, no -mfloat-abi, and +# aarch64-none-elf-gcc rejects -mlong-calls outright, so that flag cannot simply +# be carried across. +# +# The tools are named without a path, so an aarch64-none-elf toolchain must be +# on PATH. Override CMAKE_C_COMPILER and friends on the command line to use one +# that is not. + +# Toolchain settings +set(CMAKE_C_COMPILER aarch64-none-elf-gcc) +set(CMAKE_CXX_COMPILER aarch64-none-elf-g++) +set(AS aarch64-none-elf-as) +set(AR aarch64-none-elf-ar) +set(OBJCOPY aarch64-none-elf-objcopy) +set(OBJDUMP aarch64-none-elf-objdump) +set(SIZE aarch64-none-elf-size) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# Build the try-compile as a static library so no linker script or startup code +# is needed just to test the compiler. +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) + +set(CMAKE_C_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} ${SPEC_FLAGS} -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags") +set(CMAKE_CXX_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions" CACHE INTERNAL "cxx compiler flags") +set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags") +set(CMAKE_EXE_LINKER_FLAGS "${MCPU_FLAGS} ${LD_FLAGS} -Wl,--gc-sections" CACHE INTERNAL "exe link flags") + +set(CMAKE_C_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "c debug compiler flags") +set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "cxx debug compiler flags") +set(CMAKE_ASM_FLAGS_DEBUG "-g -ggdb3" CACHE INTERNAL "asm debug compiler flags") + +set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE INTERNAL "c release compiler flags") +set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE INTERNAL "cxx release compiler flags") +set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "asm release compiler flags") |
