aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/install_raw_hex/build.zig
blob: c12949a9cec08b55180d367f07197d5e451a1b66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const builtin = @import("builtin");
const std = @import("std");

pub fn build(b: *std.Build) void {
    const test_step = b.step("test", "Test it");
    b.default_step = test_step;

    const target = b.resolveTargetQuery(.{
        .cpu_arch = .thumb,
        .cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
        .os_tag = .freestanding,
        .abi = .gnueabihf,
    });

    const optimize: std.builtin.OptimizeMode = .Debug;

    const elf = b.addExecutable(.{
        .name = "zig-nrf52-blink.elf",
        .root_module = b.createModule(.{
            .root_source_file = b.path("main.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });

    const hex_step = elf.addObjCopy(.{
        .basename = "hello.hex",
    });
    test_step.dependOn(&hex_step.step);

    const explicit_format_hex_step = elf.addObjCopy(.{
        .basename = "hello.foo",
        .format = .hex,
    });
    test_step.dependOn(&explicit_format_hex_step.step);
}