Skip to content

Commit fcdc7f9

Browse files
boards: openhwgroup: add CVA6 on Arty A7 board
Adds support for the CVA6 CPU on an Arty A7 FPGA board (https://github.com/openhwgroup/cva6). The SoC currently contains the CVA6 CPU, interrupt controllers (CLINT and PLIC), UART, a SPI for booting from SD, a boot ROM, a GPIO and the lowRISC ethernet subsystem. Two slightly different versions of the board are added, with a 32-bit and a 64-bit configuration of CVA6, respectively. Signed-off-by: Eric Ackermann <[email protected]>
1 parent 3f4a9c4 commit fcdc7f9

File tree

12 files changed

+342
-0
lines changed

12 files changed

+342
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
config BOARD_CV32A6_ARTY_A7_100
4+
select SOC_CV32A6
5+
select SOC_FAMILY_CVA6_PROVIDE_FPGA_POWEROFF
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board_runner_args(openocd "--config=${BOARD_DIR}/support/ariane.cfg")
4+
board_runner_args(openocd "--use-elf")
5+
board_runner_args(openocd "--verify")
6+
board_runner_args(openocd "--cmd-pre-init=riscv.cpu configure -work-area-phys 0x8f000000 -work-area-size 16780000")
7+
8+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board:
4+
name: cv32a6_arty_a7_100
5+
vendor: openhwgroup
6+
socs:
7+
- name: cv32a6
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <openhwgroup/cv32a6.dtsi>
9+
10+
/ {
11+
model = "Openhardwaregroup CV32A6 on Arty A7 100";
12+
compatible = "ariane,cv32a6_arty_a7_100";
13+
14+
chosen {
15+
zephyr,console = &uart0;
16+
zephyr,shell-uart = &uart0;
17+
zephyr,sram = &memory0;
18+
};
19+
};
20+
21+
&uart0 {
22+
status = "okay";
23+
clock-frequency = <25000000>;
24+
25+
current-speed = <57600>;
26+
27+
// different interrupt than the CISPA version of the SoC
28+
interrupts = <1 4>;
29+
};
30+
31+
&spi0 {
32+
status = "okay";
33+
// different interrupt than the CISPA version of the SoC
34+
interrupts = <2 2>;
35+
};
36+
37+
&clint{
38+
status = "okay";
39+
};
40+
41+
&dma0 {
42+
status = "disabled";
43+
};
44+
45+
46+
&mdio0{
47+
status = "disabled";
48+
};
49+
50+
&eth0 {
51+
status = "disabled";
52+
};
53+
54+
// Arty only has 256 MiB of memory
55+
&memory0 {
56+
reg = <0x80000000 0x10000000>;
57+
};
58+
59+
// Arty can only run at 25 Mhz
60+
&cpus_0 {
61+
timebase-frequency = <12500000>;
62+
};
63+
64+
&cpu_0 {
65+
clock-frequency = <25000000>;
66+
};
67+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
CONFIG_BASE64=y
4+
CONFIG_INCLUDE_RESET_VECTOR=y
5+
CONFIG_CONSOLE=y
6+
CONFIG_SERIAL=y
7+
CONFIG_UART_CONSOLE=y
8+
CONFIG_UART_NS16550=y
9+
CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
10+
CONFIG_CONSOLE_HANDLER=y
11+
CONFIG_XIP=n
12+
CONFIG_INIT_STACKS=y
13+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=100
14+
CONFIG_POWEROFF=y
15+
16+
# RNG
17+
CONFIG_TIMER_RANDOM_GENERATOR=y
18+
CONFIG_TEST_RANDOM_GENERATOR=y
19+
20+
# IRQs
21+
CONFIG_MULTI_LEVEL_INTERRUPTS=y
22+
CONFIG_2ND_LEVEL_INTERRUPTS=y
23+
# 1 PLIC
24+
CONFIG_NUM_2ND_LEVEL_AGGREGATORS=1
25+
CONFIG_PLIC=y
26+
CONFIG_3RD_LEVEL_INTERRUPTS=n
27+
28+
# no networking support on this board
29+
30+
# logging
31+
CONFIG_LOG=y
32+
CONFIG_LOG_DEFAULT_LEVEL=3
33+
CONFIG_THREAD_NAME=y
34+
35+
# increased stack sizes
36+
CONFIG_ISR_STACK_SIZE=524288
37+
CONFIG_MAIN_STACK_SIZE=524288
38+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=524288
39+
CONFIG_IDLE_STACK_SIZE=524288
40+
41+
# slower clock on Arty
42+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=12500000
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Based on the ariane.cfg from the cva6 project:
5+
# https://github.com/openhwgroup/cva6/blob/master/corev_apu/fpga/ariane_arty_a7.cfg
6+
adapter driver ftdi
7+
8+
transport select jtag
9+
10+
ftdi vid_pid 0x0403 0x6010
11+
12+
# Channel 1 is UART
13+
ftdi channel 0
14+
15+
# https://github.com/epsilon537/boxlambda/blob/master/scripts/arty_a7_100t.openocd.cfg
16+
ftdi layout_init 0x00e8 0x60eb
17+
18+
set _CHIPNAME riscv
19+
jtag newtap $_CHIPNAME cpu -irlen 6 -expected-id 0x13631093
20+
21+
set _TARGETNAME $_CHIPNAME.cpu
22+
target create $_TARGETNAME riscv -chain-position $_TARGETNAME -coreid 0
23+
24+
riscv set_ir idcode 0x09
25+
riscv set_ir dtmcs 0x22
26+
riscv set_ir dmi 0x23
27+
28+
riscv set_command_timeout_sec 120
29+
30+
adapter speed 100
31+
32+
# prefer to use sba for system bus access
33+
riscv set_mem_access progbuf sysbus abstract
34+
35+
gdb_report_data_abort enable
36+
gdb_report_register_access_error enable
37+
38+
# Try enabling address translation (only works for newer versions)
39+
if { [catch {riscv set_enable_virtual on} ] } {
40+
echo "Warning: This version of OpenOCD does not support address translation. To debug on virtual addresses, please update to the latest version." }
41+
42+
init
43+
halt
44+
echo "Ready for Remote Connections"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
config BOARD_CV64A6_ARTY_A7_100
4+
select SOC_CV64A6_IMAC
5+
select SOC_FAMILY_CVA6_PROVIDE_FPGA_POWEROFF
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board_runner_args(openocd "--config=${BOARD_DIR}/support/ariane.cfg")
4+
board_runner_args(openocd "--use-elf")
5+
board_runner_args(openocd "--verify")
6+
board_runner_args(openocd "--cmd-pre-init=riscv.cpu configure -work-area-phys 0x8f000000 -work-area-size 16780000")
7+
8+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
board:
4+
name: cv64a6_arty_a7_100
5+
vendor: openhwgroup
6+
socs:
7+
- name: cv64a6
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <openhwgroup/cv64a6.dtsi>
9+
10+
/ {
11+
model = "Openhardwaregroup CV64A6 on Arty A7 100";
12+
compatible = "ariane,cv64a6_arty_a7_100";
13+
14+
chosen {
15+
zephyr,console = &uart0;
16+
zephyr,shell-uart = &uart0;
17+
zephyr,sram = &memory0;
18+
};
19+
};
20+
21+
&uart0 {
22+
status = "okay";
23+
// different interrupt than the CISPA version of the SoC
24+
interrupts = <1 4>;
25+
};
26+
27+
&spi0 {
28+
status = "okay";
29+
// different interrupt than the CISPA version of the SoC
30+
interrupts = <2 2>;
31+
};
32+
33+
&clint{
34+
status = "okay";
35+
};
36+
37+
&dma0 {
38+
status = "disabled";
39+
};
40+
41+
42+
&mdio0{
43+
status = "disabled";
44+
};
45+
46+
&eth0 {
47+
status = "disabled";
48+
};
49+
50+
// Arty only has 256 MiB of memory
51+
&memory0 {
52+
reg = <0x80000000 0x10000000>;
53+
};
54+
55+
// Arty can only run at 25 Mhz
56+
&cpus_0 {
57+
timebase-frequency = <12500000>;
58+
};
59+
60+
&cpu_0{
61+
clock-frequency = <25000000>;
62+
};
63+

0 commit comments

Comments
 (0)