Skip to content

Commit 1e8fbb3

Browse files
committed
feat(platform): add mps3 support
Signed-off-by: Jose Martins <[email protected]>
1 parent 0ea6045 commit 1e8fbb3

File tree

9 files changed

+151
-10
lines changed

9 files changed

+151
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ platforms is presented below:
5656

5757
**Armv8-R AArch32**
5858
- [x] Arm Fixed Virtual Platforms
59+
- [x] QEMU MPS3-AN536
5960
- [ ] NXP S32Z/E
6061
- [ ] Renesas RZT2M
61-
- [ ] QEMU MPS3-AN536
6262

6363
**RISC-V RV64**
6464
- [x] QEMU virt
@@ -115,29 +115,29 @@ Systems**". In Workshop on Next Generation Real-Time Embedded Systems (NG-RES 20
115115
Schloss Dagstuhl-Leibniz-Zentrum für Informatik. 2020.
116116
https://drops.dagstuhl.de/opus/volltexte/2020/11779/
117117

118-
2. José Martins and Sandro Pinto. "**Bao: a modern lightweight embedded hypervisor**".
118+
1. José Martins and Sandro Pinto. "**Bao: a modern lightweight embedded hypervisor**".
119119
In Proceedings of the Embedded World Conference, Nuremberg, Germany, 2020.
120120

121-
3. José Martins and Sandro Pinto. "**Static Partitioning Virtualization on RISC-V**".
121+
1. José Martins and Sandro Pinto. "**Static Partitioning Virtualization on RISC-V**".
122122
In RISC-V Summit, virtual, 2020. https://www.youtube.com/watch?v=yuxMn4ZApEM
123123

124-
4. Bruno Sá, José Martins and Sandro Pinto. "**A First Look at RISC-V Virtualization from an Embedded Systems Perspective**".
124+
1. Bruno Sá, José Martins and Sandro Pinto. "**A First Look at RISC-V Virtualization from an Embedded Systems Perspective**".
125125
In IEEE Transactions on Computers, doi: 10.1109/TC.2021.3124320.
126126

127-
5. Samuel Pereira, João Sousa, Sandro Pinto, José Martins, David Cerdeira "**Bao-Enclave: Virtualization-based Enclaves for Arm**.
127+
1. Samuel Pereira, João Sousa, Sandro Pinto, José Martins, David Cerdeira "**Bao-Enclave: Virtualization-based Enclaves for Arm**.
128128
In https://arxiv.org/abs/2209.05572
129129

130-
6. José Martins and Sandro Pinto. "**Shedding Light on Static Partitioning Hypervisors for Arm-based Mixed-Criticality Systems**".
130+
1. José Martins and Sandro Pinto. "**Shedding Light on Static Partitioning Hypervisors for Arm-based Mixed-Criticality Systems**".
131131
In RTAS 2023, San Antonio, Texas, 2023. https://arxiv.org/abs/2303.11186
132132

133-
7. José Martins and Sandro Pinto. "**Porting of a Static Partitioning Hypervisor to Arm’s Cortex-R52**"
133+
1. José Martins and Sandro Pinto. "**Porting of a Static Partitioning Hypervisor to Arm’s Cortex-R52**"
134134
In Embedded Open Source Summit 2023, Prague, Czech Republic, 2023. https://www.youtube.com/watch?v=GmeOikZJRas
135135

136-
8. David Cerdeira and José Martins. "**"Hello 'Bao' World" Tutorial**"
136+
1. David Cerdeira and José Martins. "**"Hello 'Bao' World" Tutorial**"
137137
In Bao Half-Day, Virtual Workshop, 2023. https://www.youtube.com/watch?v=6c8_MG-OHYo
138138

139-
9. João Peixoto, José Martins, David Cerdeira and Sandro Pinto. "**BiRtIO: VirtIO for Real-Time Network Interface Sharing on the Bao Hypervisor**"
139+
1. João Peixoto, José Martins, David Cerdeira and Sandro Pinto. "**BiRtIO: VirtIO for Real-Time Network Interface Sharing on the Bao Hypervisor**"
140140
In IEEE Access, 2024. https://ieeexplore.ieee.org/document/10781314
141141

142-
10. Hidemasa Kawasaki and Soramichi Akiyama. "**Running Bao Hypervisor on gem5**"
142+
1. Hidemasa Kawasaki and Soramichi Akiyama. "**Running Bao Hypervisor on gem5**"
143143
In gem5 blog, 2024. https://www.gem5.org/2024/11/12/bao-on-gem5.html
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <bao.h>
7+
#include <drivers/cmsdk_uart.h>
8+
9+
#define CMSDK_STATE_TX_BUF_FULL (1UL << 0)
10+
#define CMSDK_STATE_TX_BUF_OVERRUN (1UL << 2)
11+
#define CMSDK_STATE_RX_BUF_OVERRUN (1UL << 3)
12+
#define CMSDK_CTRL_TXEN (1UL << 0)
13+
14+
void uart_init(volatile struct cmsdk_uart_hw* ptr_uart)
15+
{
16+
ptr_uart->state = CMSDK_STATE_TX_BUF_OVERRUN | CMSDK_STATE_RX_BUF_OVERRUN;
17+
ptr_uart->intstatus = 0xf;
18+
}
19+
20+
void uart_enable(volatile struct cmsdk_uart_hw* ptr_uart)
21+
{
22+
ptr_uart->ctrl = CMSDK_CTRL_TXEN;
23+
}
24+
25+
void uart_putc(volatile struct cmsdk_uart_hw* ptr_uart, int8_t c)
26+
{
27+
while (ptr_uart->state & CMSDK_STATE_TX_BUF_FULL) { }
28+
ptr_uart->data = (uint32_t)c;
29+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#ifndef __CMSDK_UART_H_
7+
#define __CMSDK_UART_H_
8+
9+
#include <stdint.h>
10+
11+
struct cmsdk_uart_hw {
12+
volatile uint32_t data;
13+
volatile uint32_t state;
14+
volatile uint32_t ctrl;
15+
volatile uint32_t intstatus;
16+
volatile uint32_t bauddiv;
17+
} __attribute__((packed));
18+
19+
typedef struct cmsdk_uart_hw bao_uart_t;
20+
21+
void uart_enable(volatile struct cmsdk_uart_hw* ptr_uart);
22+
void uart_init(volatile struct cmsdk_uart_hw* ptr_uart);
23+
void uart_putc(volatile struct cmsdk_uart_hw* ptr_uart, int8_t c);
24+
25+
#endif /* __CMSDK_UART_H_ */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## SPDX-License-Identifier: Apache-2.0
2+
## Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
drivers-objs-y+=cmsdk_uart/cmsdk_uart.o
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#ifndef __PLAT_PLATFORM_H__
7+
#define __PLAT_PLATFORM_H__
8+
9+
#include <drivers/cmsdk_uart.h>
10+
11+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#ifndef __PLAT_PSCI_H__
7+
#define __PLAT_PSCI_H__
8+
9+
#define PSCI_POWER_STATE_LVL_0 0x0000000 // TBD
10+
#define PSCI_POWER_STATE_LVL_1 0x1000000 // TBD
11+
#define PSCI_POWER_STATE_LVL_2 0x2000000 // TBD
12+
#define PSCI_STATE_TYPE_STANDBY 0x00000 // TBD
13+
#define PSCI_STATE_TYPE_POWERDOWN (0UL << 30) // TBD
14+
#define PSCI_STATE_TYPE_BIT (0UL << 30) // TBD
15+
16+
#endif // __PLAT_PSCI_H__
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <platform.h>
7+
8+
struct platform platform = {
9+
10+
.cpu_num = 2,
11+
.cpu_master_fixed = true,
12+
.cpu_master = 0,
13+
14+
.region_num = 1,
15+
.regions = (struct mem_region[]) {
16+
{
17+
.base = 0x20000000,
18+
.size = 0x80000000,
19+
}
20+
},
21+
22+
.console = {
23+
.base = 0xE0205000, // UART2
24+
},
25+
26+
.arch = {
27+
.gic = {
28+
.gicd_addr = 0xF0000000,
29+
.gicr_addr = 0xF0100000,
30+
.maintenance_id = 25,
31+
},
32+
},
33+
34+
};

src/platform/mps3-an536/objects.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## SPDX-License-Identifier: Apache-2.0
2+
## Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
boards-objs-y+=mps3_desc.o
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## SPDX-License-Identifier: Apache-2.0
2+
## Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
5+
ARCH:=armv8
6+
ARCH_SUB:=aarch32
7+
ARCH_PROFILE:=armv8-r
8+
9+
GIC_VERSION:=GICV3
10+
11+
drivers = cmsdk_uart
12+
13+
platform_description:=mps3_desc.c
14+
15+
platform-cppflags =
16+
platform-cflags = -gdwarf-4
17+
platform-asflags =
18+
platform-ldflags =

0 commit comments

Comments
 (0)