-
Notifications
You must be signed in to change notification settings - Fork 1.4k
arch/arm64: Add support for PINE64 PinePhone Pro #10193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Very nice @annerajb !!! Please fix the check style issues reported by the CI. You can run this command to confirm everything is fine before push the commit: And since you will create a new commit, only to fix the issue, you need to squash them: |
|
Hi @annerajb: Thank you so much for porting NuttX to PinePhone Pro! As Alan mentioned, we need to tidy up the code, here are some tips... I wrote a guide on submitting a NuttX PR, it might be helpful: To support PinePhone Pro we'll need to add a new NuttX Arch (SoC) and NuttX Board:
The steps are explained here: But that's for RISC-V. For Arm64 we can follow this PR (but probably better to split into one PR for Arch and another PR for Board): We might be able to reuse the NuttX 16550 UART Driver: Remember to enable 16550_WAIT_LCR. And set 16550_REGINCR to 4. (I think) |
|
Removing draft so I can get the CI to start running the check. |
please squash your change into one patch. |
Done lmk what CI reports I also took care (or tried) as many style checks as I saw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks!
|
@annerajb Maybe you could Rebase with Master, to force the rebuild: https://lupyuen.github.io/articles/pr#submit-the-pull-request Normally when the build fails, I take a peek at other recent PRs. If they didn't fail the build, then it's probably OK to Rebase with Master to force the Rebuild. Thanks! |
It says it's waiting on approval from a mantainer to start running the workflows / pipelines |
|
@annerajb Something seems incorrect in our PinePhone Pro Build Config, |
|
@annerajb Found the problem, the Then try doing a fresh new build from scratch, hope that it works. Thanks! https://github.com/apache/nuttx/tree/master/boards/arm64/a64/pinephone/include Update: I see a Update 2: Sorry could we update the PR Summary, Impact and Testing? I believe we have a screenshot of NuttX booting on PinePhone Pro, that would be perfect for the Testing section. Thanks! Here's how we did it for PinePhone: #7692 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks tools/configure.sh pinephonepro/nsh works OK now. I'm not sure what's this ccache error, maybe it's my old macOS?
→ make
Create version.h
LN: platform/board to /private/tmp/nuttx/apps/platform/dummy
Register: hello
Register: leds
Register: nsh
Register: sh
Register: getprime
Register: ostest
CC: clock/clock.c /bin/bash: ccache: command not found
make[1]: *** [Makefile:60: clock.o] Error 127
make: *** [tools/LibTargets.mk:65: sched/libsched.a] Error 2
|
No it's my default config I enabled ccache to make it build faster and left it enabled on the default nsh config. |
I approved the workflows to run. |
87d5233 to
a72fdce
Compare
|
@lupyuen @hartmannathan |
I just approved it. Once again: nice work @annerajb |
|
Hmm riscv failed and caused canncelation of all other targets <_< |
Toolchain is not installed in this buildbot? |
|
Fixed here: #10348 |
|
Hmmm seems to be a problem with the common queue.h, not due to our PR... |
Yup master never built and failed the same way 10 hours ago |
|
@annerajb Very sorry about this, other PRs are also failing with the same issue: https://github.com/apache/nuttx/pulls We might need to wait for this to be fixed, then rebase with master and rebuild 🙏 |
|
@annerajb please rebase your patch, the break should be fixed by #10370 and apache/nuttx-apps#1990. |
Pinephone Pro port just nsh Status: booting till GICD / IRQ issue style cleanups start to fix style checks revert offset whitespaces revert a64 bringup file prob last cleanup more cleanups remove dts move changes from a64 hardware specific folders to rk3399 undo common changes (except head.s) revert gitignore missing irq.h and rk3399_serial.c need to finish cleaning them up WIP add source for load address make debug print hex again add board include Pinephone Pro port just nsh Status: booting till GICD / IRQ issue style cleanups start to fix style checks revert offset whitespaces revert a64 bringup file prob last cleanup more cleanups remove dts move changes from a64 hardware specific folders to rk3399 undo common changes (except head.s) revert gitignore missing irq.h and rk3399_serial.c need to finish cleaning them up WIP add source for load address remove ccache, add board memory map remove board reset
Done Can you approve the build / check? |
|
or @hartmannathan |
Someone got there faster than me :-) |
|
Looks great to me, approved. Thank you so much for contributing the PinePhone Pro port! :-) |
|
Please remove unnecessary comments in the commit log next time. |
|
@annerajb Thanks again for porting NuttX to PinePhone Pro, your contribution is super valuable for learning the Internals of a Modern Smartphone! I have some suggestions for the next steps:
As always, lemme know if you need any help :-) Update 10 Sep 2023: Now adding RK3399 GPIO |
Feel free to broadcast on the forum my roadmap is i2c, touch (mostly to confirm i2c is all good) I have a new PR planned for the board reset support will rename the bring up file on that one. |
|
Thanks @annerajb I have announced the project on Pine64 Forum. I hope NuttX on PinePhone Pro will become a Daily Driver. Or maybe we can teach it in schools! :-) |
|
@annerajb whats the correct way to build, you flash onto a micro sd card with tow boot installed and it should boot? Is there any way to format the memory card because just using the basic build commands it doesn't seem to be able to detect a partition table on the memory card git clone https://github.com/apache/nuttx.git and the .gz image is what I flash with balena etcher to sd card, seems to be latest Tow-Boot TPL 2022.07 Tow-Boot SPL 2022.07 Tow-Boot 2022.07 006 [variant: spi] SoC: Rockchip rk3399 In: serial Device 0: unknown device Executing script at 00500000Wrong image format for "source" command ERROR: Could not boot anything from distro_bootcmd. |
No I flashed a random pinephone pro image that didn't use a uefi boot and modified the .conf file from grub to specify the copied over image.gz Will paste a example later today and try to find what's the distro I flashed with balena |
|
https://github.com/webOS-ports/meta-pine64-luneos/releases/tag/20211220-v1 then I deleted the copied the |
Great thank you for sharing I will go through this and give it a try soon.. makes sense I wasn't sure if you were using the image.gz file directly |
Refs: apache#10193 https://github.com/u-boot/u-boot/tree/v2022.04 https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M4 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Refs: apache#10193 https://github.com/u-boot/u-boot/tree/v2022.04 https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M4 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Refs: apache#10193 https://github.com/u-boot/u-boot/tree/v2022.04 https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M4 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Refs: apache#10193 https://github.com/u-boot/u-boot/tree/v2022.04 https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M4 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Refs: #10193 https://github.com/u-boot/u-boot/tree/v2022.04 https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M4 Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Summary
Added the basics for nsh shell to work
Got GPIO and leds in a different branch but those will be added separately
Impact
With this PR, PinePhone Pro boots successfully to nsh (via microSD Card) and runs console apps.
We select PinePhone Pro through the new Board Configuration pinephonepro:nsh:
./tools/configure.sh -l pinephonepro:nsh
There is no impact on the existing implementation of QEMU for Armv8-A (qemu-armv8a) or any other.
Testing
We tested by booting PinePhone Pro with a microSD Card that contains NuttX after booting with towboot as SPL
Afterwards it loads from the sdcard the Image.gz
Log of the shell booting and accepting shell input usleep:
In: serial Out: serial Err: serial Model: Pine64 PinePhonePro Net: No ethernet found. starting USB... Bus usb@fe380000: ehci_generic usb@fe380000: Failed to get clocks (ret=-19) Port not available. Bus usb@fe3a0000: USB OHCI 1.0 Bus usb@fe3c0000: ehci_generic usb@fe3c0000: Failed to get clocks (ret=-19) Port not available. Bus usb@fe3e0000: USB OHCI 1.0 scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Please press [ESCAPE] or [CTRL+C] to enter the boot menu. off off switch to partitions #0, OK mmc0(part 0) is current device Scanning mmc 0:1... Found U-Boot script /boot.scr 788 bytes read in 9 ms (85 KiB/s) ## Executing script at 00500000 Bad data crc SCRIPT FAILED: continuing... No EFI system partition BootOrder not defined EFI boot manager: Cannot load any image switch to partitions #0, OK mmc1 is current device Scanning mmc 1:1... Found /extlinux/extlinux.conf Retrieving file: /extlinux/extlinux.conf U-Boot menu 1:Mobian GNU/Linux 6.1-rockchip Enter choice: 1:Mobian GNU/Linux 6.1-rockchip Retrieving file: /Image.gz Retrieving file: /rk3399-pinephone-pro.dtb Uncompressing Kernel Image ## Flattened Device Tree blob at 01f00000 Booting using the fdt blob at 0x1f00000 Loading Device Tree to 00000000f4ed2000, end 00000000f4ee62fb ... OK Starting kernel ... - Ready to Boot Primary CPU - Boot from EL2 - Boot from EL1 - Boot to C runtime for OS Initialize nsh: mkfatfs: command not found NuttShell (NSH) NuttX-12.2.1 nsh> 52;164Rhelphelp help usage: help [-v] [<cmd>] . cd env kill pwd true [ cp exec ls rm truncate ? cmp exit mkdir rmdir uname alias dirname false mkrd set umount unalias dd fdinfo mount sleep unset basename df free mv source uptime break dmesg help printf test usleep cat echo hexdump ps time xd Builtin Apps: sh getprime ostest nsh hello leds nsh> esleeusleep 1000 nsh> Ausleep 1000Dusleep 1000Dusleep 1000Dusleep 1000BBusleep 3000 nsh> Ausleep 30000 nsh> 6~Ausleep 300000 nsh>