Skip to content

Add CMake Support for STM32CubeH7 #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

arms-spageddie
Copy link

@arms-spageddie arms-spageddie commented May 26, 2025

Overview

This PR adds CMake support for STM32CubeH7 as requested in issue #316.

The following changes provides CMake support to this package. Thereby allowing consuming projects to use this package as a dependency. This allows for CMake based projects to specify the necessary components and allow CMake to automatically determine which source files, header files, and include directories to make available to the consuming project.

Changes

  • Added CMake support
    • Added FindSTM32CubeH7.cmake file. This file, when included via a call to find_package() in CMake, will automatically locate all available components in the package and create a library that the consuming project can link against.
  • Updated relevant README's to explain the usage of the newly available CMake support.
  • Added CMake tests to ensure CMake support functionality.
    • Currently only uses ARM GCC to compile a test program.

- Adding `Find<package>`.cmake file to locate package with CMake `find_package()` calls.
- Adding support to locate source files and include directories associated with the HAL and CMSIS components.
- Added a `.gitignore` file to prevent CMake build directories and toolchain installation directories from getting picked up by version control systems.
- Added a `CMakePresets.json` file to configure a preset for compiling with ARM GCC.
- Added a toolchain file to configure the build system for ARM GCC.
- Added a script to automatically download ARM GCC and extract it into a known directory.
  - Should be ran as an individual script using CMake.
  - Can be modified to support more toolchains, such as IAR or the ARM compiler.
- Added a helper function to locate toolchain programs when the toolchain file is called.
- Fixed some bugs in how CMake was comparing some strings.
- Fixed an issue where the LL source and header files were not being included with the `stm32cubeh7` library.
- Added a test to fetch the STM32CubeH7 package while specifying required components, and linking it together into an executable successfully using ARM GNU compiler collection.
- Since this test is located in the package already, this script points to the location of the package instead of cloning the repository.
- Modified the test project to run on an STM32H750B-DK.
  - Project blinks the red and green LEDs.
- Updated README files to explain the available CMake support and its usage.
- Renamed the CMake test target to convey the target board and target device.
@arms-spageddie arms-spageddie changed the title [Adding CMake Support](https://github.com/STMicroelectronics/STM32CubeH7/issues/316) Add CMake Support for STM32CubeH7 (#316) May 26, 2025
@arms-spageddie arms-spageddie changed the title Add CMake Support for STM32CubeH7 (#316) Add CMake Support for STM32CubeH7 May 26, 2025
@ALABSTM ALABSTM added enhancement New feature or request projects Projects-related (demos, applications, examples) issue or pull-request. labels May 28, 2025
@ALABSTM ALABSTM linked an issue May 28, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request projects Projects-related (demos, applications, examples) issue or pull-request.
Projects
Development

Successfully merging this pull request may close these issues.

Add CMake Support
3 participants