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.
Each example of a C project below has its Zig equivalent ending with _zig
- stm32l476_nucleo_blinky
- stm32l476_nucleo_blinky_freertos
- 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
- See each project to see how to build
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>/
...
-
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