Skip to content

Commit ae355cc

Browse files
katsustercfriedt
authored andcommitted
boards: add support for HiFive Unleashed
This patch adds new support for SiFive HiFive Unleashed which has SiFive FU540 SoC, DDR and some peripherals. This is first version so not support all features of the board. Signed-off-by: Katsuhiro Suzuki <[email protected]>
1 parent 82f75ed commit ae355cc

8 files changed

+184
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2021 Katsuhiro Suzuki
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_HIFIVE_UNLEASHED
5+
bool "HiFive Unleashed target"
6+
depends on SOC_RISCV_SIFIVE_FU540
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2021 Katsuhiro Suzuki
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_HIFIVE_UNLEASHED
5+
6+
config BOARD
7+
default "hifive_unleashed"
8+
9+
config SYS_CLOCK_TICKS_PER_SEC
10+
default 1000
11+
12+
config SYS_CLOCK_HW_CYCLES_PER_SEC
13+
default 1000000
14+
15+
config SPI_SIFIVE
16+
default y
17+
depends on SPI
18+
19+
config UART_SIFIVE
20+
default y
21+
depends on SERIAL
22+
23+
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
set(OPENOCD_USE_LOAD_IMAGE NO)
4+
5+
board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_hifive_unleashed.cfg")
6+
7+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _hifive_unleashed:
2+
3+
SiFive HiFive Unleashed
4+
#######################
5+
6+
Overview
7+
********
8+
9+
The HiFive Unleashed is a development board with a SiFive FU540-C000
10+
multi-core 64bit RISC-V SoC.
11+
12+
Programming and debugging
13+
*************************
14+
15+
Building
16+
========
17+
18+
Applications for the ``hifive_unleashed`` board configuration can be built as
19+
usual (see :ref:`build_an_application`) using the corresponding board name:
20+
21+
.. zephyr-app-commands::
22+
:board: hifive_unleashed
23+
:goals: build
24+
25+
Flashing
26+
========
27+
28+
Current version has not yet supported flashing binary to onboard Flash ROM.
29+
30+
This board has USB-JTAG interface and this can be used with OpenOCD.
31+
Load applications on DDR and run as follows:
32+
33+
.. code-block:: console
34+
35+
openocd -c 'bindto 0.0.0.0' \
36+
-f boards/riscv/hifive_unleashed/support/openocd_hifive_unleashed.cfg
37+
riscv64-zephyr-elf-gdb build/zephyr/zephyr.elf
38+
(gdb) target remote :3333
39+
(gdb) c
40+
41+
Debugging
42+
=========
43+
44+
Refer to the detailed overview about :ref:`application_debugging`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2021 Katsuhiro Suzuki
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <riscv64-fu540.dtsi>
10+
11+
/ {
12+
chosen {
13+
zephyr,console = &uart0;
14+
zephyr,shell-uart = &uart0;
15+
zephyr,sram = &ram0;
16+
};
17+
18+
ram0: ram0@80000000 {
19+
compatible = "memory";
20+
reg = <0x80000000 0xf0000000>;
21+
reg-names = "mem";
22+
};
23+
};
24+
25+
&uart0 {
26+
status = "okay";
27+
current-speed = <115200>;
28+
clock-frequency = <500000000>;
29+
};
30+
31+
&spi0 {
32+
status = "okay";
33+
clock-frequency = <500000000>;
34+
35+
reg = <0x10040000 0x1000 0x20000000 0x2000000>;
36+
flash0: flash@0 {
37+
compatible = "issi,is25wp256d", "jedec,spi-nor";
38+
size = <33554432>;
39+
label = "FLASH0";
40+
jedec-id = [96 60 18];
41+
reg = <0>;
42+
spi-max-frequency = <133000000>;
43+
};
44+
};
45+
46+
&spi1 {
47+
status = "okay";
48+
clock-frequency = <500000000>;
49+
};
50+
51+
&spi2 {
52+
status = "okay";
53+
clock-frequency = <500000000>;
54+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
identifier: hifive_unleashed
2+
name: SiFive HiFive Unleashed
3+
type: mcu
4+
arch: riscv64
5+
toolchain:
6+
- zephyr
7+
ram: 3840
8+
testing:
9+
ignore_tags:
10+
- net
11+
- bluetooth
12+
supported:
13+
- spi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CONFIG_SOC_SERIES_RISCV_SIFIVE_FREEDOM=y
2+
CONFIG_SOC_RISCV_SIFIVE_FU540=y
3+
CONFIG_BOARD_HIFIVE_UNLEASHED=y
4+
CONFIG_RISCV_MACHINE_TIMER=y
5+
CONFIG_PLIC=y
6+
CONFIG_CONSOLE=y
7+
CONFIG_PRINTK=y
8+
CONFIG_SPI=y
9+
CONFIG_SPI_SIFIVE=y
10+
CONFIG_SERIAL=y
11+
CONFIG_UART_SIFIVE=y
12+
CONFIG_UART_SIFIVE_PORT_0=y
13+
CONFIG_UART_CONSOLE=y
14+
CONFIG_BOOT_BANNER=y
15+
CONFIG_XIP=n
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
adapter speed 10000
2+
3+
adapter driver ftdi
4+
ftdi_device_desc "Dual RS232-HS"
5+
ftdi_vid_pid 0x0403 0x6010
6+
7+
ftdi_layout_init 0x0008 0x001b
8+
ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020
9+
10+
set _CHIPNAME riscv
11+
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913
12+
13+
set _TARGETNAME $_CHIPNAME.cpu
14+
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME -rtos hwthread
15+
target create $_TARGETNAME.1 riscv -chain-position $_TARGETNAME -coreid 1
16+
target create $_TARGETNAME.2 riscv -chain-position $_TARGETNAME -coreid 2
17+
target create $_TARGETNAME.3 riscv -chain-position $_TARGETNAME -coreid 3
18+
target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4
19+
target smp $_TARGETNAME.0 $_TARGETNAME.1 $_TARGETNAME.2 $_TARGETNAME.3 $_TARGETNAME.4
20+
$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
21+
22+
flash bank onboard_spi_flash0 fespi 0x20000000 0 0 0 $_TARGETNAME.0 0x10040000

0 commit comments

Comments
 (0)