update zig build api and family enum

wch-ch32v003
Matt Knight 2 years ago committed by Matt Knight
parent d862ff2b02
commit 72ca60a0d0

@ -1,25 +1,35 @@
const std = @import("std"); const std = @import("std");
pub fn build(b: *std.build.Builder) void { pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select const optimize = b.standardOptimizeOption(.{});
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const lib = b.addStaticLibrary("uf2", "src/main.zig"); const lib = b.addStaticLibrary(.{
lib.setBuildMode(mode); .name = "uf2",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
lib.install(); lib.install();
const main_tests = b.addTest("src/main.zig"); const main_tests = b.addTest(.{
main_tests.setBuildMode(mode); .root_source_file = .{ .path = "src/main.zig" },
});
const test_step = b.step("test", "Run library tests"); const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step); test_step.dependOn(&main_tests.step);
const gen = b.addExecutable("gen", "src/gen.zig"); const gen = b.addExecutable(.{
.name = "gen",
.root_source_file = .{ .path = "src/gen.zig" },
});
const gen_run_step = gen.run(); const gen_run_step = gen.run();
const gen_step = b.step("gen", "Generate family id enum"); const gen_step = b.step("gen", "Generate family id enum");
gen_step.dependOn(&gen_run_step.step); gen_step.dependOn(&gen_run_step.step);
const exe = b.addExecutable("example", "src/example.zig"); const exe = b.addExecutable(.{
.name = "example",
.root_source_file = .{ .path = "src/example.zig" },
});
exe.install(); exe.install();
} }

@ -1 +1 @@
Subproject commit ffe793f973ff8fc288365a2183c9727aa40aed07 Subproject commit 35842c770bf553ce01a48ded68f3763e5e140a1e

@ -30,5 +30,5 @@ pub fn main() !void {
\\ \\
, .{ entry.short_name, entry.id }); , .{ entry.short_name, entry.id });
try writer.writeAll("};\n"); try writer.writeAll(" _,\n};\n");
} }

@ -551,5 +551,8 @@ pub const FamilyId = enum(u32) {
RP2040 = 0xe48bff56, RP2040 = 0xe48bff56,
STM32L4 = 0x00ff6919, STM32L4 = 0x00ff6919,
GD32VF103 = 0x9af03e33, GD32VF103 = 0x9af03e33,
CSK4 = 0x4f6ace52,
CSK6 = 0x6e7348a8,
M0SENSE = 0x11de784a,
_, _,
}; };

Loading…
Cancel
Save