diff --git a/src/modules/cpus/cortex-m.zig b/src/modules/cpus/cortex-m.zig index b37e12bf..b9b58289 100644 --- a/src/modules/cpus/cortex-m.zig +++ b/src/modules/cpus/cortex-m.zig @@ -70,11 +70,14 @@ pub fn clrex() void { pub const startup_logic = struct { extern fn microzig_main() noreturn; - extern var microzig_data_start: anyopaque; - extern var microzig_data_end: anyopaque; - extern var microzig_bss_start: anyopaque; - extern var microzig_bss_end: anyopaque; - extern const microzig_data_load_start: anyopaque; + // it looks odd to just use a u8 here, but in C it's common to use a + // char when linking these values from the linkerscript. What's + // important is the addresses of these values. + extern var microzig_data_start: u8; + extern var microzig_data_end: u8; + extern var microzig_bss_start: u8; + extern var microzig_bss_end: u8; + extern const microzig_data_load_start: u8; pub fn _start() callconv(.C) noreturn { diff --git a/src/modules/cpus/riscv32.zig b/src/modules/cpus/riscv32.zig index fea883b7..b7c1b962 100644 --- a/src/modules/cpus/riscv32.zig +++ b/src/modules/cpus/riscv32.zig @@ -47,11 +47,14 @@ pub const REGBYTES = (1 << LOG_REGBYTES); pub const startup_logic = struct { extern fn microzig_main() noreturn; - extern var microzig_data_start: anyopaque; - extern var microzig_data_end: anyopaque; - extern var microzig_bss_start: anyopaque; - extern var microzig_bss_end: anyopaque; - extern const microzig_data_load_start: anyopaque; + // it looks odd to just use a u8 here, but in C it's common to use a + // char when linking these values from the linkerscript. What's + // important is the addresses of these values. + extern var microzig_data_start: u8; + extern var microzig_data_end: u8; + extern var microzig_bss_start: u8; + extern var microzig_bss_end: u8; + extern const microzig_data_load_start: u8; pub fn _start() callconv(.C) noreturn { diff --git a/src/start.zig b/src/start.zig index 59ec4cd4..7271ad29 100644 --- a/src/start.zig +++ b/src/start.zig @@ -127,11 +127,14 @@ export fn microzig_main() noreturn { /// Contains references to the microzig .data and .bss sections, also /// contains the initial load address for .data if it is in flash. pub const sections = struct { - extern var microzig_data_start: anyopaque; - extern var microzig_data_end: anyopaque; - extern var microzig_bss_start: anyopaque; - extern var microzig_bss_end: anyopaque; - extern const microzig_data_load_start: anyopaque; + // it looks odd to just use a u8 here, but in C it's common to use a + // char when linking these values from the linkerscript. What's + // important is the addresses of these values. + extern var microzig_data_start: u8; + extern var microzig_data_end: u8; + extern var microzig_bss_start: u8; + extern var microzig_bss_end: u8; + extern const microzig_data_load_start: u8; }; pub fn initialize_system_memories() void {