const std = @import("std");
const microzig = @import("microzig");
const MicroBuild = microzig.MicroBuild(.{
.rp2xxx = true,
});
pub fn build(b: *std.Build) void {
const mz_dep = b.dependency("microzig", .{});
const mb = MicroBuild.init(b, mz_dep) orelse return;
const uart = mb.add_firmware(.{
.name = "uart",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .Debug,
.root_source_file = b.path("src/uart.zig"),
});
mb.install_firmware(uart, .{});
const pr11 = mb.add_firmware(.{
.name = "pr11",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr11.zig"),
});
mb.install_firmware(pr11, .{});
const pr21 = mb.add_firmware(.{
.name = "pr21",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr21.zig"),
});
mb.install_firmware(pr21, .{});
const pr22 = mb.add_firmware(.{
.name = "pr22",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr22.zig"),
});
mb.install_firmware(pr22, .{});
const pr41 = mb.add_firmware(.{
.name = "pr41",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr41.zig"),
});
mb.install_firmware(pr41, .{});
const pr42 = mb.add_firmware(.{
.name = "pr42",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr42.zig"),
});
mb.install_firmware(pr42, .{});
const pr51 = mb.add_firmware(.{
.name = "pr51",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr51.zig"),
});
mb.install_firmware(pr51, .{});
const pr61 = mb.add_firmware(.{
.name = "pr61",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr61.zig"),
});
mb.install_firmware(pr61, .{});
const pr62 = mb.add_firmware(.{
.name = "pr62",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pr62.zig"),
});
mb.install_firmware(pr62, .{});
const pr071 = mb.add_firmware(.{
.name = "pr071",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/071-serial_usb.zig"),
});
mb.install_firmware(pr071, .{});
const pr091 = mb.add_firmware(.{
.name = "pr091",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/091-potmeter.zig"),
});
mb.install_firmware(pr091, .{});
const pr101 = mb.add_firmware(.{
.name = "pr101",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/101-potmeter_ledblock.zig"),
});
mb.install_firmware(pr101, .{});
const pr102 = mb.add_firmware(.{
.name = "pr102",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/102-potmeter_rgbled.zig"),
});
mb.install_firmware(pr102, .{});
const pr111 = mb.add_firmware(.{
.name = "pr111",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/111-photores_led.zig"),
});
mb.install_firmware(pr111, .{});
const pr131 = mb.add_firmware(.{
.name = "pr131",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/131-joystick.zig"),
});
mb.install_firmware(pr131, .{});
const pr141 = mb.add_firmware(.{
.name = "pr141",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/141-595_led_bar.zig"),
});
mb.install_firmware(pr141, .{});
// We call this twice to demonstrate that the default binary output for
// RP2040 is UF2, but we can also output other formats easily
// mb.install_firmware(firmware, .{ .format = .elf });
}