use the 'Signal' calling convention by default on AVR for ISRs, allow to explicitly use signal or interrupt calling conventions (#32)

wch-ch32v003
Matt Knight 3 years ago committed by GitHub
parent 4384c5e9fa
commit e44d8bf576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,12 +59,14 @@ pub const vector_table = blk: {
const exported_fn = switch (calling_convention) { const exported_fn = switch (calling_convention) {
.Unspecified => struct { .Unspecified => struct {
fn wrapper() callconv(.Interrupt) void { fn wrapper() callconv(.Signal) void {
if (calling_convention == .Unspecified) // TODO: workaround for some weird stage1 bug if (calling_convention == .Unspecified) // TODO: workaround for some weird stage1 bug
@call(.{ .modifier = .always_inline }, handler, .{}); @call(.{ .modifier = .always_inline }, handler, .{});
} }
}.wrapper, }.wrapper,
else => @compileError("Just leave interrupt handlers with an unspecified calling convention"), .Signal => handler,
.Interrupt => handler,
else => @compileError("Calling conventions for interrupts must be 'Interrupt', 'Signal', or unspecified. The signal calling convention leaves global interrupts disabled during the ISR, where the interrupt calling conventions enables global interrupts for nested ISRs."),
}; };
const exported_name = "microzig_isr_" ++ field.name; const exported_name = "microzig_isr_" ++ field.name;

Loading…
Cancel
Save