master
 1const builtin = @import("builtin");
 2const std = @import("std");
 3
 4pub fn build(b: *std.Build) void {
 5    const test_step = b.step("test", "Test it");
 6    b.default_step = test_step;
 7
 8    const target = b.resolveTargetQuery(.{
 9        .cpu_arch = .thumb,
10        .cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
11        .os_tag = .freestanding,
12        .abi = .gnueabihf,
13    });
14
15    const optimize: std.builtin.OptimizeMode = .Debug;
16
17    const elf = b.addExecutable(.{
18        .name = "zig-nrf52-blink.elf",
19        .root_module = b.createModule(.{
20            .root_source_file = b.path("main.zig"),
21            .target = target,
22            .optimize = optimize,
23        }),
24    });
25
26    const hex_step = elf.addObjCopy(.{
27        .basename = "hello.hex",
28    });
29    test_step.dependOn(&hex_step.step);
30
31    const explicit_format_hex_step = elf.addObjCopy(.{
32        .basename = "hello.foo",
33        .format = .hex,
34    });
35    test_step.dependOn(&explicit_format_hex_step.step);
36}