From e14f0a1e53002556e62928fc3848882cdaa7597a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20=22xq=22=20Quei=C3=9Fner?= Date: Tue, 19 Sep 2023 10:10:15 +0200 Subject: [PATCH] Adds some documentation comments --- build.zig | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index cac966e..c351ebc 100644 --- a/build.zig +++ b/build.zig @@ -5,15 +5,30 @@ const rp2040 = @import("rp2040"); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); + // `addFirmware` basically works like addExecutable, but takes a + // `microzig.Target` for target instead of a `std.zig.CrossTarget`. + // + // The target will convey all necessary information on the chip, + // cpu and potentially the board as well. const firmware = microzig.addFirmware(b, .{ .name = "blinky", - .target = rp2040.chips.rp2040, + .target = rp2040.boards.raspberrypi.pico, .optimize = optimize, .source_file = .{ .path = "src/blinky.zig" }, }); + // Pendant to `getEmittedBin()`: Always returns the path to the output elf file + _ = firmware.getEmittedElf(); + + // Extension of `getEmittedElf()` that will also convert the file to the given + // binary format. + _ = firmware.getEmittedBin(.uf2); + + // `installFirmware()` is the MicroZig pendant to `Build.installArtifact()` + // and allows installing the firmware as a typical firmware file. + // + // This will also install into `$prefix/firmware` instead of `$prefix/bin`. microzig.installFirmware(firmware, .{ - .format = .uf2, // .dfu, .bin, .hex, .elf, … }); }