Zig on PinePhone and processor cores

Thanks to the support here, and the Lupyuen tutorials, I finally got my PinePhone SoC booting as far as LCD with a framebuffer that I can draw on! Only 231 pokes() required :slight_smile: ~3k lines of Zig, and a small assembly boot header.

The boot process is a little strange, and I think I am the third ‘OS’ along the chain. So what I am not sure about is which core I am running on.

Does Zig expose anything that low level? for example, which core am I on, how many cores total, ‘run this code on core 2’, or am I going to have to drop down to some inline assembly here? Although I have done some 68000 assembly, these modern SoCs are a bit of a mystery to me! but fun to play with, especially with nice features in Zig like the packed structs. Thanks.

1 Like

You will have to use inline assembly, or find a library that does it for you, probably in c.

Okay, I found some info (based on Rasperry Pi) but seems applicable. Just involves some assembly and the register ‘mpidr_el1’. Seems like the rest is handled by SoC. I wasnt sure if Zig Threads mapped down to the metal, but I guess there is normally a real OS below :slight_smile: Thanks.