.github | ||
LICENSE | ||
README.md |
Apache NuttX RTOS on PinePhone
Apache NuttX RTOS now runs on Arm Cortex-A53 with Multi-Core SMP...
https://github.com/apache/incubator-nuttx/tree/master/boards/arm64/qemu/qemu-a53
PinePhone is based on Allwinner A64 SoC with 4 Cores of Arm Cortex-A53...
https://wiki.pine64.org/index.php/PinePhone
Will NuttX run on PinePhone? Let's find out!
Why NuttX?
NuttX might be a fun way to teach more people about the internals of Phone Operating Systems.
Someday we might have a cheap, fast, responsive and tweakable phone running on NuttX!
Many thanks to qinwei2004 and the NuttX Team for implementing Cortex-A53 support!
Download NuttX
TODO
mkdir nuttx
cd nuttx
git clone --recursive --branch arm64 \
https://github.com/lupyuen/incubator-nuttx \
nuttx
git clone --recursive --branch arm64 \
https://github.com/lupyuen/incubator-nuttx-apps \
apps
cd nuttx
Install prerequisites, skip the RISC-V Toolchain...
https://lupyuen.github.io/articles/nuttx#install-prerequisites
Download Toolchain
TODO
Instructions:
https://github.com/apache/incubator-nuttx/tree/master/boards/arm64/qemu/qemu-a53
Download toolchain for AArch64 ELF bare-metal target (aarch64-none-elf)
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
For macOS:
For x64 Linux:
Add to PATH: /Applications/ArmGNUToolchain/11.3.rel1/aarch64-none-elf/bin
export PATH="$PATH:/Applications/ArmGNUToolchain/11.3.rel1/aarch64-none-elf/bin"
Download QEMU
TODO
Download QEMU: https://www.qemu.org/download/
brew install qemu
Build NuttX: Single Core
TODO
Configure NuttX and compile...
./tools/configure.sh -l qemu-a53:nsh
make
Test with qemu...
qemu-system-aarch64 \
-cpu cortex-a53 \
-nographic \
-machine virt,virtualization=on,gic-version=3 \
-net none \
-chardev stdio,id=con,mux=on \
-serial chardev:con \
-mon chardev=con,mode=readline \
-kernel ./nuttx
Build NuttX: Multi Core
TODO
Configure NuttX and compile...
./tools/configure.sh -l qemu-a53:nsh_smp
make
Test with qemu...
qemu-system-aarch64 \
-smp 4 \
-cpu cortex-a53 \
-nographic \
-machine virt,virtualization=on,gic-version=3 \
-net none \
-chardev stdio,id=con,mux=on \
-serial chardev:con \
-mon chardev=con,mode=readline \
-kernel ./nuttx
Analyse PinePhone Image with Ghidra
TODO: Disassemble a PinePhone Image with Ghidra to look at the Startup Code
https://github.com/dreemurrs-embedded/Jumpdrive
Download https://github.com/dreemurrs-embedded/Jumpdrive/releases/download/0.8/pine64-pinephone.img.xz
Expand pine64-pinephone.img.xz
Expand the files inside...
gunzip Image.gz
gunzip initramfs.gz
tar xvf initramfs
Import Image
as AARCH64:LE:v8A:default...
- Processor: AARCH64
- Variant: v8A
- Size: 64
- Endian: little
- Compiler: default
Image
seems to start at 0x40000000, as suggested by this Memory Map...
https://linux-sunxi.org/A64/Memory_map
Click Window > Memory Map
Click "ram"
Click the 4-Arrows icon (Move a block to another address)
Change Start Address to 40000000
TODO
TODO: Verify that NuttX uses similar Startup Code
TODO: Build UART Driver in NuttX for Allwinner A64 SoC
UART0 Memory Map: https://linux-sunxi.org/A64/Memory_map
More about A64 UART: https://linux-sunxi.org/UART
TODO: Configure NuttX Memory Regions for Allwinner A64 SoC
TODO: Copy NuttX to microSD Card
A64 Boot ROM: https://linux-sunxi.org/BROM#A64
A64 U-Boot: https://linux-sunxi.org/U-Boot
A64 U-Boot SPL: https://linux-sunxi.org/BROM#U-Boot_SPL_limitations
SD Card Layout: https://linux-sunxi.org/Bootable_SD_card#SD_Card_Layout
TODO: Boot NuttX on PinePhone and test NuttX Shell
TODO: Build NuttX Drivers for PinePhone's LCD Display, Touch Panel, LTE Modem, WiFi, BLE, Power Mgmt, ...
TODO: From Alan Carvalho de Assis
Hi Lup, that is a nice idea! I ran NuttX on PCDuino (ARM Cortex-A9 I think), also NuttX run on iMX6 and BeagleBoneBlack, they boards with processors instead MCU are nice to try evolve NuttX on Desktop direction. There is a Tom Window Manager that Greg ported to NuttX
It is in my TODO to port NanoX (nxlib/microwindows) it could open doors to port X11 graphic applications from Linux