You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
858 B
Markdown

2 years ago
# uf2
2 years ago
USB Flashing Format (UF2) for your build.zig
2 years ago
This package is for assembling uf2 files from ELF binaries. This format is used for flashing a microcontroller over a mass storage interface, such as the Pi Pico.
See https://github.com/microsoft/uf2#file-containers for how we're going to embed file source into the format.
For use in a build.zig:
```zig
pub fn build(b: *Build) void {
// ...
const uf2_dep = b.dependency("uf2", .{});
const elf2uf2_run = b.addRunArtifact(uf2_dep.artifact("elf2uf2"));
// family id
elf2uf2_run.addArgs(&.{"--family-id", "RP2040"});
// elf file
elf2uf2_run.addArg("--elf-path");
elf2uf2_run.addArtifactArg(exe.inner);
// output file
const uf2_file = elf2uf2_run.addPrefixedOutputFileArg("--output-path", "test.uf2");
_ = b.addInstallFile(uf2_file, "bin/test.uf2");
}
```