Skip to content
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

arch/arm64: Add support for PINE64 PinePhone #7692

Merged
merged 2 commits into from
Nov 25, 2022

Conversation

lupyuen
Copy link
Member

@lupyuen lupyuen commented Nov 25, 2022

Summary

This PR adds support for PINE64 PinePhone and the Allwinner A64 SoC (based on Arm Cortex-A53).

With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps.

Changes to Kconfig

  • arch/arm64/Kconfig: Added Allwinner A64 SoC

  • boards/Kconfig: Added PINE64 PinePhone

  • arch/arm64/src/a64/Kconfig: New Kconfig for Allwinner A64 SoC

  • boards/arm64/a64/pinephone/Kconfig: New Kconfig for PINE64 PinePhone

Additions to arch/arm64

  • src/a64/a64_boot.c, a64_boot.h: Boot functions for Allwinner A64

  • src/a64/a64_lowputc.S: Low-level console output

  • src/a64/a64_serial.c, a64_serial.h: A64 Serial Driver

  • src/a64/chip.h: A64 SoC Definitions

  • include/a64/chip.h: A64 Memory Map, Generic Interrupt Controller

  • include/a64/irq.h: A64 Interrupts

  • src/a64/Make.defs: Source files for A64

Additions to boards/arm64/a64/pinephone

  • configs/nsh/defconfig: Board Configuration for pinephone:nsh

  • src/pinephone_appinit.c: Init PinePhone

  • src/pinephone_boardinit.c: Init PinePhone

  • src/pinephone_bringup.c: Start PinePhone Drivers

  • src/pinephone.h: PinePhone Declarations

  • include/board_memorymap.h: PinePhone Memory Map

  • scripts/dramboot.ld: PinePhone Linker Script

  • scripts/Make.defs: Source files for PinePhone

  • src/Makefile: PinePhone Makefile

Changes to Documentation

  • platforms/arm/a64/boards/pinephone/index.rst: Building and booting NuttX on PinePhone

  • platforms/arm/a64/index.rst: Overview of Allwinner A64

  • introduction/supported_platforms.rst: Added Allwinner A64

  • introduction/detailed_support.rst: Added Allwinner A64

Impact

With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps.

We select PinePhone through the new Board Configuration pinephone:nsh:

./tools/configure.sh -l pinephone:nsh

There is no impact on the existing implementation of QEMU for Armv8-A (qemu-armv8a).

Testing

We tested by booting PinePhone with a microSD Card that contains NuttX:

## Configure and build NuttX
./tools/configure.sh -l pinephone:nsh
make

## Compress the NuttX Image
cp nuttx.bin Image
rm -f Image.gz
gzip Image

## Copy to PinePhone Jumpdrive microSD Card
## https://lupyuen.github.io/articles/uboot#pinephone-jumpdrive
cp Image.gz "/Volumes/NO NAME"

When we insert the microSD Card into PinePhone and power it up, PinePhone boots successfully to nsh and runs console apps:

Two lines of messages appear garbled because two tasks were printing messages simultaneously: "nsh: sysinit: fopen failed: 2" and "nsh: mkfatfs: command not found"

This will be fixed in a later PR.

This PR adds support for PINE64 PinePhone and the Allwinner A64 SoC (based on Arm Cortex-A53).

With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps.

-   `arch/arm64/Kconfig`: Added Allwinner A64 SoC

-   `boards/Kconfig`: Added PINE64 PinePhone

-   `arch/arm64/src/a64/Kconfig`: New Kconfig for Allwinner A64 SoC

-   `boards/arm64/a64/pinephone/Kconfig`: New Kconfig for PINE64 PinePhone

-   `src/a64/a64_boot.c`, `a64_boot.h`: Boot functions for Allwinner A64

-   `src/a64/a64_lowputc.S`: Low-level console output

-   `src/a64/a64_serial.c`, `a64_serial.h`: A64 Serial Driver

-   `src/a64/chip.h`: A64 SoC Definitions

-   `include/a64/chip.h`: A64 Memory Map, Generic Interrupt Controller

-   `include/a64/irq.h`: A64 Interrupts

-   `src/a64/Make.defs`: Source files for A64

-   `configs/nsh/defconfig`: Board Configuration for `pinephone:nsh`

-   `src/pinephone_appinit.c`: Init PinePhone

-   `src/pinephone_boardinit.c`: Init PinePhone

-   `src/pinephone_bringup.c`: Start PinePhone Drivers

-   `src/pinephone.h`: PinePhone Declarations

-   `include/board_memorymap.h`: PinePhone Memory Map

-   `scripts/dramboot.ld`: PinePhone Linker Script

-   `scripts/Make.defs`: Source files for PinePhone

-   `src/Makefile`: PinePhone Makefile

-   `platforms/arm/a64/boards/pinephone/index.rst`: Building and booting NuttX on PinePhone

-   `platforms/arm/a64/index.rst`: Overview of Allwinner A64

-   `introduction/supported_platforms.rst`: Added Allwinner A64

-   `introduction/detailed_support.rst`: Added Allwinner A64
@zouboan
Copy link
Contributor

zouboan commented Nov 25, 2022

after two month of long trip from Germany, my Pinephone arrived last week, your PR is just in time!

@lupyuen
Copy link
Member Author

lupyuen commented Nov 25, 2022

@zouboan Very cool thanks! Remember to get the PinePhone Serial Debug Cable too :-)

Co-authored-by: hartmannathan <59230071+hartmannathan@users.noreply.github.com>
Copy link
Contributor

@zouboan zouboan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Lup,thanks very much for your remind, i bought a PinePhone serial debug cable from TaoBao, now i'm testing it.
I have a little query, from your great porting tutorial, NuttX Header we should change PinePhone Image load offset from 0x48 0000 to 0x0 in arch/arm64/src/common/arm64_head.S but now I don't find this modification in this PR, it mean that it can work without this change as well, or we should create a arm64_head.S specifically for A64?

@lupyuen
Copy link
Member Author

lupyuen commented Nov 25, 2022

@zouboan Yep I also thought I had to change the Image Load Offset in the Linux Kernel Header arch/arm64/src/common/arm64_head.S to match the actual load address. Then I discovered that NuttX boots OK without changing the Image Load Offset. So it seems the Image Load Offset is not actually used by the U-Boot Bootloader?

Another thing I discovered: Previously the Vector Base Address Register for EL1 was set incorrectly. The new code doesn't have this problem. I wonder if it might be due to the Image Load Offset?

@zouboan
Copy link
Contributor

zouboan commented Nov 25, 2022

@lupyuen Got it ! thanks for your explaining, now NuttX runs successfully on my Pinephone, you did a really magic works!

@xiaoxiang781216 xiaoxiang781216 merged commit c2d083e into apache:master Nov 25, 2022
@jerpelea jerpelea added this to To-Add in Release Notes - 12.0.0 Dec 29, 2022
@jerpelea jerpelea moved this from To-Add to Added in Release Notes - 12.0.0 Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants