From d5c93ba33d0344bfb12415fd632577c639369b75 Mon Sep 17 00:00:00 2001 From: Matt Knight Date: Thu, 3 Aug 2023 21:12:49 -0700 Subject: [PATCH] anyopaque to u8 --- src/modules/cpus/cortex-m.zig | 13 ++++++++----- src/modules/cpus/riscv32.zig | 13 ++++++++----- src/start.zig | 13 ++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) 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 {