Skip to content

Conversation

@mathieuchopstm
Copy link
Collaborator

Replace all GCC-isms in the CMakeLists for STM32WB0 series libraries with toolchain agnostic patterns (or gate behind toolchain check) and rename some preprocessed assembler files to the proper extension to enable compilation of STM32WB0 Bluetooth apps with IAR toolchain.

The biggest wart in patchset is mandatory renaming of assembler .s file to .S - the extension has always been wrong, but it seems GCC happily copes with it; when IAR is used, .s files are built by the IAR assembler and (more annoyingly) seem to not be preprocessed, which results in build failures.

cc @msmttchr @FrancescoCiminoST

@mathieuchopstm
Copy link
Collaborator Author

mathieuchopstm commented Dec 10, 2025

To build an application (e.g., samples/bluetooth/beacon- it's the one I used) using IAR toolchain from EWARM:

  • Start Menu > type env and select Edit environment variables for your account
  • create a new environment variable VIRTUAL_ENV which points to folder <...>/zephyrproject/.venv:
image
  • Save by clicking OK and restart EWARM if it was already open
  • On Zephyr side, ensure you are using branch from PR: soc: st: stm32wb0: IAR toolchain compatibility zephyr#100911
  • Fetch this HAL by changing the revision line to pull/329/head (+ running west update)
  • Create (or reuse) a workspace in EWARM
  • Go in Project > Create New Project...
  • Select CMake for Arm > Import CMakeLists.txt
  • Select CMakeLists.txt of target app (e.g., samples/bluetooth/beacon/CMakeLists.txt), then save project wherever you want
  • wait a billion years for CMake stuff to run
  • Go in project options: right-click on the project name in the Workspace list on left of screen and select Options...
    • in General Options > Target, choose Device and select SoC of target board (e.g., ST STM32WB09KE for Nucleo-WB09KE)
    • in CMake / CMSIS-Toolkit > CMake:
      • (optional?) in Generator, choose Ninja instead of Ninja Multi-Config
      • in Extra command line options for configuration:, provide -DBOARD="nucleo_wb09ke" -DZEPHYR_TOOLCHAIN_VARIANT="iar" -DIAR_TOOLCHAIN_PATH="C:/iar/ewarm-9.70.1/arm"
        • replace nucleo_wb09ke by wanted board, and path to IAR with appropriate value
    • in Debugger, change Driver to ST-LINK
  • in the menu toolstrip, Project > Force Reconfiguration
    • this should complete with CMake configuration complete, even if there may be some warning/"error"
  • in the menu toolstrip, Project > Make
    • there should be tons of warnings but no errors and build should succeed
  • you should be able to run the sample using EWARM's built-in debugger (otherwise, ELF is in <path/to/project>/.cmake_build/zephyr/zephyr.elf - flash it with STM32CubeProgrammer)

Note that EWARM 9.70.1 is required - older versions will NOT work!

@HoZHel
Copy link
Collaborator

HoZHel commented Dec 11, 2025

Please, include the rename changes in the README.rst file.

Replace all GCC-isms in the CMakeLists for STM32WB0 series libraries
with toolchain agnostic patterns (or gate behind toolchain check)
and rename some preprocessed assembler files to the proper extension
to enable compilation of STM32WB0 Bluetooth apps with IAR toolchain.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
@mathieuchopstm mathieuchopstm force-pushed the topic/stm32wb0_iar_compat branch from d8ceaf5 to 07baa61 Compare December 11, 2025 16:17
@mathieuchopstm
Copy link
Collaborator Author

Please, include the rename changes in the README.rst file.

Done.

(Note that this only affects Linux system; on Windows, CMake is not case-sensitive and will accept osal_memcpy.s and treat it as assembler-with-cpp if it is listed as osal_memcpy.S in the CMakeLists.txt))

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.

2 participants