Skip to content

Commit

Permalink
add cva6 guest platform
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Sa <[email protected]>
  • Loading branch information
ninolomata committed Apr 26, 2023
1 parent bd9a170 commit ad56bf5
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Finally, initialize the repo and all the submodules by running:
To build the bare-metal guest for the cva6:

`cd bao-baremetal-guest`\
`cp -r ../guest/platform/* ./src/platform`\
`make CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=cva6`

## 1.2) CVA6 SDK Linux
Expand Down
37 changes: 37 additions & 0 deletions guest/platform/cva6/cva6.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <uart.h>
#include <8250_uart.h>

#define CVA6_DEFAULT_UART_ADDR 0x10000000
#define CVA6_DEFAULT_UART_FREQ 50000000
#define CVA6_DEFAULT_UART_BAUDRATE 115200
#define CVA6_DEFAULT_UART_REG_SHIFT 2
#define CVA6_DEFAULT_UART_REG_WIDTH 4


void uart_init(){
uart8250_init(CVA6_DEFAULT_UART_ADDR,
CVA6_DEFAULT_UART_FREQ,
CVA6_DEFAULT_UART_BAUDRATE,
CVA6_DEFAULT_UART_REG_SHIFT,
CVA6_DEFAULT_UART_REG_WIDTH);
}

void uart_putc(char c)
{
uart8250_putc(c);
}

char uart_getchar(void)
{
return uart8250_getc();
}

void uart_enable_rxirq()
{
uart8250_enable_rx_int();
}

void uart_clear_rxirq()
{
uart8250_interrupt_handler();
}
10 changes: 10 additions & 0 deletions guest/platform/cva6/inc/plat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef PLAT_H
#define PLAT_H

#define PLAT_MEM_BASE 0x80200000
#define PLAT_MEM_SIZE 0x4000000

#define PLAT_TIMER_FREQ (1000000ull)
#define UART_IRQ_ID (1)

#endif
2 changes: 2 additions & 0 deletions guest/platform/cva6/plat.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARCH:=riscv
drivers:=8250_uart
2 changes: 2 additions & 0 deletions guest/platform/cva6/sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plat_c_srcs:=cva6.c
plat_s_srcs:=

0 comments on commit ad56bf5

Please sign in to comment.