Skip to content

Conversation

@kammce
Copy link
Member

@kammce kammce commented Dec 2, 2025

Resolves #22

This commit adds comprehensive support for ARM Cortex-M microcontrollers by
integrating the ARM LLVM Embedded Toolchain alongside the upstream LLVM
releases. The package now intelligently selects the appropriate toolchain
variant based on the target architecture.

Major changes:

  • Add ARM Cortex-M architecture support (m0, m0plus, m1, m3, m4, m4f, m7,
    m7f, m7d, m23, m33, m33f, m35p, m35pf, m55, m85)
  • Integrate ARM LLVM Embedded Toolchain 20.1.0 for baremetal ARM targets
  • Add automatic variant detection to use arm-embedded fork for Cortex-M
    targets and upstream LLVM for all other targets
  • Add 17 Cortex-M target profiles to conan/profiles/v1/
  • Add test_package infrastructure for validating cross-compilation
  • Add default_linker_script option for baremetal targets, which allows cortex-m architecture binaries to link if a linker script is not provided
  • Add CMake utility tools configuration (objcopy, size, objdump, ar, ranlib)
  • Remove LLVM 19.1.7 support and consolidate to version-agnostic "20" naming
  • Restructure conandata.yml to support multiple LLVM variants (upstream vs
    arm-embedded)
  • Move host platform profiles from demo/ to conan/profiles/v1/
  • Update CI workflows to test both host and Cortex-M targets
  • Add macOS DMG extraction support for ARM Embedded Toolchain

Breaking changes:

  • Removed LLVM 19.1.7 support
  • Profile naming changed from llvm-20.1.8 to llvm-20
  • Moved demo profiles to standardized location

Note: The upstream LLVM version (20.1.8) and ARM Embedded Toolchain version
(20.1.0) do not match exactly. Both are packaged under version "20" as they
are the most recent official releases from their respective sources at the
time of packaging.

kammce added 12 commits December 2, 2025 13:01
The answer I've been looking for is `--default-script` for lld. Without
this, test_packages cannot build because a linker script isn't provided.
We are in a hard place like we were with the ARM GNU Toolchain where
we needed to supply a `.specs` for the libc to allow test_packages to
link. We found that `--specs=nosys.specs` does the trick because it
provides weak defaults which allow linking but can overridden by
the addition of any other specification such as picolibc.

I removed LLMV 19 because I got the following linker errors (repeated):

```
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:278: symbol not found: __end
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:279: symbol not found: __stack
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:278: symbol not found: __end
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:279: symbol not found: __stack
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:278: symbol not found: __end
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:279: symbol not found: __stack
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:278: symbol not found: __end
ld.lld: error: .conan2/p/b/llvm-08844596518f5/p/bin/../lib/clang-runtimes/arm-none-eabi/armv7m_soft_nofp_exn_rtti/lib/picolibcpp.ld:279: symbol not found: __stack
```

I see no reason to support LLVM 19 if we need to work around these sorts
of issues. No issues came from compiling 20.1.0 so we will start our
toolchain versions from there and go upwards.
Rather than doing this, we will let the demo application automatically
execute on build if not cross compiling.
@kammce kammce changed the title 🚀 Add support for 19.1.5 & cortex-m 🚀 ARM Cortex M Dec 6, 2025
I don't know why I didn't do this before. Conan only supports whole
number variants of LLVM. So there is no need to keep the exact version
for anything within 20. If they release a newer version then we can
upgrade it. Users wanting the older revision can use the older revision
number. This greatly reduces the number of versions we need to maintain
into the future and makes developing with llvm a very easy task. Rather
than complex versioning, we just have llvm-20 or llvm-X where X is the
major version number.
@kammce kammce changed the title 🚀 ARM Cortex M 🚀 Add ARM Cortex-M cross-compilation support and consolidate to LLVM 20 Dec 6, 2025
@kammce kammce marked this pull request as ready for review December 6, 2025 21:10
@kammce kammce merged commit eb2802d into main Dec 6, 2025
@kammce kammce deleted the add-arm-cortex-m branch December 6, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add llvm for arm embedded 20.0.1

2 participants