Skip to content

Simple STM32 HAL Code Generator made in python, No need to open CubeMX every time to add or update code

License

Notifications You must be signed in to change notification settings

dohack/STM32-HAL-Code-Generator

Repository files navigation

STM32 HAL Code Generator

GUI_HAL_code_Generator

Overview

The STM32 HAL Code Generator is a Python-based tool designed to simplify the process of generating STM32 HAL code snippets for various peripherals. It provides a user-friendly GUI for selecting peripherals, configuring settings, and generating initialization code for GPIO, UART, I2C, and SPI peripherals.

Requirements

  • Python 3.x
  • Tkinter (included in standard Python library)

Why Use STM32 HAL Code Generator Instead of STM32CubeMX?

STM32CubeMX is a powerful tool for configuring STM32 microcontrollers and generating initialization code. However, the STM32 HAL Code Generator offers several advantages:

  • Simplicity: The STM32 HAL Code Generator provides a streamlined interface focused solely on generating HAL code, without the complexity of full microcontroller configuration.
  • Focused Functionality: It focuses specifically on generating initialization code for GPIO, UART, I2C, and SPI peripherals, making it quicker to use for these common tasks.
  • Ease of Use: With a straightforward GUI and direct code generation, it allows users to quickly prototype and integrate peripheral functionalities into their projects.

Challenges

While the STM32 HAL Code Generator simplifies the process of generating HAL code snippets, it currently has the following challenges:

  • Limited peripheral support compared to STM32CubeMX.
  • Basic configuration options compared to the comprehensive device configuration options in STM32CubeMX.

Features

  • Generate initialization code for GPIO (e.g., LEDs) with customizable settings.
  • Generate code for UART communication with baud rate and configuration options.
  • Generate initialization code for I2C and SPI peripherals.
  • User-friendly GUI with options to add and configure multiple peripherals dynamically.
  • Quick and easy generation of STM32 HAL code snippets.

Upcoming Features

In future updates, the STM32 HAL Code Generator plans to introduce:

  • Bare-Metal Driver API: Providing direct access to low-level hardware peripherals for advanced users who prefer bare-metal programming.
  • Expanded Peripheral Support: Adding support for more STM32 peripherals, enhancing the tool's versatility and utility.

Files

  1. generated_code.c: Generated C code containing the HAL initialization code.
  2. gpio.py: Python module for GPIO peripheral code generation.
  3. uart.py: Python module for UART peripheral code generation.
  4. i2c.py: Python module for I2C peripheral code generation.
  5. spi.py: Python module for SPI peripheral code generation.
  6. logo.png: Logo image used in the application.
  7. main.py: Main script to launch the STM32 HAL Code Generator.

Usage

  1. Clone or download the repository to your local machine.
  2. Ensure Python 3.x and Tkinter are installed on your system.
  3. Run main.py to launch the GUI.
  4. Select the peripherals (GPIO, UART, I2C, SPI) and configure settings as required.
  5. Click the "Generate Code" button to generate STM32 HAL code snippets.
  6. Copy and paste the generated code into your STM32 project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Simple STM32 HAL Code Generator made in python, No need to open CubeMX every time to add or update code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published