File size: 1,452 Bytes
e085b8b 612e2b2 | 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 37 38 | // SPDX-License-Identifier: LicenseRef-Sovereign-Leviathan-SL-AGPL3-001
// Licensing: see LICENSE in the repository root.
// Targets Zig 0.13.x. Build: `zig build` -> zig-out/bin/intent-v.elf
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.resolveTargetQuery(.{
.cpu_arch = .riscv32,
.os_tag = .freestanding,
.abi = .none,
.cpu_features_add = std.Target.riscv.featureSet(&.{.m}),
});
// Debug pulls in enough compiler-rt/panic code to overflow the 64K ROM
// (measured overflow: 149544 bytes). ReleaseSmall fits. Override with
// -Doptimize=Debug only if the linker ROM is enlarged.
const optimize = b.option(std.builtin.OptimizeMode, "optimize", "Optimization mode") orelse .ReleaseSmall;
const exe = b.addExecutable(.{
.name = "intent-v.elf",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.single_threaded = true,
});
exe.setLinkerScript(b.path("linker.ld"));
b.installArtifact(exe);
// Host-side unit tests for the register-level logic (no hardware needed).
const host_tests = b.addTest(.{
.root_source_file = b.path("src/ccu.zig"),
.target = b.standardTargetOptions(.{}),
.optimize = optimize,
});
const run_tests = b.addRunArtifact(host_tests);
b.step("test", "Run host-side unit tests").dependOn(&run_tests.step);
}
|