Bare metal Zig on Raspberry Pi 4B?

Message ID
DKIM signature
Download raw message
I have been looking at Gokrazy, and I also found a C bare metal project 
for RPi, now I want to do the same with Zig :)  Firstly I am wondering 
if this is the correct architecture:

zig build-obj -Dtarget=aarch64-elf main.zig

The C example is here, and includes a lot of extra compile flags:


I also got the impression from other research that 'llvm-objcopy' 
ignores the elf stuff anyway.  It's many years since I was doing 68000 
assembly, so some catching up to do! :) but it sounds like Zig has some 
built in support for what I am trying to do.  I can see some inline 
assembly support! and also linker support, but struggling to find 
documentation... and ChatGPT is hilarious with Zig :)

Cheers Peter

PS I am macos 10.12 and Zig 8.1 ( I tried newer Zig but cant seem to get 
Zig to find my brew installed ncurses...)

export LDFLAGS="-L/usr/local/opt/ncurses/lib"

but I end up with:

dyld: Library not loaded: /usr/lib/libncurses.5.4.dylib
   Referenced from: /Users/me/Downloads/zig090/zig
   Reason: Incompatible library version: zig requires version 5.40.0 or 
later, but libncurses.5.4.dylib provides version 5.4.0
Abort trap: 6
Reply to thread Export thread (mbox)