Example applications demonstrating the Generic Hardware Abstraction Layer (GHAL) for STM32 microcontrollers.
This repository contains working examples that demonstrate how to use the GHAL ecosystem for bare-metal Ada development on STM32 boards. Examples cover GPIO, SPI, I2C, USART, and NOR flash operations.
Basic LED blinking example demonstrating GPIO output.
File: src/blinky_0.adb
I2C communication with BMP390 pressure/temperature sensor.
Files:
src/i2c/i2c_bmp.adb- Main applicationsrc/i2c/bmp390.adb- BMP390 driversrc/i2c/bmp.ads- Sensor interface
Basic SPI transfer example.
File: src/spi_0.adb
SPI NOR flash (W25Q128) read/write operations.
Files:
src/nor_flash/nor_flash_0.adb- Main applicationsrc/nor_flash/w25q128_dev.adb- W25Q128 device driversrc/nor_flash/nor_flash_dev.adb- Flash device abstraction
alr buildopenocd -f interface/stlink.cfg -f target/stm32g4x.cfg \
-c "program bin/blinky_0 verify reset exit"openocd -f interface/stlink.cfg -f target/stm32f7x.cfg \
-c "program bin/i2c_bmp verify reset exit"- STM32 Nucleo-G431KB
- STM32F746G-DISCO
nucleo_g431kborstm32f746g_disco- Board support packagestm32g431orstm32f746- MCU HAL- Generic peripheral interfaces (gpio_generic, spi_generic, i2c_generic, usart_generic)
MIT OR Apache-2.0 WITH LLVM-exception