fix missing vector table on ARM (#34)

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

@ -98,21 +98,20 @@ comptime {
// that is either called (Cortex-M) or executed (AVR) when initalized. // that is either called (Cortex-M) or executed (AVR) when initalized.
// Allow board and chip to override CPU vector table. // Allow board and chip to override CPU vector table.
const vector_table = if (board != void and @hasDecl(board, "vector_table")) const export_opts = .{
board.vector_table .name = "vector_table",
.section = "microzig_flash_start",
.linkage = .Strong,
};
if ((board != void and @hasDecl(board, "vector_table")))
@export(board.vector_table, export_opts)
else if (@hasDecl(chip, "vector_table")) else if (@hasDecl(chip, "vector_table"))
chip.vector_table @export(chip.vector_table, export_opts)
else if (@hasDecl(cpu, "vector_table")) else if (@hasDecl(cpu, "vector_table"))
cpu.vector_table @export(cpu.vector_table, export_opts)
else else if (@hasDecl(app, "interrupts"))
null; @compileError("interrupts not configured");
if (@TypeOf(vector_table) != @TypeOf(null)) { // ugh, comptime shenanigans
@export(vector_table, .{
.name = "vector_table",
.section = "microzig_flash_start",
.linkage = .Strong,
});
}
} }
/// This is the logical entry point for microzig. /// This is the logical entry point for microzig.

@ -85,7 +85,7 @@ fn isValidField(field_name: []const u8) bool {
const VectorTable = microzig.chip.VectorTable; const VectorTable = microzig.chip.VectorTable;
// will be imported by microzig.zig to allow system startup. // will be imported by microzig.zig to allow system startup.
pub const vector_table: VectorTable = blk: { pub var vector_table: VectorTable = blk: {
var tmp: microzig.chip.VectorTable = .{ var tmp: microzig.chip.VectorTable = .{
.initial_stack_pointer = microzig.config.end_of_stack, .initial_stack_pointer = microzig.config.end_of_stack,
.Reset = .{ .C = microzig.cpu.startup_logic._start }, .Reset = .{ .C = microzig.cpu.startup_logic._start },

Loading…
Cancel
Save