Skip to content

Commit dfd9d6d

Browse files
JensenWei007joaopeixoto13
authored andcommitted
feat(rh850-u2a16): Add baremetal demo for RH850-U2A16
Signed-off-by: JensenWei007 <jensenwei007@gmail.com> Signed-off-by: David Cerdeira <davidmcerdeira@gmail.com>
1 parent e98676f commit dfd9d6d

7 files changed

Lines changed: 163 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ environment+=BAO_DEMOS_SDCARD=/media/$$USER/boot
7272
all: platform
7373

7474
bao_repo:=https://github.com/bao-project/bao-hypervisor
75-
bao_version:=v2.0-rc3
75+
bao_version:=v2.0-rc4
7676
bao_src:=$(wrkdir_src)/bao
7777
bao_cfg_repo:=$(wrkdir_demo_imgs)/config
7878
wrkdirs+=$(bao_cfg_repo)

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ d) For RISC-V RV32, use the **riscv32-unknown-elf-** toolchain.
5959

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

62+
e) For RH850, use the **v850-elf-** toolchain.
63+
64+
Download it from [Bao's Project V850 Toolchain repo][v850-toolchain].
65+
6266
Install the toolchain. Then, set the **CROSS_COMPILE** environment variable
6367
with the reference toolchain prefix path:
6468

@@ -241,6 +245,9 @@ Build the firmware and deploy the system according to the target platform:
241245
#### RISC-V platforms:
242246
* [QEMU virt](platforms/qemu-riscv64-virt/README.md)
243247

248+
#### RH850 platforms:
249+
* [RH850 U2A16](platforms/rh850-u2a16/README.md)
250+
244251
---
245252

246253
## Appendix I
@@ -259,6 +266,7 @@ Build the firmware and deploy the system according to the target platform:
259266
| FVP-R AArch32 | fvp-r-aarch32 | aarch32 |
260267
| QEMU RV64 virt | qemu-riscv64-virt | riscv64 |
261268
| QEMU RV32 virt | qemu-riscv32-virt | riscv32 |
269+
| RH850-U2A16 | rh850-u2a16 | rh850 |
262270

263271

264272
| | DEMO |
@@ -285,6 +293,7 @@ Build the firmware and deploy the system according to the target platform:
285293
| fvp-r-aarch32 | x | | | x | |
286294
| qemu-riscv64-virt | x | x | | | x |
287295
| qemu-riscv32-virt | x | x | | | |
296+
| rh850-u2a16 | x | | | | |
288297

289298

290299
---
@@ -296,6 +305,7 @@ Build the firmware and deploy the system according to the target platform:
296305
| arm-none-eabi-gcc | 14.2.1 |
297306
| aarch64-none-elf-gcc | 14.2.1 |
298307
| riscv64-unknown-elf-gcc | 13.2.0 |
308+
| v850-elf-gcc | 14.2.0 |
299309
| make | 4.3 |
300310
| dtc | 1.6.1 |
301311
| gcc | 11.4.0 |
@@ -310,4 +320,5 @@ Build the firmware and deploy the system according to the target platform:
310320
[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
311321
[riscv64-toolchain]: https://github.com/bao-project/bao-riscv-toolchain/releases/download/gc891d8dc23e/riscv64-unknown-elf.tar.gz
312322
[riscv32-toolchain]: https://github.com/bao-project/bao-riscv-toolchain/releases/download/gc891d8dc23e/riscv32-unknown-elf.tar.gz
323+
[v850-toolchain]: https://github.com/bao-project/gcc-v850-elf-toolchain/releases/download/v14.2.0/gcc-14.2.0-v850-elf.tar.gz
313324

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
struct config config = {
9+
10+
CONFIG_HEADER
11+
12+
.vmlist_size = 1,
13+
14+
.vmlist = (struct vm_config[]){
15+
{
16+
.entry = 0x7F0000,
17+
.image = VM_IMAGE_LOADED(0x7F0000,0x7F0000,0x10000),
18+
.cpu_affinity = 0xf,
19+
20+
.platform = {
21+
.cpu_num = 4,
22+
.region_num = 2,
23+
.regions = (struct vm_mem_region[]) {
24+
// Code Flash (Bank A) -> Guest code
25+
{
26+
.base = 0x7F0000,
27+
.size = 0x10000
28+
},
29+
// Cluster1 RAM -> Guest Data
30+
{
31+
.base = 0xfe100000,
32+
.size = 0x80000
33+
}
34+
},
35+
36+
.dev_num = 4,
37+
.devs = (struct vm_dev_region[]) {
38+
// Standby Controller
39+
{
40+
// 0xFF981000 -> 0xFF982000
41+
.id = 0,
42+
.pa = 0xFF981000,
43+
.va = 0xFF981000,
44+
.size = 0x1000,
45+
.interrupt_num = 0,
46+
.interrupts = NULL
47+
},
48+
// RLIN35
49+
{
50+
// 0xFFC7C100 -> 0xFFC7C140
51+
.id = 0,
52+
.pa = 0xFFC7C100,
53+
.va = 0xFFC7C100,
54+
.size = 0x40,
55+
.interrupt_num = 1,
56+
.interrupts = (irqid_t[]) {438}
57+
},
58+
// OSTM0
59+
{
60+
// 0xFFBF0000 -> 0xFFBF0100
61+
.id = 0,
62+
.pa = 0xFFBF0000,
63+
.va = 0xFFBF0000,
64+
.size = 0x100,
65+
.interrupt_num = 1,
66+
.interrupts = (irqid_t[]) {199}
67+
},
68+
// INTC1 (self)
69+
{
70+
// 0xFFFC0000 -> 0xFFFC4000
71+
.id = 0,
72+
.pa = 0xFFFC0000,
73+
.va = 0xFFFC0000,
74+
.size = 0x4000,
75+
.interrupt_num = 0,
76+
.interrupts = NULL
77+
}
78+
},
79+
}
80+
}
81+
}
82+
};

guests/baremetal/make.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
baremetal_src:=$(wrkdir_src)/baremetal
2-
baremetal_repo:=https://github.com/bao-project/bao-baremetal-guest.git
2+
baremetal_repo:=https://github.com/bao-project/bao-baremetal-guest.git
33
baremetal_branch:=demo-next
44

55
$(baremetal_src):

platforms/rh850-u2a16/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# RH850-U2A16
2+
3+
## 1) Download and install the gcc toolchain
4+
5+
You can download and compile the toolchain from the official GCC repository.
6+
7+
A toolchain that has been used and verified is [gcc 14.2.0](https://github.com/bao-project/gcc-v850-elf-toolchain/releases/download/v14.2.0/gcc-14.2.0-v850-elf.tar.gz).
8+
9+
10+
## 2) Download and install rfp-cli
11+
12+
You can download `rfp-cli` for linux [here](https://www.renesas.com/rfp).
13+
Add it to your PATH.
14+
15+
```
16+
rfp-cli --version
17+
Renesas Flash Programmer CLI V1.11
18+
Module Version: V3.18.00.000
19+
```
20+
21+
## 3) Build a demo
22+
For example to build the baremetal demo:
23+
24+
```sh
25+
export CROSS_COMPILE=v850-elf-
26+
export DEMO=baremetal
27+
export PLATFORM=rh850-u2a16
28+
29+
make
30+
```
31+
32+
## 4) Flash bao.bin and guests to board
33+
34+
You must use the `rfp-cli` tool to program the `bao.bin` and guest images.
35+
Please take a look at the corresponding demo instructions for this platform.
36+
* [baremetal](baremetal.md)

platforms/rh850-u2a16/baremetal.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# RH850-U2A16 berametal DEMO
2+
After building the demo follow these steps.
3+
4+
<!--- instruction#1 -->
5+
## Generate baremetal HEX file
6+
7+
```
8+
${CROSS_COMPILE}objcopy -O ihex ${BAO_DEMOS_WRKDIR_SRC}/baremetal/build/${PLATFORM}/baremetal.elf ${BAO_DEMOS_WRKDIR_IMGS}/baremetal.hex
9+
```
10+
11+
<!--- instruction#2 -->
12+
## Flash the guest and bao binaries
13+
14+
```
15+
rfp-cli -device RH850/U2x -tool e2 \
16+
-osc 40.0 \
17+
-auth id FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF \
18+
-program -file $BAO_DEMOS_WRKDIR_IMGS/baremetal.hex
19+
20+
rfp-cli -device RH850/U2x -tool e2 \
21+
-osc 40.0 \
22+
-auth id FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF \
23+
-program -bin 0x0 $BAO_DEMOS_WRKDIR_IMGS/bao.bin -run
24+
```
25+
<!--- instruction#end -->

platforms/rh850-u2a16/make.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARCH:=rh850
2+
3+
instuctions:=$(bao_demos)/platforms/$(PLATFORM)/$(DEMO).md
4+
5+
platform: $(bao_image)
6+
$(call print-instructions, $(instuctions), 1, false)
7+
$(call print-instructions, $(instuctions), 2, true)

0 commit comments

Comments
 (0)