From b57c6541a15689776a2c94a9d5c5e448587972f0 Mon Sep 17 00:00:00 2001 From: Mohd Noor Aman Date: Tue, 4 Oct 2022 21:38:48 +0000 Subject: bsp/aarch64: Add new Raspberry Pi 4B BSP This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family. Currently only LP64 ABI is supported. ILP32 is not supported. RAM starts from 0x80000 in 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and Raspberry Pi 400 are supported. All the IRQs are similiar to the older Raspberry pi 2 ARM BSP. Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported currently. Mini-UART is not supported. Mini-UART is default UART on the board so it needs to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No support for additional 4 PL011-UARTs on the board. The raspberrypi.h includes many of the address required for the future development of the RPi 4B BSP. This includes peripherals, ARM Timer, VideoCore Timer, Watchdog, Mailbox, AUX, FIQs and IRQs. --- spec/build/bsps/aarch64/raspberrypi/abi.yml | 20 ++++++ .../bsps/aarch64/raspberrypi/bspraspberrypi4.yml | 79 ++++++++++++++++++++++ spec/build/bsps/aarch64/raspberrypi/linkercmds.yml | 76 +++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml create mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml (limited to 'spec/build/bsps') diff --git a/spec/build/bsps/aarch64/raspberrypi/abi.yml b/spec/build/bsps/aarch64/raspberrypi/abi.yml new file mode 100644 index 0000000000..1c4c35d911 --- /dev/null +++ b/spec/build/bsps/aarch64/raspberrypi/abi.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-append: null +build-type: option +copyrights: +- Copyright (C) 2022 Mohd Noor Aman +default: +- -mcpu=cortex-a72 +- -march=armv8-a + +default-by-variant: [] +includes: [] +description: | + ABI flags +links: [] +enabled-by: true +name: ABI_FLAGS +type: build diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml new file mode 100644 index 0000000000..12e706691d --- /dev/null +++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml @@ -0,0 +1,79 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +arch: aarch64 +bsp: raspberrypi4b +build-type: bsp +cflags: [] +copyrights: +- Copyright (C) 2022 Mohd Noor Aman +cppflags: [] +enabled-by: true +family: raspberrypi +includes: [] +install: +- destination: ${BSP_INCLUDEDIR} + source: + - bsps/aarch64/raspberrypi/include/bsp.h + - bsps/aarch64/raspberrypi/include/tm27.h + +- destination: ${BSP_INCLUDEDIR}/bsp + source: + - bsps/aarch64/raspberrypi/include/bsp/irq.h + - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h + +source: +- bsps/aarch64/raspberrypi/console/console.c +- bsps/aarch64/raspberrypi/start/bspstart.c +- bsps/aarch64/raspberrypi/start/bspstarthooks.c +- bsps/aarch64/raspberrypi/start/bspstartmmu.c +- bsps/aarch64/shared/clock/arm-generic-timer-aarch64.c +- bsps/aarch64/shared/cache/cache.c +- bsps/aarch64/shared/mmu/vmsav8-64.c +- bsps/shared/dev/clock/arm-generic-timer.c +- bsps/shared/dev/irq/arm-gicv2.c +- bsps/shared/dev/irq/arm-gicv2-get-attributes.c +- bsps/shared/dev/serial/console-termios-init.c +- bsps/shared/dev/serial/console-termios.c +- bsps/shared/dev/serial/arm-pl011.c +- bsps/shared/dev/getentropy/getentropy-cpucounter.c +- bsps/shared/dev/btimer/btimer-cpucounter.c +- bsps/shared/irq/irq-default-handler.c +- bsps/shared/irq/irq-handler-install.c +- bsps/shared/irq/irq-generic.c +- bsps/shared/irq/irq-lock.c +- bsps/shared/start/bspfatal-default.c +- bsps/shared/start/bspreset-arm-psci.c +- bsps/shared/start/gettargethash-default.c +- bsps/shared/start/sbrk.c +- bsps/shared/start/wkspaceinitone.c +- bsps/shared/start/mallocinitmulti.c +- bsps/shared/start/bspgetworkarea-default.c + +links: +- role: build-dependency + uid: ../grp +- role: build-dependency + uid: ../start +- role: build-dependency + uid: ../optmmupages +- role: build-dependency + uid: ../optgtusevirt +- role: build-dependency + uid: ../optgtuseps +- role: build-dependency + uid: abi +- role: build-dependency + uid: ../../optcachedata +- role: build-dependency + uid: ../../optcacheinst +- role: build-dependency + uid: ../../opto2 +- role: build-dependency + uid: ../../bspopts +- role: build-dependency + uid: linkercmds +- role: build-dependency + uid: ../../obj +- role: build-dependency + uid: ../../objirq + +type: build diff --git a/spec/build/bsps/aarch64/raspberrypi/linkercmds.yml b/spec/build/bsps/aarch64/raspberrypi/linkercmds.yml new file mode 100644 index 0000000000..701f9f935c --- /dev/null +++ b/spec/build/bsps/aarch64/raspberrypi/linkercmds.yml @@ -0,0 +1,76 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: config-file +content: | + /* SPDX-License-Identifier: BSD-2-Clause */ + + /* + * Copyright (C) 2022 Mohd Noor Aman + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + MEMORY { + RAM_MMU : ORIGIN = 0x0, LENGTH = (0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES}) + RAM : ORIGIN = 0x80000, LENGTH = 1024M + } + + REGION_ALIAS ("REGION_START", RAM); + REGION_ALIAS ("REGION_VECTOR", RAM); + REGION_ALIAS ("REGION_TEXT", RAM); + REGION_ALIAS ("REGION_TEXT_LOAD", RAM); + REGION_ALIAS ("REGION_RODATA", RAM); + REGION_ALIAS ("REGION_RODATA_LOAD", RAM); + REGION_ALIAS ("REGION_DATA", RAM); + REGION_ALIAS ("REGION_DATA_LOAD", RAM); + REGION_ALIAS ("REGION_FAST_TEXT", RAM); + REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM); + REGION_ALIAS ("REGION_FAST_DATA", RAM); + REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM); + REGION_ALIAS ("REGION_BSS", RAM); + REGION_ALIAS ("REGION_WORK", RAM); + REGION_ALIAS ("REGION_STACK", RAM); + REGION_ALIAS ("REGION_NOCACHE", RAM); + REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM); + + bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024; + + bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M; + + bsp_stack_exception_size = DEFINED (bsp_stack_exception_size) ? bsp_stack_exception_size : 1024; + + bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M; + + bsp_vector_table_in_start_section = 1; + bsp_translation_table_base = ORIGIN (RAM_MMU); + bsp_translation_table_end = ORIGIN (RAM_MMU) + LENGTH (RAM_MMU); + + OUTPUT_FORMAT ("elf64-littleaarch64") + OUTPUT_ARCH (aarch64) + + INCLUDE linkcmds.base +copyrights: +- Copyright (C) 2022 Mohd Noor Aman +enabled-by: true +install-path: ${BSP_LIBDIR} +links: [] +target: linkcmds +type: build -- cgit v1.2.3