1.. zephyr:board:: visionfive2
2
3Overview
4********
5
6The StarFive VisionFive 2 is a development board with a StarFive JH7110
7multi-core 64bit RISC-V SoC.
8
9Programming and debugging
10*************************
11
12Building
13========
14
15Applications for the ``visionfive2`` board configuration can be built
16as usual (see :ref:`build_an_application`) using the corresponding board name:
17
18.. zephyr-app-commands::
19   :board: visionfive2
20   :goals: build
21
22`spl_tool <https://github.com/starfive-tech/Tools/tree/master/spl_tool/>`_
23is a jh7110 signature tool used to generate spl header information
24and generate ``zephyr.bin.normal.out``.
25
26.. code-block:: console
27
28   ./spl_tool -c -f build/zephyr/zephyr.bin
29
30This will create a new file ``build/zephyr/zephyr.bin.normal.out`` that can be flashed.
31This step is necessary as zephyr binary must contain the SPL header info in order
32to run it in M-Mode (Machine Mode) since S-Mode (Supervisor Mode) is
33currently not supported.
34
35Flashing
36========
37
38.. note::
39   The following steps use minicom for serial communication, feel free to use
40   any other serial terminal that supports xmodem based file transfers.
41   Thanks to @orangecms for his vf2-loader tool which makes the flashing process easier
42
43git clone the vf2-loader tool from https://github.com/orangecms/vf2-loader.git and
44xmodem tool from https://github.com/orangecms/xmodem.rs.git side by side.
45
46VisionFive2 uses uart for flashing. Refer to
47`VisionFive2 Recovery Quick Start Guide
48<https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/recovering_bootloader%20-%20vf2.html>`_
49to connect your serial-to-usb converter. Now power on the board and using
50minicom access board's serial and press the reset switch on the board until you see CCCCCC... prompt
51
52Copy the ``zephyr.bin.normal.out`` from ``build/zephyr/zephyr.bin.normal.out``
53to previously git cloned vf2-loader/ directory and cd into it.
54Flash the ``zephyr.bin.normal.out`` using this command:
55
56.. code-block:: console
57
58   cargo run -- zephyr.bin.normal.out && minicom -D /dev/ttyUSB0
59
60.. code-block:: text
61
62   cargo run -- zephyr.bin.normal.out && minicom -D /dev/ttyUSB0
63   Finished dev [unoptimized + debuginfo] target(s) in 0.03s
64   Running `target/debug/vf2-loader zephyr.bin.normal.out`
65   Welcome to minicom 2.7.1
66   OPTIONS: I18n
67   Compiled on Dec 23 2019, 02:06:26.
68   Port /dev/ttyUSB0, 14:59:24
69   Press CTRL-A Z for help on special keys
70   6*** Booting Zephyr OS build v3.6.0-rc3 ***
71   Hello World! visionfive2
72