Skip to content
/ GN_BUILD_FOR_STM32 Public template

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.

License

Notifications You must be signed in to change notification settings

Orel138/GN_BUILD_FOR_STM32

Repository files navigation


⚙️ GN_BUILD_FOR_STM32 🐱‍👤

Orel138 - GN_BUILD_FOR_STM32 stars - GN_BUILD_FOR_STM32 forks - GN_BUILD_FOR_STM32

Open in Visual Studio Code tests license issues

STM32

Use this template View site - GH Pages

Built by Orel138 and contributors

A Template for STM32 Development

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.

Table of Contents

About

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.

Features

  • 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!

Overview

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.

Flexibility and Compatibility

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.

Alignment with STMicroelectronics' STM32Cube Topology

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.

~~~~~ back to top ~~~~~

Architecture Overview

Build Workflow

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.

  1. 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.

  2. Ninja Build System: Ninja reads the generated files and executes the build instructions efficiently, taking advantage of parallel processing and minimizing unnecessary rebuilds.

  3. ARM Toolchain (arm-none-eabi-gcc): The ARM toolchain compiles the source code into an executable .elf file, specifically tailored for STM32 microcontrollers.

~~~~~ back to top ~~~~~

Requirements

Before you begin, ensure you have met the following requirements:

~~~~~ back to top ~~~~~

Installation

To install GN_BUILD_FOR_STM32, follow these steps:

  1. Clone the repository
    git clone https://github.com/Orel138/STM32_GN_Build.git
  2. Navigate to the project directory
    cd GN_BUILD_FOR_STM32
  3. 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
  4. The executable (.elf file) for the Blink_LED example will be in Projects/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.

~~~~~ back to top ~~~~~

Usage

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`

~~~~~ back to top ~~~~~

References

  • 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.

Contributing

We welcome your contributions to GN_BUILD_FOR_STM32.

To contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b [branch-name].
  3. Make your changes and commit them: git commit -m '[commit-message]'.
  4. Push to the original branch: git push origin [project-name]/[location].
  5. Create the pull request.

~~~~~ back to top ~~~~~

License

GN_BUILD_FOR_STM32 is released under the MIT license © Aurélien REYNAUD.

~~~~~ back to top ~~~~~

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages