Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b7f1f95
temporarily track bao proj repo's demo-next branch
josecm Jul 18, 2025
d11ce21
fix: use linux toolchain for opensbi and raw binary instead of elf
josecm Jul 19, 2025
00de94d
update(demos): set configurations to bao's new config struct
josecm Jul 18, 2025
1d1d814
feat(demos): include srcs for barmetal and freertos demo
josecm Jul 18, 2025
98f6c73
update: bump compiler version
josecm Jul 18, 2025
7571ef9
update: uboot version and config
josecm Jul 19, 2025
bc0f618
update: qemu version
josecm Jul 19, 2025
b4c890d
update: bump qemu's riscv hart spec version and add sstc extension
josecm Jul 19, 2025
af94a8e
update: fvp version and options
josecm Jul 19, 2025
2de8bd2
update: zephyr's version to 4.1 and adapt board and configs
josecm Jul 19, 2025
06fd253
update: linux and buildroot versions to 6.15 and 2025.05
josecm Jul 19, 2025
5eac4b0
fix: remove uneeded device trees
josecm Jul 19, 2025
fc0c43a
fix: correct misc device tree issues
josecm Jul 19, 2025
b3502e1
update: bump misc tool version
josecm Jul 19, 2025
2372558
plat(qemu): add qemu rv32 platform
josecm Jul 21, 2025
7de5690
ref(linux): remove uneeded linux patches
josecm Jul 22, 2025
096f947
feat: use bao-linux-drivers as buildroot package for linux ipc
josecm Jul 22, 2025
9441546
ref(readme): Update riscv toolchain links
miguelafsilva5 Oct 17, 2025
57380a2
update: point bao to v2.0-rc1
josecm Nov 24, 2025
dce277e
update: uboot version
joaopeixoto13 Dec 30, 2025
890d0de
platforms/zcu104: update U-Boot and demo image handling
joaopeixoto13 Nov 27, 2025
16a1a86
feat: add VirtIO demo
joaopeixoto13 Nov 27, 2025
656b611
update: bao version to v2.0-rc2
josecm Dec 5, 2025
a3192e1
ref(tx2): add UART connection pins
danielRep Dec 16, 2025
0aa2af6
fix: update rpi4 linux memory
DavidMCerdeira Jan 8, 2026
5cb8213
bump: update bao version to V2.0-rc3
DavidMCerdeira Jan 9, 2026
7a84bc9
fix(virtio): use Buildroot toolchain for Rust builds
joaopeixoto13 Jan 11, 2026
4434934
fix: shmem after mem and 2MB multiple for baremetal/freeRTOS
DavidMCerdeira Jan 12, 2026
fa086a1
fix(tx2): remove binary constant from linux+freertos config
danielRep Jan 15, 2026
8384ee5
fix(baremetal): add timer enable and format
danielRep Feb 11, 2026
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ environment+=BAO_DEMOS_SDCARD=/media/$$USER/boot
all: platform

bao_repo:=https://github.com/bao-project/bao-hypervisor
bao_version:=demo
bao_version:=v2.0-rc3
bao_src:=$(wrkdir_src)/bao
bao_cfg_repo:=$(wrkdir_demo_imgs)/config
wrkdirs+=$(bao_cfg_repo)
Expand Down
74 changes: 45 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ systems and targeting several supported platforms. The available demos are:
* [Dual-guest Linux+FreeRTOS](demos/linux+freertos/README.md)
* [Dual-Guest Linux+Zephyr](demos/linux+zephyr/README.md)
* [Dual-Guest Zephyr+Baremetal](demos/zephyr+baremetal/README.md)

* [VirtIO Demo](demos/virtio/README.md)

---

Expand Down Expand Up @@ -45,15 +45,19 @@ architecture:

a) For Armv8 Aarch64, use the **aarch64-none-elf-** toolchain.

Download it from the [Arm Developer's][arm-toolchains] website.
Download it from the [Arm Developer's website][aarch64-toolchains].

b) For Armv7 or Armv8 Aarch32, use the **arm-none-eabi-** toolchain.

Download it from the [Arm Developer's][arm-toolchains] website.
Download it from the [Arm Developer's website][aarch32-toolchains].

c) For RISC-V RV64, use the **riscv64-unknown-elf-** toolchain.

c) For RISC-V, use the **riscv64-unknown-elf-** toolchain.
Download it from [Bao's Project RISC-V Toolchain repo][riscv64-toolchain].

Download it from [SiFive's Freedom Tools][riscv-toolchains] github reposiroty.
d) For RISC-V RV32, use the **riscv32-unknown-elf-** toolchain.

Download it from [Bao's Project RISC-V Toolchain repo][riscv32-toolchain].

Install the toolchain. Then, set the **CROSS_COMPILE** environment variable
with the reference toolchain prefix path:
Expand All @@ -62,6 +66,11 @@ with the reference toolchain prefix path:
export CROSS_COMPILE=/path/to/toolchain/install/dir/bin/your-toolchain-prefix-
```

For RISC-V, also set:
```
export OPENSBI_CROSS_COMPILE=/path/to/toolchain/install/dir/bin/riscv64-unknown-linux-gnu-
```

## 1. Setup base environment

Clone this repo and cd to it:
Expand Down Expand Up @@ -179,7 +188,7 @@ Clone Bao's repo to the the working directory:
```
export BAO_DEMOS_BAO=$BAO_DEMOS_WRKDIR_SRC/bao
git clone https://github.com/bao-project/bao-hypervisor $BAO_DEMOS_BAO\
--branch demo
--branch demo-next
```

Copy your config to the working directory:
Expand Down Expand Up @@ -244,29 +253,33 @@ Build the firmware and deploy the system according to the target platform:
| FVP-A AArch32 | fvp-a-aarch32 | aarch32 |
| FVP-R AArch32 | fvp-r-aarch32 | aarch32 |
| QEMU RV64 virt | qemu-riscv64-virt | riscv64 |
| QEMU RV32 virt | qemu-riscv32-virt | riscv32 |


| | DEMO |
| ---------------- | ---------------- |
| Baremetal guest | baremetal |
| Linux+FreeRTOS | linux+freertos |
| Linux+Zephyr | linux+zephyr |
| Zephyr+Baremetal | zephyr+baremetal |
| VirtIO | virtio |

## Appendix II

| | baremetal | linux+freertos | linux+zephyr | zephyr+baremetal |
| ----------------- | --------- | -------------- | ------------ | ---------------- |
| zcu102 | x | x | | |
| zcu104 | x | x | | |
| imx8qm | x | x | | |
| tx2 | x | x | | |
| rpi4 | x | x | x | |
| qemu-aarch64-virt | x | x | x | |
| fvp-a-aarch64 | x | x | x | x |
| fvp-a-aarch32 | x | x | x | x |
| fvp-r-aarch64 | x | x | x | x |
| fvp-r-aarch32 | x | | | x |
| qemu-riscv64-virt | x | x | | |
| | baremetal | linux+freertos | linux+zephyr | zephyr+baremetal | virtio |
| ----------------- | --------- | -------------- | ------------ | ---------------- | ---------------- |
| zcu102 | x | x | | | x |
| zcu104 | x | x | | | x |
| imx8qm | x | x | | | |
| tx2 | x | x | | | |
| rpi4 | x | x | x | | x |
| qemu-aarch64-virt | x | x | x | | x |
| fvp-a-aarch64 | x | x | x | x | |
| fvp-a-aarch32 | x | x | x | x | |
| fvp-r-aarch64 | x | x | x | x | |
| fvp-r-aarch32 | x | | | x | |
| qemu-riscv64-virt | x | x | | | x |
| qemu-riscv32-virt | x | x | | | |


---
Expand All @@ -275,18 +288,21 @@ Build the firmware and deploy the system according to the target platform:

| Tool | Version |
| ----------------------- | ------- |
| arm-none-eabi-gcc | 11.3.1 |
| aarch64-none-elf-gcc | 11.2.1 |
| riscv64-unknown-elf-gcc | 10.2.0 |
| make | 4.2.1 |
| dtc | 1.5.0 |
| gcc | 9.3.0 |
| mkimage | 20.10 |
| cmake | 3.20.0 |
| arm-none-eabi-gcc | 14.2.1 |
| aarch64-none-elf-gcc | 14.2.1 |
| riscv64-unknown-elf-gcc | 13.2.0 |
| make | 4.3 |
| dtc | 1.6.1 |
| gcc | 11.4.0 |
| mkimage | 2022.01 |
| cmake | 3.22.1 |
| ninja | 1.10.1 |


<!-- Links -->

[arm-toolchains]: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
[riscv-toolchains]: https://github.com/sifive/freedom-tools/releases
[aarch64-toolchains]: https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-elf.tar.xz
[aarch32-toolchains]: https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
[riscv64-toolchain]: https://github.com/bao-project/bao-riscv-toolchain/releases/download/gc891d8dc23e/riscv64-unknown-elf.tar.gz
[riscv32-toolchain]: https://github.com/bao-project/bao-riscv-toolchain/releases/download/gc891d8dc23e/riscv32-unknown-elf.tar.gz

4 changes: 2 additions & 2 deletions demos/baremetal/configs/fvp-a.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x90000000,
Expand Down
2 changes: 1 addition & 1 deletion demos/baremetal/configs/fvp-r.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
struct config config = {

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = VM_IMAGE_LOADED(0x10000000, 0x10000000, 100*1024),

Expand Down
4 changes: 2 additions & 2 deletions demos/baremetal/configs/imx8qm.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x80200000,
Expand Down
4 changes: 2 additions & 2 deletions demos/baremetal/configs/qemu-aarch64-virt.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x50000000,
Expand Down
1 change: 1 addition & 0 deletions demos/baremetal/configs/qemu-riscv32-virt.c
6 changes: 3 additions & 3 deletions demos/baremetal/configs/qemu-riscv64-virt.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x80200000,
Expand Down Expand Up @@ -40,7 +40,7 @@ struct config config = {
},

.arch = {
.plic_base = 0xc000000,
.irqc.plic.base = 0xc000000,
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions demos/baremetal/configs/rpi4.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x200000,
Expand Down
4 changes: 2 additions & 2 deletions demos/baremetal/configs/tx2.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))
struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0xa0000000,
Expand Down
4 changes: 2 additions & 2 deletions demos/baremetal/configs/zcu104.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin));
VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

CONFIG_HEADER

.vmlist_size = 1,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0x20000000,
Expand Down
5 changes: 4 additions & 1 deletion demos/baremetal/make.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ include $(bao_demos)/guests/baremetal/make.mk

baremetal_image:=$(wrkdir_demo_imgs)/baremetal.bin

app_src_dir:=$(bao_demos)/demos/baremetal/src
baremetal_args:=APP_SRC_DIR=$(app_src_dir)

ifeq ($(ARCH_PROFILE),armv8-r)
baremetal_args:=MEM_BASE=0x10000000
baremetal_args+=MEM_BASE=0x10000000
fvpr_image_data:=$(baremetal_image)@0x10000000
endif

Expand Down
74 changes: 74 additions & 0 deletions demos/baremetal/src/demo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) Bao Project and Contributors. All rights reserved.
*/

#include <core.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cpu.h>
#include <wfi.h>
#include <spinlock.h>
#include <plat.h>
#include <irq.h>
#include <uart.h>
#include <timer.h>

#define TIMER_INTERVAL (TIME_S(1))

spinlock_t print_lock = SPINLOCK_INITVAL;

void uart_rx_handler(){
static int irq_count = 0;
uart_clear_rxirq();
printf("cpu%d: %s %d\n",get_cpuid(), __func__, ++irq_count);
}

void ipi_handler(){
printf("cpu%d: %s\n", get_cpuid(), __func__);
irq_send_ipi(1ull << (get_cpuid() + 1));
}

void timer_handler(){
printf("cpu%d: %s\n", get_cpuid(), __func__);
timer_set(TIMER_INTERVAL);
irq_send_ipi(1ull << (get_cpuid() + 1));
}

void main(void){

static volatile bool master_done = false;

if(cpu_is_master()){
spin_lock(&print_lock);
printf("Bao bare-metal test guest\n");
spin_unlock(&print_lock);

irq_set_handler(UART_IRQ_ID, uart_rx_handler);
irq_set_handler(TIMER_IRQ_ID, timer_handler);
irq_set_handler(IPI_IRQ_ID, ipi_handler);

uart_enable_rxirq();

timer_set(TIMER_INTERVAL);
irq_enable(TIMER_IRQ_ID);
irq_set_prio(TIMER_IRQ_ID, IRQ_MAX_PRIO);

timer_enable();

master_done = true;
}

irq_enable(UART_IRQ_ID);
irq_set_prio(UART_IRQ_ID, IRQ_MAX_PRIO);
irq_enable(IPI_IRQ_ID);
irq_set_prio(IPI_IRQ_ID, IRQ_MAX_PRIO);

while(!master_done);
spin_lock(&print_lock);
printf("cpu %d up\n", get_cpuid());
spin_unlock(&print_lock);

while(1) wfi();
}
1 change: 1 addition & 0 deletions demos/baremetal/src/sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src_c_srcs:= demo.c
10 changes: 5 additions & 5 deletions demos/linux+freertos/configs/fvp-a-aarch32.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <config.h>

VM_IMAGE(linux_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/linux.bin));
VM_IMAGE(freertos_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/freertos.bin));
VM_IMAGE(linux_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/linux.bin))
VM_IMAGE(freertos_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/freertos.bin))

struct config config = {

Expand All @@ -11,7 +11,7 @@ struct config config = {
},

.vmlist_size = 2,
.vmlist = {
.vmlist = (struct vm_config[]) {
{
.image = {
.base_addr = 0xa0000000,
Expand All @@ -22,7 +22,7 @@ struct config config = {
.entry = 0xa0000000,

.platform = {
.cpu_num = 2,
.cpu_num = 3,

.region_num = 1,
.regions = (struct vm_mem_region[]) {
Expand Down Expand Up @@ -101,7 +101,7 @@ struct config config = {
.ipc_num = 1,
.ipcs = (struct ipc[]) {
{
.base = 0x70000000,
.base = 0xf0000000,
.size = 0x00010000,
.shmem_id = 0,
.interrupt_num = 1,
Expand Down
Loading