Re: Bare metal Zig on Raspberry Pi 4B?

Message ID
DKIM signature
Download raw message
ok, so I finally found an example to get me started, but can anyone 
comment if this is a good starting template?  and do I need to rely on 
external linker, since I read rumors of internal linker possibilities?


On 22/02/2023 10:38, Peter Bridge wrote:
> 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:
> https://github.com/isometimes/rpi4-osdev/tree/master/part1-bootstrapping
> 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)