Skip to content

Commit d81b4f7

Browse files
JensenWei007DavidMCerdeira
authored andcommitted
feat(rh850-u2a16): Add baremetal demo for RH850-U2A16
Signed-off-by: JensenWei007 <jensenwei007@gmail.com>
1 parent 8384ee5 commit d81b4f7

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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 = 0x1,
19+
20+
.platform = {
21+
.cpu_num = 2,
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+
// Cluster0 RAM -> Guest Data
30+
{
31+
.base = 0xfe100000,
32+
.size = 0x80000
33+
}
34+
},
35+
36+
.dev_num = 5,
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+
// INTIF
59+
{
60+
// 0xFF090000 -> 0xFF090220
61+
.id = 0,
62+
.pa = 0xFF090000,
63+
.va = 0xFF090000,
64+
.size = 0x220,
65+
.interrupt_num = 0,
66+
.interrupts = NULL
67+
},
68+
// OSTM0
69+
{
70+
// 0xFFBF0000 -> 0xFFBF0100
71+
.id = 0,
72+
.pa = 0xFFBF0000,
73+
.va = 0xFFBF0000,
74+
.size = 0x100,
75+
.interrupt_num = 1,
76+
.interrupts = (irqid_t[]) {199}
77+
},
78+
// INTC1 (self)
79+
{
80+
// 0xFFFC0000 -> 0xFFFC4000
81+
.id = 0,
82+
.pa = 0xFFFC0000,
83+
.va = 0xFFFC0000,
84+
.size = 0x4000,
85+
.interrupt_num = 0,
86+
.interrupts = NULL
87+
}
88+
},
89+
90+
// .arch = {
91+
// .intc = {
92+
// .intc1_base = 0xFFFC0000,
93+
// .intc2_base = 0xFFF80000,
94+
// },
95+
// .ibus = {
96+
// .barr_base = 0xFFFB8000,
97+
// .ipir_base = 0xFFFB9000
98+
// },
99+
// .bootctrl = {
100+
// .base = 0xFFFB2000
101+
// }
102+
// },
103+
104+
.remio_dev_num = 0,
105+
.remio_devs = NULL
106+
}
107+
}
108+
}
109+
};

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 10.3.0](https://github.com/dkulacz/gcc-v850-elf-toolchain).
8+
9+
10+
## 2) Build bao.bin and baremetal.hex
11+
12+
```sh
13+
# in bao-demos/
14+
make
15+
```
16+
17+
The `bao.bin` and `baremetal.hex` is in `wrkdir/imgs/rh850-u2a16/baremetal`
18+
19+
20+
## 3) Flash bao.bin and baremetal.hex to board
21+
22+
You can use a programming tool to program these two files onto the development board.
23+
24+
For example, on macOS, the steps are as follows:
25+
26+
```sh
27+
./rfp-cli -d RH850/U2x -t e2 -if uart \
28+
-auth id FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF \
29+
-auto -osc 20.0 \
30+
-bin 0 bao.bin -p
31+
32+
./rfp-cli -device RH850/U2x -tool e2 -if uart \
33+
-auth id FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF \
34+
-osc 20.0 \
35+
-file baremetal.hex -p
36+
```

platforms/rh850-u2a16/make.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ARCH:=rh850
2+
3+
platform:
4+
$(CROSS_COMPILE)objcopy -I binary -O ihex --change-addresses 0x7F0000 $(wrkdir_demo_imgs)/$(DEMO).bin $(wrkdir_demo_imgs)/$(DEMO).hex

0 commit comments

Comments
 (0)