This is a small, and somewhat experimental, example of how to cross compile for an Arm Cortex-M4 MCU using Bazel and the IAR C/C++ compiler toolchain.
The example uses the STM32F429II MCU as target and is intended to be portable to other targets without too much effort.
- generic IAR toolchain config is in toolchains/iar
- toolchain flags for build configs in .bazelrc
- target specific flags in /platforms (todo )
- configurations for debug and release specified in .bazelrc
Tested with Bazel v8 LTS using WORKSPACE GitHub actions workflow builds the release configuration of the project.
Known issues
- linker map file is not generated
Todo
- possibly move from WORKSPACE to Bzlmod
- add cstartup
- update IAR toolchain to 9.70.4
- add more complete GitHub action workflow
- move target specific build flags to platforms (?)