update to master (#19)

wch-ch32v003
Matt Knight 2 years ago committed by GitHub
parent 0713809eaf
commit e3562492df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,13 +10,15 @@ const board_path = comptimePrint("{s}/src/raspberry_pi_pico.zig", .{root()});
const hal_path = comptimePrint("{s}/src/hal.zig", .{root()}); const hal_path = comptimePrint("{s}/src/hal.zig", .{root()});
const linkerscript_path = comptimePrint("{s}/rp2040.ld", .{root()}); const linkerscript_path = comptimePrint("{s}/rp2040.ld", .{root()});
pub const BuildOptions = struct {}; pub const BuildOptions = struct {
optimize: std.builtin.OptimizeMode,
};
pub fn addPiPicoExecutable( pub fn addPiPicoExecutable(
builder: *Builder, builder: *Builder,
name: []const u8, name: []const u8,
source: []const u8, source: []const u8,
_: BuildOptions, options: BuildOptions,
) microzig.EmbeddedExecutable { ) microzig.EmbeddedExecutable {
const rp2040 = microzig.Chip{ const rp2040 = microzig.Chip{
.name = "RP2040", .name = "RP2040",
@ -41,7 +43,8 @@ pub fn addPiPicoExecutable(
source, source,
.{ .board = raspberry_pi_pico }, .{ .board = raspberry_pi_pico },
.{ .{
.hal_package_path = .{ .path = hal_path }, .optimize = options.optimize,
.hal_module_path = .{ .path = hal_path },
}, },
); );
ret.inner.setLinkerScriptPath(.{ .path = linkerscript_path }); ret.inner.setLinkerScriptPath(.{ .path = linkerscript_path });
@ -53,8 +56,8 @@ pub fn addPiPicoExecutable(
// package. In an attempt to modularize -- designing for a case where a // package. In an attempt to modularize -- designing for a case where a
// project requires multiple HALs, it accepts microzig as a param // project requires multiple HALs, it accepts microzig as a param
pub fn build(b: *Builder) !void { pub fn build(b: *Builder) !void {
const mode = b.standardReleaseOptions(); const optimize = b.standardOptimizeOption(.{});
var examples = Examples.init(b, mode); var examples = Examples.init(b, optimize);
examples.install(); examples.install();
} }
@ -71,16 +74,15 @@ pub const Examples = struct {
uart: microzig.EmbeddedExecutable, uart: microzig.EmbeddedExecutable,
//uart_pins: microzig.EmbeddedExecutable, //uart_pins: microzig.EmbeddedExecutable,
pub fn init(b: *Builder, mode: std.builtin.Mode) Examples { pub fn init(b: *Builder, optimize: std.builtin.OptimizeMode) Examples {
var ret: Examples = undefined; var ret: Examples = undefined;
inline for (@typeInfo(Examples).Struct.fields) |field| { inline for (@typeInfo(Examples).Struct.fields) |field| {
@field(ret, field.name) = addPiPicoExecutable( @field(ret, field.name) = addPiPicoExecutable(
b, b,
field.name, field.name,
comptime root() ++ "/examples/" ++ field.name ++ ".zig", comptime root() ++ "/examples/" ++ field.name ++ ".zig",
.{}, .{ .optimize = optimize },
); );
@field(ret, field.name).setBuildMode(mode);
} }
return ret; return ret;

2
deps/microzig vendored

@ -1 +1 @@
Subproject commit 4f0d25220ec8f0501f8e0e9f6765689eb32faa5f Subproject commit 9ccde9ff371b355394f65eacb6b51c5880768505
Loading…
Cancel
Save