uf2/README.md

31 lines
852 B
Markdown
Raw Normal View History

2022-04-16 09:00:30 +08:00
# uf2
2022-04-16 09:00:30 +08:00
USB Flashing Format (UF2) for your build.zig
2022-04-16 09:01:59 +08:00
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 {
// ...
2023-06-26 02:28:19 +08:00
const uf2_dep = b.dependency("uf2", .{});
2023-06-26 02:28:19 +08:00
const elf2uf2_run = b.addRunArtifact(uf2_dep.artifact("elf2uf2"));
// family id
elf2uf2_run.addArgs(&.{"--family-id", "RP2040"});
// elf file
elf2uf2_run.addArg("--elf-path");
2023-06-26 02:32:42 +08:00
elf2uf2_run.addArtifactArg(exe);
2023-06-26 02:28:19 +08:00
// output file
const uf2_file = elf2uf2_run.addPrefixedOutputFileArg("--output-path", "test.uf2");
2023-06-26 02:32:18 +08:00
_ = b.addInstallFile(uf2_file, "bin/test.uf2");
}
```