bsps/aarch64/raspberrypi5: Add initial Raspberry Pi 5 BSP

This is initial mvp implementation for the Pi5 BSP. The
initial support has the following features:

- PL011 debug uart (full termios console driver)
- Arm Generic Timer (virtual interface)
- GIC-V2 interrupts

This will be extended in follow-up work.

Should Close rtems/programs/gsoc#85
This commit is contained in:
Preetam Das
2026-02-11 18:44:47 -05:00
committed by Amar Takhar
parent c014ab9b2d
commit e5eaa82420
17 changed files with 833 additions and 0 deletions
@@ -0,0 +1,88 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief Console driver configuration
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#include <bspopts.h>
#include <rtems/bspIo.h>
#include <rtems/console.h>
#include <rtems/termiosdevice.h>
#include <dev/serial/arm-pl011.h>
#include <bsp/irq.h>
#include <bsp/fatal.h>
#include <bsp/raspberrypi5.h>
static arm_pl011_context rpi5_uart_debug_context = {
.base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("UART DEBUG"),
.regs = (volatile arm_pl011_uart*) BCM2712_UART_DEBUG_BASE,
.irq = BCM2712_IRQ_PL011_UART,
.initial_baud = BCM2712_UART_DEBUG_BAUD,
.clock = BSP_PL011_CLOCK_FREQ
};
static void output_char (char c) {
arm_pl011_write_polled(&rpi5_uart_debug_context.base, c);
}
static int poll_char (void) {
return arm_pl011_read_polled(&rpi5_uart_debug_context.base);
}
rtems_device_driver console_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
(void) major;
(void) minor;
(void) arg;
const rtems_termios_device_handler *handler;
rtems_status_code sc;
handler = &arm_pl011_fns;
rtems_termios_initialize();
sc = rtems_termios_device_install( "/dev/console", handler, NULL, &rpi5_uart_debug_context.base );
if ( sc != RTEMS_SUCCESSFUL ) {
bsp_fatal( BSP_FATAL_CONSOLE_INSTALL_1 );
}
return RTEMS_SUCCESSFUL;
}
BSP_output_char_function_type BSP_output_char = output_char;
BSP_polling_getchar_function_type BSP_poll_char = poll_char;
+79
View File
@@ -0,0 +1,79 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief BSP Core definitions
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#ifndef LIBBSP_AARCH64_RASPBERRYPI5_BSP_H
#define LIBBSP_AARCH64_RASPBERRYPI5_BSP_H
/**
* @defgroup RTEMSBSPsAArch64RaspberryPi5 Raspberry Pi 5 - BCM2712
*
* @ingroup RTEMSBSPsAArch64
*
* @brief This group contains the BSP for the Raspberry Pi 5
*
* @{
*/
#include <bspopts.h>
#ifndef ASM
#include <bsp/default-initial-extension.h>
#include <bsp/start.h>
#include <rtems.h>
#include <bsp/raspberrypi5.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Raspberry Pi 5 MMU initialization */
BSP_START_TEXT_SECTION void raspberrypi5_setup_mmu_and_cache(void);
#define BSP_ARM_GIC_CPUIF_BASE (BCM2712_GIC_CPUIF_BASE)
#define BSP_ARM_GIC_DIST_BASE (BCM2712_GIC_DIST_BASE)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ASM */
/** @} */ /* RTEMSBSPsAArch64RaspberryPi5 */
#endif /* LIBBSP_AARCH64_RASPBERRYPI5_BSP_H */
@@ -0,0 +1,66 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief IRQ Definitions
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#ifndef LIBBSP_AARCH64_RASPBERRYPI5_IRQ_H
#define LIBBSP_AARCH64_RASPBERRYPI5_IRQ_H
#ifndef ASM
#include <rtems.h>
#include <dev/irq/arm-gic-irq.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Debug UART */
#define BCM2712_IRQ_PL011_UART (121 + 32)
/* Arm Generic Timer */
#define BSP_TIMER_VIRT_PPI 27
#define BSP_TIMER_PHYS_NS_PPI 30
#define BCM2712_INTC_TOTAL_IRQ 306
#define BSP_INTERRUPT_VECTOR_COUNT BCM2712_INTC_TOTAL_IRQ
#define BSP_INTERRUPT_VECTOR_INVALID (UINT32_MAX)
#define BSP_IRQ_COUNT (BCM2712_INTC_TOTAL_IRQ)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ASM */
#endif /* LIBBSP_AARCH64_RASPBERRYPI5_IRQ_H */
@@ -0,0 +1,63 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief Peripheral and Register definitions
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#ifndef LIBBSP_AARCH64_RASPBERRYPI5_H
#define LIBBSP_AARCH64_RASPBERRYPI5_H
#include <bsp/utility.h>
#include <bspopts.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define RPI_PERIPHERAL_BASE 0x107C000000UL
#define RPI_PERIPHERAL_SIZE 0x04000000UL
#define BCM2712_GIC_BASE (RPI_PERIPHERAL_BASE + 0x03FF9000)
#define BCM2712_GIC_DIST_BASE (BCM2712_GIC_BASE + 0x0000)
#define BCM2712_GIC_CPUIF_BASE (BCM2712_GIC_BASE + 0x1000)
#define BCM2712_PL011_DEVICE_SIZE 0x200
#define BCM2712_UART_DEBUG_BASE (RPI_PERIPHERAL_BASE + 0x1001000)
#define BCM2712_UART_DEBUG_SIZE BCM2712_PL011_DEVICE_SIZE
#define BCM2712_UART_DEBUG_BAUD 115200
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBBSP_AARCH64_RASPBERRYPI5_H */
+45
View File
@@ -0,0 +1,45 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief BSP tm27 header
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#ifndef _RTEMS_TMTEST27
#error "This is an RTEMS internal file you must not include directly."
#endif
#ifndef __tm27_h
#define __tm27_h
#include <dev/irq/arm-gic-tm27.h>
#endif /* __tm27_h */
@@ -0,0 +1,49 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief Low Level Startup Code
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#include <bsp.h>
#include <bsp/bootcard.h>
#include <bsp/irq-generic.h>
#include <bsp/linker-symbols.h>
void bsp_start( void )
{
bsp_interrupt_initialize();
rtems_cache_coherent_add_area(
bsp_section_nocacheheap_begin,
(uintptr_t) bsp_section_nocacheheap_size
);
}
@@ -0,0 +1,53 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief BSP Startup Hooks
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#include <bsp.h>
#include <bsp/start.h>
#ifdef BSP_START_ENABLE_EL3_START_SUPPORT
BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
{
/* Do nothing */
}
#endif
BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
{
AArch64_start_set_vector_base();
bsp_start_copy_sections();
raspberrypi5_setup_mmu_and_cache();
bsp_start_clear_bss();
}
@@ -0,0 +1,60 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief Default MMU configuration
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#include <bsp.h>
#include <bsp/aarch64-mmu.h>
#include <libcpu/mmu-vmsav8-64.h>
/*
* Make weak and let the user override.
*/
BSP_START_TEXT_SECTION void
raspberrypi5_setup_mmu_and_cache( void ) __attribute__ ((weak));
BSP_START_TEXT_SECTION void
raspberrypi5_setup_mmu_and_cache( void )
{
aarch64_mmu_control *control = &aarch64_mmu_instance;
aarch64_mmu_setup();
aarch64_mmu_setup_translation_table(
control,
&aarch64_mmu_config_table[ 0 ],
aarch64_mmu_config_table_size
);
aarch64_mmu_enable( control );
}
@@ -0,0 +1,60 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/**
* @file
*
* @ingroup RTEMSBSPsAArch64RaspberryPi5
*
* @brief MMU Config Table
*/
/*
* Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
#include <bsp.h>
#include <bsp/start.h>
#include <bsp/aarch64-mmu.h>
#include <bsp/raspberrypi5.h>
BSP_START_DATA_SECTION const aarch64_mmu_config_entry
aarch64_mmu_config_table[] = {
AARCH64_MMU_DEFAULT_SECTIONS,
{ /* RPI peripheral address */
.begin = (uintptr_t)RPI_PERIPHERAL_BASE,
.end = (uintptr_t)RPI_PERIPHERAL_BASE + (uintptr_t)RPI_PERIPHERAL_SIZE,
.flags = AARCH64_MMU_DEVICE
},
{ /* RPI firmware-owned addresses including spintables */
.begin = (uintptr_t)0x0,
.end = (uintptr_t)0x1000,
.flags = AARCH64_MMU_DEVICE
},
};
BSP_START_DATA_SECTION const size_t aarch64_mmu_config_table_size =
RTEMS_ARRAY_SIZE(aarch64_mmu_config_table);
@@ -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) 2026 Preetam Das <riki10112001@gmail.com>
default:
- enabled-by: true
value:
- -mcpu=cortex-a76
- -march=armv8.2-a
- -mno-outline-atomics
description: |
ABI flags
enabled-by: true
links: []
name: ABI_FLAGS
type: build
@@ -0,0 +1,73 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
arch: aarch64
bsp: raspberrypi5
build-type: bsp
cflags: []
copyrights:
- Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
cppflags: []
enabled-by: true
family: raspberrypi5
includes: []
install:
- destination: ${BSP_INCLUDEDIR}
source:
- bsps/aarch64/raspberrypi5/include/bsp.h
- bsps/aarch64/raspberrypi5/include/tm27.h
- destination: ${BSP_INCLUDEDIR}/bsp
source:
- bsps/aarch64/raspberrypi5/include/bsp/irq.h
- bsps/aarch64/raspberrypi5/include/bsp/raspberrypi5.h
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: ../../dev/irq/objarmgicv2
- role: build-dependency
uid: ../../obj
- role: build-dependency
uid: ../../objirq
- role: build-dependency
uid: objclock
- role: build-dependency
uid: objconsole
source:
- bsps/aarch64/raspberrypi5/start/bspstart.c
- bsps/aarch64/raspberrypi5/start/bspstarthooks.c
- bsps/aarch64/raspberrypi5/start/bspstartmmu.c
- bsps/aarch64/raspberrypi5/start/mmu-config.c
- bsps/aarch64/shared/cache/cache.c
- bsps/aarch64/shared/mmu/mmu-setup.c
- bsps/aarch64/shared/mmu/vmsav8-64.c
- bsps/aarch64/shared/start/start-cpu-mpidr.S
- bsps/shared/dev/irq/arm-gicv2-get-attributes.c
- bsps/shared/dev/getentropy/getentropy-cpucounter.c
- bsps/shared/dev/btimer/btimer-cpucounter.c
- bsps/shared/irq/irq-default-handler.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
- bsps/shared/start/bspreset-loop.c
type: build
@@ -0,0 +1,84 @@
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) 2026 Preetam Das <riki10112001@gmail.com>
*
* 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.
*/
MMU_TTB_LEN = (0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES});
NOCACHE_LEN = 16M;
LOAD_OFFSET = 0x80000;
GPU_RAM_LEN = 64M;
RAM_TOP = 0x40000000 - GPU_RAM_LEN;
MEMORY {
RAM : ORIGIN = LOAD_OFFSET, LENGTH = RAM_TOP - LOAD_OFFSET - NOCACHE_LEN - MMU_TTB_LEN
RAM_NOCACHE : ORIGIN = RAM_TOP - NOCACHE_LEN - MMU_TTB_LEN, LENGTH = NOCACHE_LEN
RAM_MMU : ORIGIN = RAM_TOP - MMU_TTB_LEN, LENGTH = MMU_TTB_LEN
}
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_NOCACHE);
REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM_NOCACHE);
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) 2026 Preetam Das
enabled-by: true
install-path: ${BSP_LIBDIR}
links: []
target: linkcmds
type: build
@@ -0,0 +1,29 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
type: build
enabled-by:
not: BSP_CLOCK_USE_SYSTEMTIMER
build-type: objects
cflags: []
cppflags:
- -DAARCH64_GENERIC_TIMER_USE_VIRTUAL
cxxflags: []
includes: []
install:
- destination: ${BSP_INCLUDEDIR}/dev/clock
source:
- bsps/include/dev/clock/arm-generic-timer.h
source:
- bsps/aarch64/shared/clock/arm-generic-timer-aarch64.c
- bsps/shared/dev/clock/arm-generic-timer.c
links:
- role: build-dependency
uid: ../optgtusevirt
- role: build-dependency
uid: ../optgtuseps
- role: build-dependency
uid: optsystemtimer
@@ -0,0 +1,21 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
build-type: objects
cflags: []
copyrights:
- Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
cppflags: []
cxxflags: []
enabled-by: true
includes: []
install: []
links:
- role: build-dependency
uid: ../../optconsoleirq
- role: build-dependency
uid: ../../objdevserialarmpl011
- role: build-dependency
uid: optclockpl011freq
source:
- bsps/aarch64/raspberrypi5/console/console.c
- bsps/shared/dev/serial/console-termios.c
type: build
@@ -0,0 +1,17 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- define: null
build-type: option
copyrights:
- Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
default:
- enabled-by:
- aarch64/raspberrypi5
value: 44236800
description: PL011 UART clock frequency in Hz.
enabled-by: true
format: '{}'
links: []
name: BSP_PL011_CLOCK_FREQ
type: build
@@ -0,0 +1,25 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2026 Preetam Das <riki10112001@gmail.com>
type: build
build-type: option
enabled-by: true
name: BSP_CLOCK_USE_SYSTEMTIMER
description: |
The clock from the ARM timer is derived from the system clock. This clock can
change dynamically e.g. if the system goes into reduced power or in low power
mode. Thus the clock speed adapts to the overall system performance
capabilities. For accurate timing it is recommended to use the system timers.
actions:
- get-boolean: null
- define-condition: null
- env-enable: null
default:
- enabled-by:
- aarch64/raspberrypi5
value: false
links: []
+1
View File
@@ -15,6 +15,7 @@ default:
value: 64
- enabled-by:
- aarch64/raspberrypi4b
- aarch64/raspberrypi5
value: 32
description: |
Set the size of UART FIFO