Hello, I was wondering if anyone have had any success in using zig as a build system for avr microcontrollers? I am struggling to link avr-libc. I tried the following, it compiles but the program is empty (not recognized by avrdude)
const std = @import("std");
const Builder = std.Build;
pub fn build(b: *std.Build) !void {
const uno = std.Target.Query{
.cpu_arch = .avr,
.cpu_model = .{ .explicit = &std.Target.avr.cpu.atmega328p },
.os_tag = .freestanding,
.ofmt = .elf
};
const exe = b.addExecutable(.{
.name = "blinker",
.target = b.resolveTargetQuery(uno),
.use_llvm = true,
.optimize = .ReleaseSafe,
});
exe.addCSourceFile(.{ .file = b.path("src/main.c"), .flags = &.{"-mmcu=atmega328p","-DF_CPU=16000000UL","-nostartfiles"} });
exe.addIncludePath(Builder.LazyPath{.cwd_relative = "/usr/avr/include/"});
b.installArtifact(exe);