Update microzig (#26)

* update microzig

* update to new api

---------

Co-authored-by: mattnite <mattnite@users.noreply.github.com>
wch-ch32v003
Matt Knight 2 years ago committed by GitHub
parent 58d73abc08
commit 3b129e1ca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,11 +2,12 @@ const std = @import("std");
const Builder = std.build.Builder;
const Pkg = std.build.Pkg;
const comptimePrint = std.fmt.comptimePrint;
const FileSource = std.build.FileSource;
pub const microzig = @import("deps/microzig/build.zig");
const chips = @import("src/chips.zig");
const boards = @import("src/boards.zig");
pub const chips = @import("src/chips.zig");
pub const boards = @import("src/boards.zig");
const linkerscript_path = root() ++ "rp2040.ld";
@ -14,24 +15,23 @@ pub const BuildOptions = struct {
optimize: std.builtin.OptimizeMode,
};
pub const PicoExecutableOptions = struct {
name: []const u8,
source_file: FileSource,
optimize: std.builtin.OptimizeMode = .Debug,
};
pub fn addPiPicoExecutable(
builder: *Builder,
name: []const u8,
source: []const u8,
options: BuildOptions,
opts: PicoExecutableOptions,
) *microzig.EmbeddedExecutable {
const ret = microzig.addEmbeddedExecutable(
builder,
name,
source,
.{ .board = boards.raspberry_pi_pico },
.{
.optimize = options.optimize,
},
);
ret.inner.setLinkerScriptPath(.{ .path = linkerscript_path });
return ret;
return microzig.addEmbeddedExecutable(builder, .{
.name = opts.name,
.source_file = opts.source_file,
.backing = .{ .board = boards.raspberry_pi_pico },
.optimize = opts.optimize,
.linkerscript_source_file = .{ .path = linkerscript_path },
});
}
// this build script is mostly for testing and verification of this
@ -61,12 +61,11 @@ pub const Examples = struct {
inline for (@typeInfo(Examples).Struct.fields) |field| {
const path = comptime root() ++ "examples/" ++ field.name ++ ".zig";
@field(ret, field.name) = addPiPicoExecutable(
b,
field.name,
path,
.{ .optimize = optimize },
);
@field(ret, field.name) = addPiPicoExecutable(b, .{
.name = field.name,
.source_file = .{ .path = path },
.optimize = optimize,
});
}
return ret;

2
deps/microzig vendored

@ -1 +1 @@
Subproject commit 11214ed8ba05e380a516beef3f3f594571a1c732
Subproject commit b6fc3abbf7a91cb0cdafc7843ac7e6c26042ff84

@ -12,7 +12,9 @@ const baud_rate = 115200;
const uart_tx_pin = 0;
const uart_rx_pin = 1;
pub const log = rp2040.uart.log;
pub const std_options = struct {
pub const logFn = rp2040.uart.log;
};
pub fn init() void {
rp2040.clock_config.apply();

@ -18,8 +18,10 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu
while (true) {}
}
pub const std_options = struct {
pub const log_level = .debug;
pub const log = rp2040.uart.log;
pub const logFn = rp2040.uart.log;
};
pub fn main() !void {
gpio.reset();

Loading…
Cancel
Save