Skip to content

Add Initial PocketBeagle 2 rev A0 A53 support #89130

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

Merged
merged 3 commits into from
May 26, 2025

Conversation

Ayush1325
Copy link
Member

Add support to run Zephyr (instead of Linux) on A53s.
Currently, only support for rev A0 (AM6232).
Only enable UART for now.

- AM6232 is a dual core variant of AM6234 with everything being same.
- Used in the first batch of PocketBeagle 2

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
- Add devicetree for AM6232, the dual core AM62 processor without GPU
- Used in revision A0 of PocketBeagle 2

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
- Add support to run Zephyr on A53 with U-boot for rev A0.
- Only UART support for now

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
@github-actions github-actions bot added area: ARM64 ARM (64-bit) Architecture platform: BeagleBoard BeagleBoard.org Foundation platform: TI K3 Texas Instruments Keystone 3 Processors labels Apr 26, 2025
#address-cells = <1>;
#size-cells = <0>;

cpu@1 {
Copy link
Collaborator

@dnltz dnltz Apr 28, 2025

Choose a reason for hiding this comment

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

How about we add all four cores to ti_am62x_a53 and set them to disabled? This would make this and the am6234 file obsolete and each board can decide which core to enable.

Comment on lines +27 to +29
cpu@1 {
status = "okay";
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

The idea behind A53 support on the phyBOARD-Lyra was to have something like jail-house based on Zephyr. So, Zephyr would run on core 0 and Linux on core 1+. In case Linux doesn't response, Zephyr is able to restart Linux or do something else.

In my option, the K3 architecture was designed to out-source hard real-time tasks to all the co-processors. So, Zephyr should run only run on M4/R5 cores while Linux runs on all A cores. The only reason I haven't deleted A53 support for the phyBOARD-Lyra is because it already exists and might be used for that jail-house use-case.
The last thing we need is an alternative of Linux (which by the way has support for all interfaces in the MAIN domain), while basic stuff is missing in the MCU domains.

This shouldn't block this PR but I would appreciate if Texas Instruments and/or BeagleBoard stick to Zephyr's core idea.

Copy link
Member Author

@Ayush1325 Ayush1325 Apr 28, 2025

Choose a reason for hiding this comment

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

In my option, the K3 architecture was designed to out-source hard real-time tasks to all the co-processors. So, Zephyr should run only run on M4/R5 cores while Linux runs on all A cores. The only reason I haven't deleted A53 support for the phyBOARD-Lyra is because it already exists and might be used for that jail-house use-case.
The last thing we need is an alternative of Linux (which by the way has support for all interfaces in the MAIN domain), while basic stuff is missing in the MCU domains.

Well, the main supported way is still Linux + Zephyr on M4, MSP0, etc.

However, I am not sure I agree about not supporting an alternative to Linux. TI supports baremetal and FreeRTOS programming for A53s. While the official FreeRTOS support seems to be limited to single A53 core, with inclusion of SMP in FreeRTOS 11, I have seen stuff floating around for full FreeRTOS setups (like here).

Zephyr already has SMP, POSIX API support, userspace, LLEXT, etc. So for specialized workflows, it can make a lot of sense to go all Zephyr.

Additionally, the form factor and IO of PocketBeagle 2 make it quite attractive for high performance specialized usecases.

As for single a53 target, I was planning to add a53_0 target at some point. However, I have not figured out how to Linux + Zephyr yet.

cc @jadonk

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not aware of TI supporting baremetal or FreeRTOS for A53s.

All Zephyr has a real use case as a near-baremetal environment like a "super microcontroller". Running the Arduino stack, for example, provides a fairly rich ecosystem of usage and the ability to do more math (DSP) in real-time with the high-performance cores is real.

A most interesting case is with a single locked core for Zephyr. While Linux can provide real-time, the latency is still longer than what can be provided by Zephyr. For the original PocketBeagle, XENOMAI was used on the same kernel to provide a real-time executive for DSP functions. Locking a single core vs. having a supervisor core has many advantages in performance.

So, while low-math real-time works well on M4 cores, higher-performance DSP greatly benefits from running on A53 cores without Linux.

Copy link
Collaborator

@dnltz dnltz left a comment

Choose a reason for hiding this comment

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

Since pinmuxing is correct, I don't see any reason to block that PR.

@dnltz
Copy link
Collaborator

dnltz commented May 5, 2025

@vaishnavachath @carlocaione can you please take a look?

@Ayush1325
Copy link
Member Author

ping @carlocaione

@kartben kartben assigned jadonk and unassigned carlocaione May 21, 2025
Copy link
Collaborator

@jadonk jadonk left a comment

Choose a reason for hiding this comment

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

  • Move to using a quad-core configuration and leave it to the board to enable the cores.
  • Document clearly that A1 is the shipping version. Please test on A1. Treat A0 as the special case.
  • Provide JTAG debug instructions as this is the only debug option readily available for the A53s.
  • Provide USB DFU execution instructions and runner for rapid development. Writing a microSD card every time is too cumbersome for active development.
  • Consider adding a CLI and runner tied to bb-imager-rs to update image on microSD card.


The following listed hardware specifications are used:

- Dual ARM Cortex-A53 cores
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the current specification, which is Quad Arm Cortex-A53 cores.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, zephyr support for the quad core variant does not exist yet. As you will see in the generated docs and code, only rev A0 is supported right now.

@@ -17,9 +17,11 @@ cluster with an Arm Cortex-M4F microcontroller, Imagination Technologies AXE-1-1
graphics processor (from revision A1) and TI programmable real-time unit subsystem
microcontroller cluster coprocessors.

Zephyr is ported to run on the M4F core and the following listed hardware
specifications are used:
Zephyr is ported to run on the both A53 cores and/or M4F core.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are 4 now. Only rev A0 has a dual core.

Copy link
Member Author

@Ayush1325 Ayush1325 May 22, 2025

Choose a reason for hiding this comment

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

Well, the both here refers to the A53 cores group and M4F core group. Not 2 A53 cores.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do note, that you can specify the board version while building pocketbeagle_2/am6232/a53@A0 or pocketbeagle_2/am6254/a53@A1. So it does not mean that we cannot merge A1 support after A0.

@@ -5,4 +5,5 @@
# SPDX-License-Identifier: Apache-2.0

config BOARD_POCKETBEAGLE_2
select SOC_AM6232_A53 if BOARD_POCKETBEAGLE_2_AM6232_A53
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are now using AM6254. Only A0 had AM6232. A0 should be the special case, not what is currently available (A1).

Copy link
Member Author

Choose a reason for hiding this comment

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

Again, only A0 is supported in this PR.

@@ -119,3 +172,6 @@ References

.. _BeagleBoard Imaging Utility:
https://github.com/beagleboard/bb-imager-rs/releases
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's try to get a more official home for this. Let's replace the information at https://www.beagleboard.org/bb-imager.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not have access to change that page, so sure, we can update the link once that happens.

To test the A53 core, we build the :zephyr:code-sample:`hello_world` sample with the following command.

.. zephyr-app-commands::
:board: pocketbeagle_2/am6232/a53
Copy link
Collaborator

Choose a reason for hiding this comment

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

am6254

Copy link
Member Author

Choose a reason for hiding this comment

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

Again, only A0 is supported right now.
Any changes for A1 will be a separate PR.

@@ -33,6 +33,7 @@ config SOC_SERIES_AM6X_R5
select SOC_EARLY_INIT_HOOK

config SOC_PART_NUMBER
default "AM6232" if SOC_AM6232_A53
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/AM6232/AM6254/

(going with 4 cores with 3 disabled seems ideal)

@@ -31,6 +31,10 @@ config SOC_AM6234_M4
bool
select SOC_SERIES_AM6X_M4

config SOC_AM6232_A53
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/AM6232/AM6254/

Copy link
Member Author

Choose a reason for hiding this comment

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

See above

@@ -95,6 +145,9 @@ The binary will run and print Hello world to the MCU_UART0 port.
Debugging
*********

Copy link
Collaborator

Choose a reason for hiding this comment

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

A53 can be debugged via JTAG.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could not get it to work myself, so I have not added it in this PR.

Download BeagleBoard.org's official `BeagleBoard Imaging Utility`_ to create bootable
SD-card with the Linux distro image. This will boot Linux on the A53 application
cores. These cores will then load the Zephyr binary on the M4 core using remoteproc.

Flashing
********

A53 Core
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check out the latest template: https://github.com/zephyrproject-rtos/zephyr/blob/main/doc/templates/board.tmpl

It seems necessary to discuss the various boot modes. The primary modes available by default on PocketBeagle 2 include the microSD card and USB DFU.

There should be a runner for using USB DFU.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, but same as debugging, this is a minimal PR. I cannot add something I have not gotten to reliably work myself.

A53 Core
========

The testing requires the binary to be copied to the BOOT partition in SD card.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Testing does not require the binary to be copied to a microSD card, but this is the only option for flashing.

Copy link
Member Author

Choose a reason for hiding this comment

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

See above

@Ayush1325
Copy link
Member Author

  • Move to using a quad-core configuration and leave it to the board to enable the cores.

Only rev A0 support is present in this PR. rev A1 support will be a separate PR, once I get that board.

* [ ]  Document clearly that A1 is the shipping version. Please test on A1. Treat A0 as the special case.

I don't have A1 right now.
And this PR was created when A1 had not started shipping.

* [ ]  Provide JTAG debug instructions as this is the only debug option readily available for the A53s.

I would like to add it in a future PR.

* [ ]  Provide USB DFU execution instructions and runner for rapid development. Writing a microSD card every time is too cumbersome for active development.

Again, a future PR.

* [ ]  Consider adding a CLI and runner tied to `bb-imager-rs` to update image on microSD card.

Sure, we can once initial support is present.

Please open issues for changes outside of the scope of this PR here.

This PR is only for Zephyr support on A53s of PocketBeagle 2 rev A0.

@Ayush1325 Ayush1325 changed the title Add PocketBeagle 2 A53 support Add Initial PocketBeagle 2 rev A0 A53 support May 22, 2025
@Ayush1325 Ayush1325 requested a review from jadonk May 22, 2025 11:14
@kartben kartben merged commit 6faa29d into zephyrproject-rtos:main May 26, 2025
29 checks passed
@Ayush1325 Ayush1325 deleted the pb2-a53 branch May 27, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM64 ARM (64-bit) Architecture platform: BeagleBoard BeagleBoard.org Foundation platform: TI K3 Texas Instruments Keystone 3 Processors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants