Skip to main content
Associate
November 11, 2025
Question

CubeMX ST ARM Clang linker not compatible

  • November 11, 2025
  • 2 replies
  • 304 views

Hi everyone,

I’m using the new Arm Toolchain for Embedded with CMake. I generated a project template from STM32CubeMX using the following settings:

  • Toolchain/IDE: CMake
  • Default compiler/linker: Arm-Clang

Compilation works fine, but when linking starts, I get this error:

ld.lld: error: STM32G474XX_FLASH.ld:105: symbol not found: READONLY

It looks like the Arm toolchain (even the latest v21.1.1) doesn’t support the READONLY keyword. It’s not a big deal to adjust the .ld file - just remove the READONLY keywords - but it would be nice if the generated template worked out of the box.

Am I missing a setting somewhere? Is there an alternative/better way to obtain the linker file?

Edit: I'm using the STM32G474.

2 replies

Technical Moderator
November 11, 2025

Hello @gf1 

Could you please provide the name of the MCU you are using?

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
gf1Author
Associate
November 11, 2025

Hello, I just added the information in the initial post. I'm using a STM32G474.

Technical Moderator
November 11, 2025

Hello @gf1 

Could you describe the steps followed when using the Arm Toolchain for Embedded with CMake? From my side, I haven't encountered any issues when compiling with STM32CubeCLT 1.19.0.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
gf1Author
Associate
November 11, 2025

I think the issue is that the files generated with the Starm-Clang setting aren’t fully compatible with the plain Arm Toolchain for Embedded.

To get the project to compile, I had to:

  • Adjust the toolchain path
  • Remove the starm- prefix
  • Update the names used for objcopy and size
  • Adapt the TARGET_FLAGS so they match ATfE requirements

However, even after these changes, the plain Clang linker still throws the error:

symbol not found: READONLY