catchup to self hosted (#96)

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

@ -16,10 +16,10 @@ pub fn build(b: *std.build.Builder) !void {
const BuildConfig = struct { name: []const u8, backing: Backing, supports_uart_test: bool = true }; const BuildConfig = struct { name: []const u8, backing: Backing, supports_uart_test: bool = true };
const all_backings = [_]BuildConfig{ const all_backings = [_]BuildConfig{
BuildConfig{ .name = "boards.arduino_nano", .backing = Backing{ .board = boards.arduino_nano } }, //BuildConfig{ .name = "boards.arduino_nano", .backing = Backing{ .board = boards.arduino_nano } },
BuildConfig{ .name = "boards.arduino_uno", .backing = Backing{ .board = boards.arduino_uno } }, //BuildConfig{ .name = "boards.arduino_uno", .backing = Backing{ .board = boards.arduino_uno } },
BuildConfig{ .name = "boards.mbed_lpc1768", .backing = Backing{ .board = boards.mbed_lpc1768 } }, BuildConfig{ .name = "boards.mbed_lpc1768", .backing = Backing{ .board = boards.mbed_lpc1768 } },
BuildConfig{ .name = "chips.atmega328p", .backing = Backing{ .chip = chips.atmega328p } }, //BuildConfig{ .name = "chips.atmega328p", .backing = Backing{ .chip = chips.atmega328p } },
BuildConfig{ .name = "chips.lpc1768", .backing = Backing{ .chip = chips.lpc1768 } }, BuildConfig{ .name = "chips.lpc1768", .backing = Backing{ .chip = chips.lpc1768 } },
//BuildConfig{ .name = "chips.stm32f103x8", .backing = Backing{ .chip = chips.stm32f103x8 } }, //BuildConfig{ .name = "chips.stm32f103x8", .backing = Backing{ .chip = chips.stm32f103x8 } },
BuildConfig{ .name = "boards.stm32f3discovery", .backing = Backing{ .board = boards.stm32f3discovery } }, BuildConfig{ .name = "boards.stm32f3discovery", .backing = Backing{ .board = boards.stm32f3discovery } },

@ -30,7 +30,7 @@ pub const Direction = enum(u1) {
output = 1, output = 1,
}; };
pub fn Gpio(comptime pin: type, config: anytype) type { pub fn Gpio(comptime pin: type, comptime config: anytype) type {
const mode = @as(Mode, config.mode); const mode = @as(Mode, config.mode);
const Generic = struct { const Generic = struct {
// all pins: // all pins:

@ -69,16 +69,14 @@ else
struct {}; struct {};
// Conditionally export log() if the app has it defined. // Conditionally export log() if the app has it defined.
usingnamespace if (@hasDecl(app, "log")) pub const log = if (@hasDecl(app, "log"))
struct { app.log
pub const log = app.log;
}
else else
// log is a no-op by default. Parts of microzig use the stdlib logging
// facility and compilations will now fail on freestanding systems that
// use it but do not explicitly set `root.log`
struct { struct {
// log is a no-op by default. Parts of microzig use the stdlib logging fn log(
// facility and compilations will now fail on freestanding systems that
// use it but do not explicitly set `root.log`
pub fn log(
comptime message_level: std.log.Level, comptime message_level: std.log.Level,
comptime scope: @Type(.EnumLiteral), comptime scope: @Type(.EnumLiteral),
comptime format: []const u8, comptime format: []const u8,
@ -89,7 +87,7 @@ else
_ = format; _ = format;
_ = args; _ = args;
} }
}; }.log;
/// The microzig default panic handler. Will disable interrupts and loop endlessly. /// The microzig default panic handler. Will disable interrupts and loop endlessly.
pub fn microzig_panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn { pub fn microzig_panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
@ -174,7 +172,7 @@ export fn microzig_main() noreturn {
const info: std.builtin.Type = @typeInfo(@TypeOf(main)); const info: std.builtin.Type = @typeInfo(@TypeOf(main));
const invalid_main_msg = "main must be either 'pub fn main() void' or 'pub fn main() !void'."; const invalid_main_msg = "main must be either 'pub fn main() void' or 'pub fn main() !void'.";
if (info != .Fn or info.Fn.args.len > 0) if (info != .Fn or info.Fn.params.len > 0)
@compileError(invalid_main_msg); @compileError(invalid_main_msg);
const return_type = info.Fn.return_type orelse @compileError(invalid_main_msg); const return_type = info.Fn.return_type orelse @compileError(invalid_main_msg);

@ -181,7 +181,6 @@ pub fn addEmbeddedExecutable(
.app_packages = std.ArrayList(Pkg).init(builder.allocator), .app_packages = std.ArrayList(Pkg).init(builder.allocator),
}; };
exe.inner.use_stage1 = true;
exe.inner.strip = false; // we always want debug symbols, stripping brings us no benefit on embedded exe.inner.strip = false; // we always want debug symbols, stripping brings us no benefit on embedded
// might not be true for all machines (Pi Pico), but // might not be true for all machines (Pi Pico), but

@ -1295,8 +1295,8 @@ pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile Mm
} }
pub const InterruptVector = extern union { pub const InterruptVector = extern union {
C: fn () callconv(.C) void, C: *const fn () callconv(.C) void,
Naked: fn () callconv(.Naked) void, Naked: *const fn () callconv(.Naked) void,
// Interrupt is not supported on arm // Interrupt is not supported on arm
}; };

@ -18797,8 +18797,8 @@ pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile Mm
} }
pub const InterruptVector = extern union { pub const InterruptVector = extern union {
C: fn () callconv(.C) void, C: *const fn () callconv(.C) void,
Naked: fn () callconv(.Naked) void, Naked: *const fn () callconv(.Naked) void,
// Interrupt is not supported on arm // Interrupt is not supported on arm
}; };

@ -34398,8 +34398,8 @@ pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile Mm
} }
pub const InterruptVector = extern union { pub const InterruptVector = extern union {
C: fn () callconv(.C) void, C: *const fn () callconv(.C) void,
Naked: fn () callconv(.Naked) void, Naked: *const fn () callconv(.Naked) void,
// Interrupt is not supported on arm // Interrupt is not supported on arm
}; };

@ -52830,8 +52830,8 @@ pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile Mm
} }
pub const InterruptVector = extern union { pub const InterruptVector = extern union {
C: fn () callconv(.C) void, C: *const fn () callconv(.C) void,
Naked: fn () callconv(.Naked) void, Naked: *const fn () callconv(.Naked) void,
// Interrupt is not supported on arm // Interrupt is not supported on arm
}; };

@ -53872,8 +53872,8 @@ pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile Mm
} }
pub const InterruptVector = extern union { pub const InterruptVector = extern union {
C: fn () callconv(.C) void, C: *const fn () callconv(.C) void,
Naked: fn () callconv(.Naked) void, Naked: *const fn () callconv(.Naked) void,
// Interrupt is not supported on arm // Interrupt is not supported on arm
}; };

Loading…
Cancel
Save