Add support for stm32mp2 SoC family

Add support for STM32MP2 SoC A35 core and stm32mp25-ev1 board.

Supports HYP and SMP configurations
-DPLATFORM=stm32mp2 -DKernelARMlatform=stm32mp257f-ev1 (default)

Supports MCS configuration (for Microkit build)

Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
This commit is contained in:
Christian Bruel 2024-01-10 13:48:47 +01:00 committed by Indan Zupancic
parent a0b4f2d25d
commit c75cf0e2da
7 changed files with 3005 additions and 0 deletions

View file

@ -0,0 +1,14 @@
/*
* Copyright 2026, STMicroelectronics
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <sel4/config.h>
#include <sel4/arch/constants_cortex_a35.h>
#ifdef CONFIG_ARCH_AARCH32
#error "AARCH32 is unsupported"
#endif

View file

@ -21,3 +21,5 @@ register_driver(compatibility_strings "qcom,msm-uartdm" PREFIX src/drivers/seria
register_driver(compatibility_strings "xlnx,xuartps" PREFIX src/drivers/serial CFILES "xuartps.c")
register_driver(compatibility_strings "amlogic,meson-gx-uart" PREFIX src/drivers/serial
CFILES "meson-gx-uart.c")
register_driver(compatibility_strings "st,stm32h7-uart" PREFIX src/drivers/serial
CFILES "stm32h7-uart.c")

View file

@ -0,0 +1,33 @@
/*
* Copyright 2026, STMicroelectronics
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <config.h>
#include <stdint.h>
#include <util.h>
#include <machine/io.h>
#include <plat/machine/devices_gen.h>
#define USART_ISR 0x1C
#define USART_TDR 0x28
#define USART_ISR_TXE 0x80U
#define UART_REG(x) ((volatile uint32_t *)(UART_PPTR + (x)))
#ifdef CONFIG_PRINTING
void uart_drv_putchar(unsigned char c)
{
while (!(*UART_REG(USART_ISR) & USART_ISR_TXE));
*UART_REG(USART_TDR) = c;
}
#endif /* CONFIG_PRINTING */
#ifdef CONFIG_DEBUG_BUILD
unsigned char uart_drv_getchar(void)
{
return -1;
}
#endif /* CONFIG_DEBUG_BUILD */

View file

@ -0,0 +1,46 @@
#
# Copyright 2026, STMicroelectronics
#
# SPDX-License-Identifier: GPL-2.0-only
#
declare_platform(stm32mp2 KernelPlatformMP2 PLAT_STM32MP2 KernelSel4ArchAarch64)
set(c_configs PLAT_STM32MP25_EV1)
set(cmake_configs KernelPlatformMP25_EV1)
set(plat_lists stm32mp257f-ev1)
foreach(config IN LISTS cmake_configs)
unset(${config} CACHE)
endforeach()
if(KernelPlatformMP2)
declare_seL4_arch(aarch64)
check_platform_and_fallback_to_default(KernelARMPlatform "stm32mp257f-ev1")
list(FIND plat_lists ${KernelARMPlatform} index)
if("${index}" STREQUAL "-1")
message(FATAL_ERROR "Which stm32mp2 platform not specified ${KernelARMPlatform}")
endif()
list(GET c_configs ${index} c_config)
list(GET cmake_configs ${index} cmake_config)
config_set(${cmake_config} ${c_config} ON)
list(APPEND KernelDTSList "tools/dts/${KernelARMPlatform}.dts")
list(APPEND KernelDTSList "src/plat/stm32mp2/overlay-stm32mp2.dts")
set(KernelArmCortexA35 ON)
set(KernelArchArmV8a ON)
set(KernelArmGicV2 ON)
message(STATUS "KernelARMPlatform is ${KernelARMPlatform}")
config_set(KernelARMPlatform ARM_PLAT ${KernelARMPlatform})
config_set(KernelARMMach MACH "stm32mp2")
declare_default_headers(
TIMER_FREQUENCY 40000000 NUM_PPI 32 MAX_IRQ 415 INTERRUPT_CONTROLLER arch/machine/gic_v2.h
TIMER drivers/timer/arm_generic.h KERNEL_WCET 10u)
endif()
add_sources(DEP "KernelPlatformMP2" CFILES src/arch/arm/machine/gic_v2.c
src/arch/arm/machine/l2c_nop.c)

View file

@ -0,0 +1,24 @@
/*
* Copyright 2026, STMicroelectronics
*
* SPDX-License-Identifier: BSD-2-Clause
*/
/ {
chosen {
seL4,elfloader-devices =
"serial0",
&{/psci};
seL4,kernel-devices =
"serial0",
&{/interrupt-controller@4ac00000},
&{/timer};
};
/* vgic maintenance interrupt */
interrupt-controller@4ac00000 {
interrupt-parent = <0x05>;
interrupts = <0x01 0x09 0x308>;
};
};

File diff suppressed because it is too large Load diff

View file

@ -191,6 +191,7 @@ devices:
- qcom,msm-uartdm
- samsung,exynos4210-uart
- snps,dw-apb-uart
- st,stm32h7-uart
- ti,omap3-uart
- xlnx,xuartps
- ns16550a