Skip to content

minimal Zig embedded ARM example (STM32F103 blue pill)

Notifications You must be signed in to change notification settings

tralamazza/embedded_zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

embedded_zig

A "minimal" ARM cortex-M firmware in Zig running on a STM32F103. It blinks.

building

Get GNU Arm Embedded Toolchain and Zig in PATH and type:

make

running on a bluepill

Run OpenOCD on a terminal:

openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg

Open your favorite GDB:

arm-none-eabi-gdb firmware.elf -ex 'target extended-remote :3333'
load
r

Bonus: you can type make inside gdb and load it again.

issues

If you have any linking issues uncomment the line below (in the Makefile) to use GNU ld:

#    zig build-exe ${BUILD_FLAGS} $(OBJS:%=--object %) --name $@.elf --linker-script ${LINKER_SCRIPT}
   arm-none-eabi-ld ${OBJS} -o $@.elf -T ${LINKER_SCRIPT} -Map $@.map --gc-sections

raq (rarely asked questions)

a) Shouldn't the Makefile...

A: lalalala

b) How do I flash this?

A: see running on a bluepill

c) Why didn't you use @cImport()?

A: yes

About

minimal Zig embedded ARM example (STM32F103 blue pill)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published