Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwmv2: Added Board Support for Starfive VisionFive2 RISC-V Single Board Computer #69814

Merged
merged 4 commits into from Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -40,6 +40,7 @@
/soc/riscv/riscv-privileged/andes_v5/ @cwshu @kevinwang821020 @jimmyzhe
/soc/riscv/riscv-privileged/neorv32/ @henrikbrixandersen
/soc/riscv/riscv-privileged/gd32vf103/ @soburi
/soc/starfive/jh71xx/ @pfarwsi
/soc/riscv/riscv-privileged/niosv/ @sweeaun
/boards/arm/96b_argonkey/ @avisconti
/boards/arm/96b_avenger96/ @Mani-Sadhasivam
Expand Down Expand Up @@ -118,6 +119,7 @@
/boards/riscv/niosv*/ @sweeaun
/boards/riscv/sparkfun_red_v_things_plus/ @soburi
/boards/riscv/stamp_c3/ @soburi
/boards/starfive/visionfive2/ @kanakshilledar @pfarwsi
/boards/shields/atmel_rf2xx/ @nandojve
/boards/shields/esp_8266/ @nandojve
/boards/shields/inventek_eswifi/ @nandojve
Expand Down Expand Up @@ -437,7 +439,7 @@
/dts/riscv/microchip/microchip-miv.dtsi @galak
/dts/riscv/openisa/rv32m1* @dleach02
/dts/riscv/riscv32-litex-vexriscv.dtsi @mateusz-holenko @kgugala @pgielda
/dts/riscv/starfive/ @rajnesh-kanwal
/dts/riscv/starfive/ @rajnesh-kanwal @pfarwsi
/dts/riscv/andes/andes_v5* @cwshu @kevinwang821020 @jimmyzhe
/dts/riscv/niosv/ @sweeaun
/dts/arm/armv*m.dtsi @galak @ioannisg
Expand Down
2 changes: 2 additions & 0 deletions MAINTAINERS.yml
Expand Up @@ -2864,12 +2864,14 @@ RISCV arch:
- boards/qemu/riscv*/
- boards/sifive/
- boards/sparkfun/red_v_things_plus/
- boards/starfive/
pfarwsi marked this conversation as resolved.
Show resolved Hide resolved
- dts/bindings/riscv/
- dts/riscv/
- include/zephyr/arch/riscv/
- soc/common/riscv-privileged/
- soc/sifive/
- soc/riscv/
- soc/starfive/
- tests/arch/riscv/
- doc/hardware/arch/risc-v.rst
- drivers/interrupt_controller/intc_plic.c
Expand Down
10 changes: 10 additions & 0 deletions boards/starfive/index.rst
@@ -0,0 +1,10 @@
.. _boards-starfive:

StarFive
########

.. toctree::
:maxdepth: 1
:glob:

**/*
12 changes: 12 additions & 0 deletions boards/starfive/visionfive2/Kconfig.defconfig
@@ -0,0 +1,12 @@
# Copyright (c) 2024 Kanak Shilledar <kanakshilledar111@protonmail.com>
# SPDX-License-Identifier: Apache-2.0

if BOARD_VISIONFIVE2_JH7110

config SYS_CLOCK_TICKS_PER_SEC
default 1000

config SYS_CLOCK_HW_CYCLES_PER_SEC
default 1000000

endif # BOARD_VISIONFIVE2_JH7110
5 changes: 5 additions & 0 deletions boards/starfive/visionfive2/Kconfig.visionfive2
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Kanak Shilledar <kanakshilledar111@protonmail.com>
# SPDX-License-Identifier: Apache-2.0

config BOARD_VISIONFIVE2_JH7110
select SOC_JH7110
8 changes: 8 additions & 0 deletions boards/starfive/visionfive2/board.yml
@@ -0,0 +1,8 @@
# Copyright (c) 2024 Kanak Shilledar <kanakshilledar111@protonmail.com>
# SPDX-License-Identifier: Apache-2.0

board:
name: visionfive2
vendor: starfive
socs:
- name: jh7110
Binary file not shown.
78 changes: 78 additions & 0 deletions boards/starfive/visionfive2/doc/index.rst
@@ -0,0 +1,78 @@
.. _visionfive2:

Starfive VisionFive 2 JH7110
############################

Overview
********

The StarFive VisionFive 2 is a development board with a StarFive JH7110
multi-core 64bit RISC-V SoC.

.. image:: img/visionfive2.webp
:align: center
:alt: StarFive VisionFive 2 Board

Programming and debugging
*************************

Building
========

Applications for the ``visionfive2`` board configuration can be built
as usual (see :ref:`build_an_application`) using the corresponding board name:

.. zephyr-app-commands::
:board: visionfive2
:goals: build

`spl_tool <https://github.com/starfive-tech/Tools/tree/master/spl_tool/>`_
is a jh7110 signature tool used to generate spl header information
and generate ``zephyr.bin.normal.out``.

.. code-block:: console

./spl_tool -c -f build/zephyr/zephyr.bin
pfarwsi marked this conversation as resolved.
Show resolved Hide resolved

This will create a new file ``build/zephyr/zephyr.bin.normal.out`` that can be flashed.
This step is necessary as zephyr binary must contain the SPL header info in order
to run it in M-Mode (Machine Mode) since S-Mode (Supervisor Mode) is
currently not supported.

Flashing
========

.. note::
The following steps use minicom for serial communication, feel free to use
any other serial terminal that supports xmodem based file transfers.
Thanks to @orangecms for his vf2-loader tool which makes the flashing process easier

git clone the vf2-loader tool from https://github.com/orangecms/vf2-loader.git and
xmodem tool from https://github.com/orangecms/xmodem.rs.git side by side.

VisionFive2 uses uart for flashing. Refer to
`VisionFive2 Recovery Quick Start Guide
<https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/recovering_bootloader%20-%20vf2.html>`_
to connect your serial-to-usb converter. Now power on the board and using
minicom access board's serial and press the reset switch on the board until you see CCCCCC... prompt

Copy the ``zephyr.bin.normal.out`` from ``build/zephyr/zephyr.bin.normal.out``
to previously git cloned vf2-loader/ directory and cd into it.
Flash the ``zephyr.bin.normal.out`` using this command:

.. code-block:: console

cargo run -- zephyr.bin.normal.out && minicom -D /dev/ttyUSB0

.. code-block:: text

cargo run -- zephyr.bin.normal.out && minicom -D /dev/ttyUSB0
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/vf2-loader zephyr.bin.normal.out`
Welcome to minicom 2.7.1
OPTIONS: I18n
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyUSB0, 14:59:24
Press CTRL-A Z for help on special keys
6*** Booting Zephyr OS build v3.6.0-rc3 ***
Hello World! visionfive2
30 changes: 30 additions & 0 deletions boards/starfive/visionfive2/visionfive2.dts
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024 Kanak Shilledar <kanakshilledar111@protonmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include "starfive/jh7110-visionfive-v2.dtsi"

/ {
model = "StarFive VisionFive V2";
compatible = "starfive,visionfive-v2";

chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,sram = &ram0;
};
};

&uart0 {
status = "okay";
current-speed = <115200>;
};

&uart1 {
status = "okay";
current-speed = <115200>;
};
9 changes: 9 additions & 0 deletions boards/starfive/visionfive2/visionfive2.yaml
@@ -0,0 +1,9 @@
identifier: visionfive2
name: Visionfive JH7110 (NON-SMP)
type: mcu
arch: riscv64
toolchain:
- zephyr
- cross-compile
supported:
- uart
10 changes: 10 additions & 0 deletions boards/starfive/visionfive2/visionfive2_defconfig
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: Apache-2.0

# Zephyr Kernel Configuration
CONFIG_PRINTK=y
CONFIG_XIP=n

# Serial Drivers
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
20 changes: 20 additions & 0 deletions dts/riscv/starfive/jh7110-clk.dtsi
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 Pratik Farkase <pratik.farkase@wsisweden.com>
* Copyright (c) 2024 Sigma Connectivity WSI AB
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
apb2clk: apb2clk {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <125000000>;
};

uartclk: uartclk {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <100000000>;
};
};