![]() |
baremetal via Zig on PinePhone - JumpDrive help please - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120) +--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121) +--- Thread: baremetal via Zig on PinePhone - JumpDrive help please (/showthread.php?tid=19882) |
baremetal via Zig on PinePhone - JumpDrive help please - WhiteHexagon - 07-01-2025 background: 2 years ago, I was following along with @lupyuen great series of articles to get LVGL running on PinePhone. I was emulating the same journey but using Zig for all the hardware interfacing (and I got quite far). But at the time I was stuck on an old version of Zig and lost motivation. Now I finally have some hardware to run latest Zig, and I decided to port my project over to Zig 0.14 including it's new build system. I've struggled for a few days to recreate the environment I had running (I also switched from macos to to Linux and still learning!). So I decided to go back to basics, and try to understand how NuttX interects with the JumpDrive image. This is what I tried: 1. compiling some very simple Zig code, that should toggle the phone LEDs. 2. build the above as an elf file for arm freestanding with a target of cortex_a53 3. created a simple .ld linker file that ensure my entry point is at 0x40080000 4. using objCopy extract hex via the -O binary 5. gzip the resulting binary file into Image.gz I was expecting that whatever the JumpDrive util does, it somehow jumps to executing the code directly from Image.gz. However now I suspect that this .gz might be a bit more complicated than straight arm machine code. But I have no idea what? and I struggle to follow the NuttX build (maybe something to do with a util called binfmt? but also I saw mention of nxflat). Ultimately it would be nice to find a way to deploy to PinePhone as 'baremetal'. But for now the JumpDrive 'hack' would be enough, allowing me to hop between SDCards to compare/debug different images. Does anyone have any idea how to wrap my baremetal code into something JumpDrive can recognize from the Image.gz file please. RE: baremetal via Zig on PinePhone - JumpDrive help please - WhiteHexagon - 07-07-2025 Finally, booting Zig code 'baremetal' (via JumpDrive trick used by Nuttx) ![]() ![]() |