This fork contains my tests and examples for some arduino programs in zig, based on the the upstream https://github.com/FireFox317/avr-arduino-zig and some extensions from https://github.com/Guigui220D/avr-arduino-zig
This project can build code that can be run on an Arduino Uno, using only Zig as its only dependency.
Currently only avrdude
is an external dependency that is needed to program the chip.
zig build -Dname=examples/lcd.zig
creates the executable.zig build upload -Dtty=/dev/ttyACM0 -Dname=examples/lcd.zig
uploads the code to an Arduino connected to/dev/ttyACM0
.zig build monitor -Dtty=/dev/ttyACM0
shows the serial monitor usingscreen
.zig build objdump
shows the disassembly (avr-objdump
has to be installed).
avr-nm --size-sort --reverse-sort -td zig-out/bin/blink
shows sorted symbol sizes https://arduino.stackexchange.com/a/13219/77598
-
original api: https://github.com/arduino/ArduinoCore-API
-
libraries:
-
delay & delayMicros avr efficient implementation example: https://github.com/arduino/ArduinoCore-avr/blob/24e6edd475c287cdafee0a4db2eb98927ce3cf58/cores/arduino/wiring.c ArduinoCore-avr/cores/arduino/wiring.cs