Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rockpro64 #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions build_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,29 @@ class ConfigInfo:

SUPPORTED_BOARDS = (
BoardInfo(
name="tqma8xqp1gb",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there is some rebase quirk here, this overwrites tqma8xqp1gb instead of just adding rockpro64.

gcc_cpu="cortex-a35",
loader_link_address=0x80280000,
name="zcu102",
gcc_cpu="cortex-a53",
loader_link_address=0x40000000,
kernel_options={
"KernelPlatform": "tqma8xqp1gb",
"KernelPlatform": "zynqmp",
"KernelARMPlatform": "zcu102",
"KernelIsMCS": True,
"KernelArmExportPCNTUser": True,
},
examples={
"ethernet": Path("example/tqma8xqp1gb/ethernet")
}
),
BoardInfo(
name="zcu102",
name="rockpro64",
gcc_cpu="cortex-a53",
loader_link_address=0x40000000,
loader_link_address=0x20000000,
kernel_options={
"KernelPlatform": "zynqmp",
"KernelARMPlatform": "zcu102",
"KernelPlatform": "rockpro64",
"KernelARMPlatform": "rockpro64",
"KernelIsMCS": True,
"KernelArmExportPCNTUser": True,
},
examples={
"hello": Path("example/zcu102/hello")
}
),
# BoardInfo(
Expand Down
55 changes: 55 additions & 0 deletions example/rockpro64/hello/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# Copyright 2021, Breakaway Consulting Pty. Ltd.
#
# SPDX-License-Identifier: BSD-2-Clause
#
ifeq ($(strip $(BUILD_DIR)),)
$(error BUILD_DIR must be specified)
endif

ifeq ($(strip $(MICROKIT_SDK)),)
$(error MICROKIT_SDK must be specified)
endif

ifeq ($(strip $(MICROKIT_BOARD)),)
$(error MICROKIT_BOARD must be specified)
endif

ifeq ($(strip $(MICROKIT_CONFIG)),)
$(error MICROKIT_CONFIG must be specified)
endif

TOOLCHAIN := aarch64-none-elf

CPU := cortex-a53

CC := $(TOOLCHAIN)-gcc
LD := $(TOOLCHAIN)-ld
AS := $(TOOLCHAIN)-as
MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit

HELLO_OBJS := hello.o

BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)

IMAGES := hello.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
LDFLAGS := -L$(BOARD_DIR)/lib
LIBS := -lmicrokit -Tmicrokit.ld

IMAGE_FILE = $(BUILD_DIR)/loader.img
REPORT_FILE = $(BUILD_DIR)/report.txt

all: $(IMAGE_FILE)

$(BUILD_DIR)/%.o: %.c Makefile
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@

$(BUILD_DIR)/hello.elf: $(addprefix $(BUILD_DIR)/, $(HELLO_OBJS))
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@

$(IMAGE_FILE) $(REPORT_FILE): $(addprefix $(BUILD_DIR)/, $(IMAGES)) hello.system
$(MICROKIT_TOOL) hello.system --search-path $(BUILD_DIR) --board $(MICROKIT_BOARD) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) -r $(REPORT_FILE)
18 changes: 18 additions & 0 deletions example/rockpro64/hello/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021, Breakaway Consulting Pty. Ltd.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <stdint.h>
#include <microkit.h>

void
init(void)
{
microkit_dbg_puts("hello, world\n");
}

void
notified(microkit_channel ch)
{
}
11 changes: 11 additions & 0 deletions example/rockpro64/hello/hello.system
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2021, Breakaway Consulting Pty. Ltd.

SPDX-License-Identifier: BSD-2-Clause
-->
<system>
<protection_domain name="hello" priority="1">
<program_image path="hello.elf" />
</protection_domain>
</system>
32 changes: 30 additions & 2 deletions loader/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ _Static_assert(sizeof(uintptr_t) == 8 || sizeof(uintptr_t) == 4, "Expect uintptr
#if defined(BOARD_zcu102)
#define GICD_BASE 0x00F9010000UL
#define GICC_BASE 0x00F9020000UL
#elif defined(BOARD_rockpro64) /*see line 513 of rockpro64.dts*/
#define GICD_BASE 0xfee00000UL
#define GICC_BASE 0xfee10000UL
#endif

/*
* seL4 expects platforms with a GICv2 to be configured. This configuration is
* usually done by U-Boot and so the loader does not have to do anything.
* However, in the case of using something like QEMU, where the system is run
* without U-Boot, we have to do this configuration in the loader. Otherwise
* interrupts will not work.
*/
#if defined(BOARD_zcu102) || \
defined(BOARD_rockpro64)
#define GIC_V2
#endif

#define REGION_TYPE_DATA 1
Expand Down Expand Up @@ -143,6 +158,19 @@ putc(uint8_t ch)
{
*((volatile uint32_t *)(0x00FF000030)) = ch;
}

#elif defined(BOARD_rockpro64)
#define UART_BASE 0x9000000
#define UARTDR 0x000
#define UARTFR 0x018
#define PL011_UARTFR_TXFF (1 << 5)

static void
putc(uint8_t ch)
{
while ((*UART_REG(UARTFR) & PL011_UARTFR_TXFF) != 0);
*UART_REG(UARTDR) = ch;
}
#else
#error Board not defined
#endif
Expand Down Expand Up @@ -417,7 +445,7 @@ start_kernel(void)
);
}

#if defined(BOARD_zcu102)
#if defined(GIC_V2)
static void
configure_gicv2(void)
{
Expand Down Expand Up @@ -483,7 +511,7 @@ main(void)
*/
copy_data();

#if defined(BOARD_zcu102)
#if defined(GIC_V2)
configure_gicv2();
#endif

Expand Down