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.
// Allow board and chip to override CPU vector table.
const vector_table = if (board != void and @hasDecl(board, "vector_table"))
board.vector_table
const export_opts = .{
.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"))
chip.vector_table
@export(chip.vector_table, export_opts)
else if (@hasDecl(cpu, "vector_table"))
cpu.vector_table
else
null;
if (@TypeOf(vector_table) != @TypeOf(null)) { // ugh, comptime shenanigans
@export(vector_table, .{
.name = "vector_table",
.section = "microzig_flash_start",
.linkage = .Strong,
});
}
@export(cpu.vector_table, export_opts)
else if (@hasDecl(app, "interrupts"))
@compileError("interrupts not configured");
}
/// This is the logical entry point for microzig.

@ -85,7 +85,7 @@ fn isValidField(field_name: []const u8) bool {
const VectorTable = microzig.chip.VectorTable;
// 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 = .{
.initial_stack_pointer = microzig.config.end_of_stack,
.Reset = .{ .C = microzig.cpu.startup_logic._start },

Loading…
Cancel
Save