Skip to content

Zig exemples with STM32 when the project start from STM32CubeMX code generator

Notifications You must be signed in to change notification settings

Sazerac4/zig_on_stm32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Context

Are you considering incorporating Zig code into your embedded development projects, specifically on STM32 or other similar platforms?
If so, I'd like to share some demo examples that demonstrate how to integrate Zig code into your projects.
These examples utilize the STM32CubeMX code generator as well as the drivers provided by ST, which are probably already integrated into your projects and which you want to keep.

Example

Each example of a C project below has its Zig equivalent ending with _zig

  • stm32l476_nucleo_blinky
  • stm32l476_nucleo_blinky_freertos

Build

Build tested with:

  • OS: Ubuntu 22.04

tools:

  • arm-none-eabi-gcc : 13.2.1
  • zig : 0.13.0
  • cmake : 3.22.1
  • STM32CubeMX : 6.11.0
  • stlink-tools : v1.8.0
  • openocd : 0.12.0

Build

  • See each project to see how to build

Build with containers (podman/docker)

You can build all firmware by with the image from ContainerFile

#Create the image
podman build -f ContainerFile --tag=zig_projects/build .
#Run a container
podman run --rm -it -v ./:/projects --name=zig_projects zig_projects/build
# Build a project
cd  /projects/<name>/
...

Reference:

  • STM32 Guide will help you to understand and port your current project. Ziggit topic here

  • This project may interest you: Microzig A Unified abstraction layer and HAL for several microcontrollers

  • FreeRTOS discussion on ziggit

About

Zig exemples with STM32 when the project start from STM32CubeMX code generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages