Skip to content

Commit

Permalink
Add support for Avnet MaaXBoard
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Velickovic committed Mar 4, 2024
1 parent f61bcf3 commit 055bab8
Show file tree
Hide file tree
Showing 14 changed files with 15,202 additions and 18 deletions.
19 changes: 17 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ const src = [_][]const u8{
"src/util/printf.c",
};

const src_aarch64_vgic_v2 = [_][]const u8{
"src/arch/aarch64/vgic/vgic_v2.c",
};

const src_aarch64_vgic_v3 = [_][]const u8{
"src/arch/aarch64/vgic/vgic_v3.c",
};

const src_aarch64 = [_][]const u8{
"src/arch/aarch64/vgic/vgic.c",
"src/arch/aarch64/vgic/vgic_v2.c",
"src/arch/aarch64/fault.c",
"src/arch/aarch64/psci.c",
"src/arch/aarch64/smc.c",
Expand All @@ -18,6 +25,14 @@ const src_aarch64 = [_][]const u8{
"src/arch/aarch64/vcpu.c",
};

fn vgicSources(board: []const u8) [1][]const u8 {
if (std.mem.eql(u8, board, "maaxboard")) {
return src_aarch64_vgic_v3;
} else {
return src_aarch64_vgic_v2;
}
}

pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
Expand Down Expand Up @@ -63,7 +78,7 @@ pub fn build(b: *std.Build) void {
});

const src_arch = switch (target.result.cpu.arch) {
.aarch64 => src_aarch64,
.aarch64 => src_aarch64 ++ vgicSources(microkit_board),
else => {
std.log.err("Unsupported libvmm architecture given '{s}'", .{ @tagName(target.result.cpu.arch) });
std.os.exit(1);
Expand Down
6 changes: 6 additions & 0 deletions ci/examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ build_simple_make "odroidc4" "release"
build_simple_zig "odroidc4" "debug"
build_simple_zig "odroidc4" "release"

build_simple_make "maaxboard" "debug"
build_simple_make "maaxboard" "release"

build_simple_zig "maaxboard" "debug"
build_simple_zig "maaxboard" "release"

build_rust "debug"
simulate_rust "debug"
build_rust "release"
Expand Down
10 changes: 6 additions & 4 deletions examples/simple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ SYSTEM_DESCRIPTION := board/$(BOARD)/simple.system

IMAGE_DIR := board/$(BOARD)
LINUX := $(IMAGE_DIR)/linux
DTS := $(IMAGE_DIR)/linux.dts
DTS_BASE := $(IMAGE_DIR)/linux.dts
DTS_OVERLAYS := $(IMAGE_DIR)/overlay.dts
DTB := $(BUILD_DIR)/linux.dtb
INITRD := $(IMAGE_DIR)/rootfs.cpio.gz

Expand All @@ -72,7 +73,7 @@ IMAGE_FILE = $(BUILD_DIR)/loader.img
REPORT_FILE = $(BUILD_DIR)/report.txt

# @ivanv: should only compile printf.o in debug
VMM_OBJS := vmm.o printf.o virq.o linux.o guest.o psci.o smc.o fault.o util.o vgic.o vgic_v2.o package_guest_images.o tcb.o vcpu.o
VMM_OBJS := vmm.o printf.o virq.o linux.o guest.o psci.o smc.o fault.o util.o vgic.o vgic_v3.o package_guest_images.o tcb.o vcpu.o

# Toolchain flags
# FIXME: For optimisation we should consider providing the flag -mcpu.
Expand Down Expand Up @@ -111,10 +112,11 @@ qemu: all
directories:
$(shell mkdir -p $(BUILD_DIR))

$(DTB): $(DTS)
$(DTB): $(DTS_BASE) $(DTS_OVERLAYS)
if ! command -v $(DTC) &> /dev/null; then echo "Could not find dependency: Device Tree Compiler (dtc)"; exit 1; fi
sh $(VMM_TOOLS)/dtscat $^ > $(BUILD_DIR)/guest.dts
# @ivanv: Shouldn't supress warnings
$(DTC) -q -I dts -O dtb $< > $@
$(DTC) -q -I dts -O dtb $(BUILD_DIR)/guest.dts > $@

$(BUILD_DIR)/package_guest_images.o: $(VMM_TOOLS)/package_guest_images.S $(IMAGE_DIR) $(LINUX) $(INITRD) $(DTB)
$(CC) -c -g3 -x assembler-with-cpp \
Expand Down
3 changes: 3 additions & 0 deletions examples/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ common Linux utilities.
The example currently works on the following platforms:
* HardKernel Odroid-C4
* QEMU ARM virt
* Avnet MaaXBoard

## Building with Make

Expand All @@ -17,6 +18,7 @@ make BOARD=<BOARD> MICROKIT_SDK=/path/to/sdk
Where `<BOARD>` is one of:
* `qemu_arm_virt`
* `odroidc4`
* `maaxboard`

Other configuration options can be passed to the Makefile such as `CONFIG`
and `BUILD_DIR`, see the Makefile for details.
Expand Down Expand Up @@ -47,6 +49,7 @@ zig build -Dsdk=/path/to/sdk -Dboard=<BOARD>
Where `<BOARD>` is one of:
* `qemu_arm_virt`
* `odroidc4`
* `maaxboard`

If you are building for QEMU then you can also run QEMU by doing:
```sh
Expand Down
Loading

0 comments on commit 055bab8

Please sign in to comment.