Skip to content

Commit a4882c7

Browse files
committed
feat(e3650): add platform e3650 with single and dual baremetal demo.
update(baremetal): add clean before build to avoid linking with stale objects.
1 parent 73f5bb1 commit a4882c7

File tree

7 files changed

+252
-0
lines changed

7 files changed

+252
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <config.h>
7+
8+
9+
#define E3650_UART_BASE 0xF8D60000
10+
11+
12+
#define E3650_GICD_BASE 0xF4000000
13+
#define E3650_GICR_BASE 0xF4100000
14+
15+
16+
#define VM0_IRAM_BASE 0x00B00000
17+
#define VM0_IRAM_SIZE 0x00100000
18+
19+
#define VM1_IRAM_BASE 0x00C00000
20+
#define VM1_IRAM_SIZE 0x00100000
21+
22+
23+
VM_IMAGE(guest_image0, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal_vm0.bin))
24+
VM_IMAGE(guest_image1, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal_vm1.bin))
25+
26+
struct config config = {
27+
28+
.vmlist_size = 2,
29+
.vmlist = (struct vm_config[]) {
30+
{
31+
.image = VM_IMAGE_BUILTIN(guest_image0, VM0_IRAM_BASE),
32+
33+
.entry = VM0_IRAM_BASE,
34+
35+
.cpu_affinity = 0x3, // Cores 0 and 1 (0011)
36+
37+
.platform = {
38+
.cpu_num = 2,
39+
40+
.region_num = 1,
41+
.regions = (struct vm_mem_region[]) {
42+
{
43+
.base = VM0_IRAM_BASE,
44+
.size = VM0_IRAM_SIZE,
45+
},
46+
},
47+
48+
.dev_num = 1,
49+
.devs = (struct vm_dev_region[]) {
50+
{
51+
52+
.pa = E3650_UART_BASE,
53+
.va = E3650_UART_BASE,
54+
.size = 0x10000,
55+
.interrupt_num = 1,
56+
.interrupts = (unsigned[]) { 114 },
57+
},
58+
},
59+
60+
.arch = {
61+
.gic = {
62+
.gicd_addr = E3650_GICD_BASE,
63+
.gicr_addr = E3650_GICR_BASE,
64+
},
65+
},
66+
},
67+
},
68+
{
69+
.image = VM_IMAGE_BUILTIN(guest_image1, VM1_IRAM_BASE),
70+
71+
.entry = VM1_IRAM_BASE,
72+
73+
.cpu_affinity = 0xC, // Cores 2 and 3 (1100)
74+
75+
.platform = {
76+
.cpu_num = 2,
77+
78+
.region_num = 1,
79+
.regions = (struct vm_mem_region[]) {
80+
{
81+
.base = VM1_IRAM_BASE,
82+
.size = VM1_IRAM_SIZE,
83+
},
84+
},
85+
86+
.dev_num = 1,
87+
.devs = (struct vm_dev_region[]) {
88+
{
89+
.pa = E3650_UART_BASE,
90+
.va = E3650_UART_BASE,
91+
.size = 0x10000,
92+
.interrupt_num = 0,
93+
},
94+
},
95+
96+
.arch = {
97+
.gic = {
98+
.gicd_addr = E3650_GICD_BASE,
99+
.gicr_addr = E3650_GICR_BASE,
100+
},
101+
},
102+
},
103+
}
104+
}
105+
};

demos/baremetal+baremetal/make.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
include $(bao_demos)/guests/baremetal/make.mk
2+
3+
ifeq ($(PLATFORM),e3650)
4+
vm0_image:=$(wrkdir_demo_imgs)/baremetal_vm0.bin
5+
vm0_args:=MEM_BASE=0x00B00000 MEM_SIZE=0x00100000 ARCH_CFLAGS="-Wno-error=incompatible-pointer-types"
6+
$(eval $(call build-baremetal, $(vm0_image), $(vm0_args)))
7+
8+
vm1_image:=$(wrkdir_demo_imgs)/baremetal_vm1.bin
9+
vm1_args:=MEM_BASE=0x00C00000 MEM_SIZE=0x00100000 ARCH_CFLAGS="-Wno-error=incompatible-pointer-types"
10+
$(eval $(call build-baremetal, $(vm1_image), $(vm1_args)))
11+
12+
guest_images:=$(vm0_image) $(vm1_image)
13+
endif

demos/baremetal/configs/e3650.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <config.h>
7+
#include <plat/platform.h>
8+
9+
#define E3650_UART_BASE 0xF8D60000
10+
#define E3650_GICD_BASE 0xF4000000
11+
#define E3650_GICR_BASE 0xF4100000
12+
13+
#define VM0_IRAM_BASE 0x00B00000
14+
#define VM0_IRAM_SIZE 0x00100000
15+
16+
VM_IMAGE(guest_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))
17+
18+
struct config config = {
19+
20+
.vmlist_size = 1,
21+
.vmlist = (struct vm_config[]) {
22+
{
23+
.image = VM_IMAGE_BUILTIN(guest_image, VM0_IRAM_BASE),
24+
25+
.entry = VM0_IRAM_BASE,
26+
27+
.cpu_affinity = 0xF,
28+
29+
.platform = {
30+
.cpu_num = 4,
31+
32+
.region_num = 1,
33+
.regions = (struct vm_mem_region[]) {
34+
{
35+
.base = VM0_IRAM_BASE,
36+
.size = VM0_IRAM_SIZE,
37+
},
38+
},
39+
40+
.dev_num = 1,
41+
.devs = (struct vm_dev_region[]) {
42+
{
43+
.pa = E3650_UART_BASE,
44+
.va = E3650_UART_BASE,
45+
.size = 0x10000,
46+
.interrupt_num = 1,
47+
.interrupts = (unsigned[]) { 114 },
48+
},
49+
},
50+
51+
.arch = {
52+
.gic = {
53+
.gicd_addr = E3650_GICD_BASE,
54+
.gicr_addr = E3650_GICR_BASE,
55+
},
56+
},
57+
},
58+
}
59+
}
60+
};

demos/baremetal/make.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ baremetal_args:=MEM_BASE=0x10000000
77
fvpr_image_data:=$(baremetal_image)@0x10000000
88
endif
99

10+
ifeq ($(PLATFORM),e3650)
11+
baremetal_args:=MEM_BASE=0x00B00000 MEM_SIZE=0x00100000 ARCH_CFLAGS="-Wno-error=incompatible-pointer-types"
12+
endif
13+
1014
$(eval $(call build-baremetal, $(baremetal_image), $(baremetal_args)))
1115

1216
guest_images:=$(baremetal_image)

guests/baremetal/make.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ baremetal_bin:=$(baremetal_src)/build/$(PLATFORM)/baremetal.bin
99

1010
define build-baremetal
1111
$(strip $1): $(baremetal_src)
12+
$(MAKE) -C $(baremetal_src) PLATFORM=$(PLATFORM) clean
1213
$(MAKE) -C $(baremetal_src) PLATFORM=$(PLATFORM) $(strip $2)
1314
cp $(baremetal_bin) $$@
1415
endef

platforms/e3650/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# E3650 Platform Support
2+
3+
This directory contains the platform-specific configurations and build rules for the **Phytium E3650** platform.
4+
5+
## Supported Demos
6+
7+
Currently, the following demos are supported for E3650:
8+
9+
1. **`baremetal`**
10+
* A single baremetal guest (VM0) running on 4 cores.
11+
* Features basic UART output and interrupt handling.
12+
* Memory Base: `0x00B00000`
13+
14+
2. **`baremetal+baremetal`**
15+
* Two simultaneous baremetal guests.
16+
* **VM0** (Master): Runs on Cores 0-1, Memory Base `0x00B00000`.
17+
* **VM1** (Slave): Runs on Cores 2-3, Memory Base `0x00C00000`.
18+
* Includes inter-vm communication and staggered UART output to demonstrate multi-core isolation.
19+
20+
## Build Instructions
21+
22+
To build a demo, use the standard `make` command from the root `bao-demos` directory. You must specify `PLATFORM=e3650` and the corresponding `CROSS_COMPILE`.
23+
24+
### Prerequisites
25+
* `arm-none-eabi-` toolchain (AArch32)
26+
27+
### Building Single Baremetal
28+
```bash
29+
make PLATFORM=e3650 DEMO=baremetal CROSS_COMPILE=arm-none-eabi-
30+
```
31+
32+
### Building Dual Baremetal
33+
```bash
34+
make PLATFORM=e3650 DEMO=baremetal+baremetal CROSS_COMPILE=arm-none-eabi-
35+
```
36+
37+
## Output Artifacts
38+
39+
The build system automatically fetches the external PAC tool (`e3650_pac_tool`) and packages the Bao Hypervisor and Guest images into a signed PAC file.
40+
41+
* **Output Location**: `wrkdir/imgs/e3650/<DEMO_NAME>/bao_pack_output/bao.pac`
42+
* **Intermediate Binaries**: `wrkdir/imgs/e3650/<DEMO_NAME>/*.bin`
43+
44+
## Flashing
45+
46+
Flash the downloaded bootloader($BAO_DEMOS_WRKDIR_SRC/e3650_pac_tool/bootloader/e3650_bootloader.pac) and bao.pac package into the E3650 board using Semidrive's SDFactoryTool. Access to this tool requires an active support agreement or direct contact with [Semidrive](https://www.semidrive.com/).

platforms/e3650/make.mk

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARCH:=aarch32
2+
3+
# PAC Tool Configuration
4+
pac_tool_dir:=$(wrkdir_src)/e3650_pac_tool
5+
wrkdirs+=$(pac_tool_dir)
6+
pac_tool_repo:=https://github.com/leon6002/e3650_pac_tool.git
7+
pac_tool_branch:=main
8+
9+
# Target to fetch the PAC tool
10+
$(pac_tool_dir)/bao_pac.sh:
11+
rm -rf $(pac_tool_dir)
12+
git clone --recursive --branch $(pac_tool_branch) $(pac_tool_repo) $(pac_tool_dir)
13+
14+
# PAC Image Generation
15+
pac_image:=$(wrkdir_demo_imgs)/bao_2vms.pac
16+
bao_bin:=$(wrkdir_demo_imgs)/bao.bin
17+
guest_bin:=$(wrkdir_demo_imgs)/baremetal_vm0.bin
18+
19+
$(pac_image): $(bao_image) $(guest_images) $(pac_tool_dir)/bao_pac.sh
20+
$(pac_tool_dir)/bao_pac.sh $(bao_image) $(guest_images)
21+
22+
platform: $(pac_image)
23+

0 commit comments

Comments
 (0)