Update to STM32 Porting Guide

For those interested, updated my porting guide to be better organized + include a section on project organization using packages (and Zig’s package system) as well as calling Zig code from C and vice-versa!

5 Likes

Thank you for the awesome guide!
I tried to follow steps to produce a blinky program for my nucleo-64 board.

At the moment it compiles and produces a binary, but it fails to flash onto my device.

  • Standard Makefile with arm-none-eabi-gcc compiler/linker: Compiles and flashes
  • Modified Makefile with zig cc as the compiler/linker: Compiles and flashes fine
  • Equivalent build.zig file: compiles, but fails flashing to the board :disappointed_relieved:

I’m new to both zig and embedded so I’m not exactly sure what steps i can take to debug this.

Did it compile & flash properly when you tried step 3 of the guide?

@fixer I didn’t try to flash when i went through step 03.

I went back now and recreated step three here.

Step 03 builds and flashes fine :slight_smile:

One fix is to add the line:

blinky_exe.setLinkerScriptPath(b.path("stm32_hal/STM32F401RETx_FLASH.ld"));

To the build.zig of the zig program too.

1 Like