diff --git a/build_sdk.py b/build_sdk.py index c6781ad85..ac8cd1b77 100644 --- a/build_sdk.py +++ b/build_sdk.py @@ -140,7 +140,28 @@ class ConfigInfo: kernel_options_arch: KERNEL_OPTIONS_ARCH +# There are some references to paths we need to make that are relative +# to the kernel source, since the kernel source is supplied by the user, +# we can't hard-code it. +# This is necessary for particular kernel options such as, KernelCustomDTS +# and KernelCustomDTSOverlay. +@dataclass +class KernelPath: + path: str + + SUPPORTED_BOARDS = ( + BoardInfo( + name="kria_k26", + arch=KernelArch.AARCH64, + gcc_cpu="cortex-a53", + loader_link_address=0x40000000, + kernel_options={ + "KernelPlatform": "zynqmp", + "KernelARMPlatform": "zcu102", + "KernelCustomDTSOverlay": Path("custom_dts/overlay-zynqmp-kria-k26.dts"), + } | DEFAULT_KERNEL_OPTIONS_AARCH64, + ), BoardInfo( name="tqma8xqp1gb", arch=KernelArch.AARCH64, @@ -210,8 +231,8 @@ class ConfigInfo: smp_cores=4, kernel_options={ "KernelPlatform": "imx8mp-evk", - "KernelCustomDTS": "custom_dts/iot-gate.dts", - "KernelCustomDTSOverlay": "src/plat/imx8m-evk/overlay-imx8mp-evk.dts", + "KernelCustomDTS": Path("custom_dts/iot-gate.dts"), + "KernelCustomDTSOverlay": KernelPath(path="src/plat/imx8m-evk/overlay-imx8mp-evk.dts"), } | DEFAULT_KERNEL_OPTIONS_AARCH64, ), BoardInfo( @@ -577,8 +598,10 @@ def build_sel4( for arg, val in sorted(config_args): if isinstance(val, bool): str_val = "ON" if val else "OFF" - elif arg == "KernelCustomDTSOverlay": - str_val = f"{sel4_dir.absolute()}/{val}" + elif isinstance(val, KernelPath): + str_val = f"{sel4_dir.absolute()}/{val.path}" + elif isinstance(val, Path): + str_val = Path(__file__).parent / val else: str_val = str(val) s = f"-D{arg}={str_val}" diff --git a/custom_dts/overlay-zynqmp-kria-k26.dts b/custom_dts/overlay-zynqmp-kria-k26.dts new file mode 100644 index 000000000..08a42231a --- /dev/null +++ b/custom_dts/overlay-zynqmp-kria-k26.dts @@ -0,0 +1,20 @@ +/* + * Copyright 2026, Skykraft + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +/ { + memory@0 { + device_type = "memory"; + reg = <0x00 0x00 0x00 0x7ff00000 0x08 0x00 0x00 0x80000000>; + }; + + chosen { + seL4,kernel-devices = + "serial1", + &{/amba_apu@0/interrupt-controller@f9010000}, + &{/timer}, + &{/amba/smmu@fd800000}; + }; +}; diff --git a/docs/manual.md b/docs/manual.md index 3b4dbb5b2..91d8af800 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -1135,6 +1135,7 @@ The currently supported platforms are: * imx8mp_evk * imx8mp_iotgate * imx8mq_evk +* kria_k26 * maaxboard * odroidc2 * odroidc4 @@ -1239,6 +1240,22 @@ Microkit will produce a raw binary file by default, so when using U-Boot run the => go 0x41000000 +## Kria K26 {#kria_k26} + +The [Kria K26](https://www.amd.com/en/products/system-on-modules/kria/k26.html) is highly similar +to the ZCU102, with slight differences in memory regions and the base UART controller. + +To run the built image on the board, you have to use properly patched U-Boot - please see the [section for ZCU102](#zcu102), for the details. + +You have to load the binary file into memory and run it: +``` +ZynqMP> tftpboot 0x40000000 loader.img +... +ZynqMP> go 0x40000000 +``` + +A QEMU emulator is not available for the Kria K26 at this stage. + ## MaaXBoard {#maaxboard} The MaaXBoard is a low-cost ARM SBC based on the NXP i.MX8MQ system-on-chip. diff --git a/loader/Makefile b/loader/Makefile index dbc52df38..c08c18bd9 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -48,7 +48,7 @@ else ifeq ($(ARCH),riscv64) endif CFLAGS := -std=gnu11 -g -O3 -nostdlib -ffreestanding \ - -MP -MD $(CFLAGS_ARCH) -I$(SEL4_SDK)/include \ + -MP -MD $(CFLAGS_ARCH) -DBOARD_$(BOARD) -I$(SEL4_SDK)/include \ -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ -Wundef -Wno-nonnull -Wnested-externs diff --git a/loader/src/aarch64/init.c b/loader/src/aarch64/init.c index 143f324ba..568bfba15 100644 --- a/loader/src/aarch64/init.c +++ b/loader/src/aarch64/init.c @@ -106,7 +106,7 @@ void arch_init(void) } // TODO: handle non-PSCI platforms better, see https://github.com/seL4/microkit/issues/401. -#if !defined(CONFIG_PLAT_BCM2711) +#if !defined(CONFIG_PLAT_BCM2711) && !defined(BOARD_kria_k26) uint32_t ret = arm_smc32_call(PSCI_FUNCTION_VERSION, /* unused */ 0, 0, 0); /* the return value has no error codes, but if we get it wrong this is what we will get */ if (ret == PSCI_RETURN_NOT_SUPPORTED) { diff --git a/loader/src/uart.c b/loader/src/uart.c index c2964fb04..54b182100 100644 --- a/loader/src/uart.c +++ b/loader/src/uart.c @@ -42,7 +42,13 @@ void putc(uint8_t ch) *UART_REG(TRANSMIT) = ch; } #elif defined(CONFIG_PLAT_ZYNQMP_ZCU102) + +#if defined(BOARD_kria_k26) +#define UART_BASE 0xff010000 +#else #define UART_BASE 0xff000000 +#endif + #define UART_CHANNEL_STS_TXEMPTY 0x8 #define UART_CHANNEL_STS 0x2C #define UART_TX_RX_FIFO 0x30 diff --git a/platforms.yml b/platforms.yml index f72f69566..8a8303816 100644 --- a/platforms.yml +++ b/platforms.yml @@ -14,6 +14,9 @@ # This list is ordered based on the order in what the platforms were added # in. platforms: + - name: kria_k26 + cmake_plat: zcu102 + since: dev - name: rock3b cmake_plat: rk3568 since: dev