About | Installation | Usage | References | License
This project serves as a template for starting development on STM32 platforms using Generate Ninja ("GN") and Ninja, offering a foundational structure that can be easily modified and extended.
GN_BUILD_FOR_STM32 is a simple project designed to build projects for STM32 microcontrollers using Generate Ninja ("GN") and Ninja build systems. This project aims to provide a streamlined and efficient build process for STM32 applications.
- Easy setup for building STM32 projects.
- Fast build times leveraging Ninja's efficient build system.
- Clear separation of source code and build configurations.
Tip
I trust you'll find this project enjoyable. Should you appreciate the project, bestowing a small ⭐ on it is a meaningful gesture, signifying: My efforts are recognized. Your support would be greatly valued. Many thanks!
A "Blink_LED" example within the GN_BUILD_FOR_STM32 project serves as a practical demonstration and a template for configuring and building STM32 projects. This simple example, specifically designed for the STM32WB55 board, makes the onboard LEDs blink, illustrating the basic functionality of the system.
Board Family Adaptability: The project is structured to allow easy adaptation to different STM32 family boards (such as U5, L4, H7, etc.) by modifying the defines, source, and include directories in the BUILD.gn
file of the application.
Important
Driver Compatibility: Switching between different STM32 families involves updating the drivers (HAL/BSP and CMSIS Device) to match the specific requirements of the target board.
GN_BUILD_FOR_STM32 follows the topology of the official packages provided by STMicroelectronics, known as "STM32Cube."
This means that the project is compatible with various STM32Cube Firmware Packages such as STM32Cube Firmware Packages (e.g., STM32CubeH7, STM32CubeWB) or Cube Extension Softwares (e.g., X-CUBE-AZURE, X-CUBE-FREERTOS), enabling further expansion and customization for specific applications.
The GN_BUILD_FOR_STM32 project utilizes a streamlined build workflow that integrates Generate Ninja (GN), Ninja build system, and ARM Toolchain to produce .elf
files compatible with STM32 microcontrollers and debuggable.
-
Generate Ninja (GN): GN takes high-level build configurations and generates detailed instructions in the form of Ninja files. These configurations include paths, compiler flags, and file dependencies.
-
Ninja Build System: Ninja reads the generated files and executes the build instructions efficiently, taking advantage of parallel processing and minimizing unnecessary rebuilds.
-
ARM Toolchain (
arm-none-eabi-gcc
): The ARM toolchain compiles the source code into an executable.elf
file, specifically tailored for STM32 microcontrollers.
Before you begin, ensure you have met the following requirements:
- Installed Generate Ninja
- Installed Ninja build system
- Installed ARM toolchain
To install GN_BUILD_FOR_STM32, follow these steps:
- Clone the repository
git clone https://github.com/Orel138/STM32_GN_Build.git
- Navigate to the project directory
cd GN_BUILD_FOR_STM32
- Run the following command in a terminal (BASH) at the root path of the project.
source ./scripts/run_test.sh Projects/NUCLEO-WB55RG/Examples/Blink_LED
- The executable (
.elf
file) for the Blink_LED example will be inProjects/NUCLEO-WB55RG/Examples/Blink_LED/out/test
- You can now drag and drop the
.elf
file in your NUCLEO-WB55RG board (if you have one) and see the user LED blink. - Or you can modify the project for your STM32 target.
If you don't want to use the script run_test.sh you can do the following for building with GN and Ninja:
Go in the root directory of your project (the directory where there is a BUILD.gn
file) and:
gn gen out/debug
ninja -C out/debug`
- Generate Ninja - A blog-aware static site generator in Ruby.
- Ninja Build - Lightweight markup processor to produce HTML, LaTeX, and more.
- ARM toolchain
- Matter - The Matter IoT protocol SDK also use a similar approach, demonstrating the effectiveness and versatility of this method in a larger and complex project. By following the patterns and structures used in GN_BUILD_FOR_STM32, users can align their development practices with industry standards and best practices.
We welcome your contributions to GN_BUILD_FOR_STM32.
To contribute:
- Fork the repository.
- Create a new branch: git checkout -b [branch-name].
- Make your changes and commit them: git commit -m '[commit-message]'.
- Push to the original branch: git push origin [project-name]/[location].
- Create the pull request.
GN_BUILD_FOR_STM32 is released under the MIT license © Aurélien REYNAUD.