diff --git a/boards/beagle/pocketbeagle_2/Kconfig.pocketbeagle_2 b/boards/beagle/pocketbeagle_2/Kconfig.pocketbeagle_2 new file mode 100644 index 00000000000..b154f4e2e4e --- /dev/null +++ b/boards/beagle/pocketbeagle_2/Kconfig.pocketbeagle_2 @@ -0,0 +1,8 @@ +# BeagleBoard.org PocketBeagle 2 +# +# Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_POCKETBEAGLE_2 + select SOC_AM6232_M4 if BOARD_POCKETBEAGLE_2_AM6232_M4 diff --git a/boards/beagle/pocketbeagle_2/board.cmake b/boards/beagle/pocketbeagle_2/board.cmake new file mode 100644 index 00000000000..d1f7b9aff41 --- /dev/null +++ b/boards/beagle/pocketbeagle_2/board.cmake @@ -0,0 +1,10 @@ +# BeagleBoard.org PocketBeagle 2 +# +# Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_SOC_AM6232_M4) + board_runner_args(openocd "--no-init" "--no-halt" "--no-targets" "--gdb-client-port=3339") + include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +endif() diff --git a/boards/beagle/pocketbeagle_2/board.yml b/boards/beagle/pocketbeagle_2/board.yml new file mode 100644 index 00000000000..03f54cde3bb --- /dev/null +++ b/boards/beagle/pocketbeagle_2/board.yml @@ -0,0 +1,12 @@ +board: + name: pocketbeagle_2 + full_name: PocketBeagle 2 + vendor: beagle + socs: + - name: am6232 + revision: + format: custom + exact: true + default: "A0" + revisions: + - name: "A0" diff --git a/boards/beagle/pocketbeagle_2/doc/img/pocketbeagle_2.webp b/boards/beagle/pocketbeagle_2/doc/img/pocketbeagle_2.webp new file mode 100644 index 00000000000..34ecf2d1e00 Binary files /dev/null and b/boards/beagle/pocketbeagle_2/doc/img/pocketbeagle_2.webp differ diff --git a/boards/beagle/pocketbeagle_2/doc/index.rst b/boards/beagle/pocketbeagle_2/doc/index.rst new file mode 100644 index 00000000000..ecd9542919c --- /dev/null +++ b/boards/beagle/pocketbeagle_2/doc/index.rst @@ -0,0 +1,121 @@ +.. zephyr:board:: pocketbeagle_2 + +Overview +******** + +PocketBeagle 2 is a computational platform powered by TI AM62x SoC (there are two +revisions, AM6232 and AM6254). + +The board configuration provides support for the ARM Cortex-M4F MCU core. + +See the `PocketBeagle 2 Product Page`_ for details. + +Hardware +******** +PocketBeagle 2 features the TI AM62x SoC based around an Arm Cortex-A53 multicore +cluster with an Arm Cortex-M4F microcontroller, Imagination Technologies AXE-1-16 +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: + +- Low-power ARM Cortex-M4F +- Memory + + - 256KB of SRAM + - 512MB of DDR4 + +Currently supported PocketBeagle 2 revisions: + +- A0: Comes wth SOC AM6232 + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Devices +======== +System Clock +------------ + +This board configuration uses a system clock frequency of 400 MHz. + +DDR RAM +------- + +The board has 512MB of DDR RAM available. This board configuration +allocates Zephyr 4kB of RAM (only for resource table: 0x9CC00000 to 0x9CC00400). + +Serial Port +----------- + +This board configuration uses a single serial communication channel with the +MCU domain UART (MCU_UART0, i.e. P2.05 as RX and P2.07 as TX). + +SD Card +******* + +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 +******** + +The board supports remoteproc using the OpenAMP resource table. + +The testing requires the binary to be copied to the SD card to allow the A53 cores to load it while booting using remoteproc. + +To test the M4F core, we build the :zephyr:code-sample:`hello_world` sample with the following command. + +.. zephyr-app-commands:: + :board: pocketbeagle_2/am6232/m4 + :zephyr-app: samples/hello_world + :goals: build + +This builds the program and the binary is present in the :file:`build/zephyr` directory as +:file:`zephyr.elf`. + +We now copy this binary onto the SD card in the :file:`/lib/firmware` directory and name it as +:file:`am62-mcu-m4f0_0-fw`. + +.. code-block:: console + + # Mount the SD card at sdcard for example + sudo mount /dev/sdX sdcard + # copy the elf to the /lib/firmware directory + sudo cp --remove-destination zephyr.elf sdcard/lib/firmware/am62-mcu-m4f0_0-fw + +The SD card can now be used for booting. The binary will now be loaded onto the M4F core on boot. + +The binary will run and print Hello world to the MCU_UART0 port. + +Debugging +********* + +The board supports debugging M4 core from the A53 cores running Linux. Since the target needs +superuser privilege, openocd needs to be launched seperately for now: + +.. code-block:: console + + sudo openocd -f board/ti_am625_swd_native.cfg + + +Start debugging + +.. zephyr-app-commands:: + :goals: debug + +References +********** + +* `PocketBeagle 2 Product Page`_ +* `Documentation `_ + +.. _PocketBeagle 2 Product Page: + https://www.beagleboard.org/boards/pocketbeagle-2 + +.. _BeagleBoard Imaging Utility: + https://github.com/beagleboard/bb-imager-rs/releases diff --git a/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4-pinctrl.dtsi b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4-pinctrl.dtsi new file mode 100644 index 00000000000..7f54984345a --- /dev/null +++ b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4-pinctrl.dtsi @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + mcu_uart0_rx_default: mcu_uart0_rx_default { + pinmux = ; + }; + + mcu_uart0_tx_default: mcu_uart0_tx_default { + pinmux = ; + }; +}; diff --git a/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.dts b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.dts new file mode 100644 index 00000000000..6b1c256976b --- /dev/null +++ b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.dts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "pocketbeagle_2_am6232_m4-pinctrl.dtsi" + +/ { + model = "BeagleBoard.org PocketBeagle 2"; + compatible = "beagle,pocketbeagle_2_m4"; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,ipc = &ipc0; + zephyr,ipc_shm = &ddr0; + zephyr,sram1 = &ddr1; + }; + + cpus { + cpu@0 { + status = "okay"; + clock-frequency = <400000000>; + }; + }; + + ddr0: memory@9cb00000 { + compatible = "mmio-sram"; + reg = <0x9cb00000 DT_SIZE_M(1)>; + }; + + rsc_table: memory@9cc00000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x9cc00000 DT_SIZE_K(4)>; + zephyr,memory-region = "RSC_TABLE"; + }; + + ddr1: memory@9cc01000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x9cc01000 (DT_SIZE_M(15) - DT_SIZE_K(4))>; + zephyr,memory-region = "DDR"; + }; + + ipc0: ipc { + compatible = "zephyr,mbox-ipm"; + mboxes = <&mbox0 0>, <&mbox0 1>; + mbox-names = "tx", "rx"; + }; +}; + +&uart0 { + current-speed = <115200>; + pinctrl-0 = <&mcu_uart0_rx_default &mcu_uart0_tx_default>; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.yaml b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.yaml new file mode 100644 index 00000000000..fc258c2e383 --- /dev/null +++ b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4.yaml @@ -0,0 +1,10 @@ +identifier: pocketbeagle_2/am6232/m4 +name: BeagleBoard.org PocketBeagle 2 +type: mcu +arch: arm +toolchain: + - zephyr +ram: 192 +vendor: beagle +supported: + - uart diff --git a/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4_defconfig b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4_defconfig new file mode 100644 index 00000000000..02a9f623a27 --- /dev/null +++ b/boards/beagle/pocketbeagle_2/pocketbeagle_2_am6232_m4_defconfig @@ -0,0 +1,18 @@ +# BeagleBoard.org PocketBeagle 2 +# +# Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +# Platform Configuration +CONFIG_CORTEX_M_SYSTICK=y + +# Zephyr Kernel Configuration +CONFIG_XIP=n + +# Serial Driver +CONFIG_SERIAL=y + +# Enable Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/beagle/pocketbeagle_2/revision.cmake b/boards/beagle/pocketbeagle_2/revision.cmake new file mode 100644 index 00000000000..f7698f24bf3 --- /dev/null +++ b/boards/beagle/pocketbeagle_2/revision.cmake @@ -0,0 +1,10 @@ +set(BOARD_REVISIONS "A0") + +# If BOARD_REVISION not set, use the default revision +if(NOT DEFINED BOARD_REVISION) + set(BOARD_REVISION ${LIST_BOARD_REVISION_DEFAULT}) +endif() + +if(NOT BOARD_REVISION IN_LIST BOARD_REVISIONS) + message(FATAL_ERROR "${BOARD_REVISION} is not a valid revision for PocketBeagle 2. Accepted revisions: ${BOARD_REVISIONS}") +endif() diff --git a/boards/beagle/pocketbeagle_2/support/openocd.cfg b/boards/beagle/pocketbeagle_2/support/openocd.cfg new file mode 100644 index 00000000000..f0cff3f9e2d --- /dev/null +++ b/boards/beagle/pocketbeagle_2/support/openocd.cfg @@ -0,0 +1,7 @@ +# BeagleBoard.org PocketBeagle 2 +# +# Copyright (c) 2025 Ayush Singh, BeagleBoard.org Foundation +# +# SPDX-License-Identifier: Apache-2.0 + +source [find board/ti_am625_swd_native.cfg]