CMake toolchain files for bare-metal ARM Cortex development.
| File | Toolchain |
|---|---|
arm_none_eabi_gcc.cmake |
Arm GNU Toolchain (arm-none-eabi-gcc) |
arm_none_eabi_llvm.cmake |
LLVM Embedded Toolchain for Arm (clang with arm-none-eabi target) |
Both toolchains configure all standard CMake tools (compiler, linker, objcopy, size, etc.) and set up automatic sysroot detection via the compiler's -print-sysroot.
Important — for the LLVM toolchain file. Sysroot detection runs
clang --target=arm-none-eabi -print-sysrootand expects a real path back. This works with the LLVM Embedded Toolchain for Arm (which bundles picolibc, multilibs, startup files, and linker scripts), but not with stock upstream LLVM — stockclangcan target ARM Cortex but ships no sysroot forarm-none-eabi, and-print-sysrootreturns an empty string. If you must use stock LLVM, setCMAKE_SYSROOTandCMAKE_FIND_ROOT_PATHmanually on the CMake command line and the toolchain will respect your overrides.
Copy the toolchain file you need into your project, then pass it to CMake:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=arm_none_eabi_gcc.cmake
cmake --build buildOr with a preset:
{
"configurePresets": [
{
"name": "arm-gcc",
"toolchainFile": "${sourceDir}/arm_none_eabi_gcc.cmake"
}
]
}All tool paths can be overridden before including the toolchain file. For example, to use a specific GCC version:
cmake -B build \
-DCMAKE_C_COMPILER=/opt/arm-gnu-toolchain-13/bin/arm-none-eabi-gcc \
-DCMAKE_CXX_COMPILER=/opt/arm-gnu-toolchain-13/bin/arm-none-eabi-g++ \
-DCMAKE_TOOLCHAIN_FILE=arm_none_eabi_gcc.cmakeThis project is licensed under the Apache License Version 2.0.
Copyright (C) 2026 The Embedded Society https://github.com/embedded-society/arm-cmake-toolchains.
See the attached LICENCE file for more info.