diff mbox series

[v2,1/1] configs: defconfig for Sipeed Maix in S-mode

Message ID 20200817103539.2995-1-xypron.glpk@gmx.de
State Accepted
Commit 27cef4e4a3ba791078534fda1dbeb814bd530ad5
Delegated to: Andes
Headers show
Series [v2,1/1] configs: defconfig for Sipeed Maix in S-mode | expand

Commit Message

Heinrich Schuchardt Aug. 17, 2020, 10:35 a.m. UTC
Provide a defconfig that can be used to build U-Boot for the Maix boards
running upon OpenSBI.

Update the documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	adjust MAINTAINERS
---
 board/sipeed/maix/MAINTAINERS       |  2 +-
 configs/sipeed_maix_smode_defconfig | 10 ++++++
 doc/board/sipeed/maix.rst           | 49 +++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 configs/sipeed_maix_smode_defconfig

--
2.28.0

Comments

Bin Meng Aug. 18, 2020, 8:59 a.m. UTC | #1
On Mon, Aug 17, 2020 at 6:35 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Provide a defconfig that can be used to build U-Boot for the Maix boards
> running upon OpenSBI.
>
> Update the documentation.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
>         adjust MAINTAINERS
> ---
>  board/sipeed/maix/MAINTAINERS       |  2 +-
>  configs/sipeed_maix_smode_defconfig | 10 ++++++
>  doc/board/sipeed/maix.rst           | 49 +++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+), 1 deletion(-)
>  create mode 100644 configs/sipeed_maix_smode_defconfig
>

Reviewed-by: Bin Meng <bin.meng@windriver.com>
Sean Anderson Aug. 19, 2020, 11:03 a.m. UTC | #2
On 8/17/20 6:35 AM, Heinrich Schuchardt wrote:
> Provide a defconfig that can be used to build U-Boot for the Maix boards
> running upon OpenSBI.
> 
> Update the documentation.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> 	adjust MAINTAINERS
> ---
>  board/sipeed/maix/MAINTAINERS       |  2 +-
>  configs/sipeed_maix_smode_defconfig | 10 ++++++
>  doc/board/sipeed/maix.rst           | 49 +++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+), 1 deletion(-)
>  create mode 100644 configs/sipeed_maix_smode_defconfig
> 
> diff --git a/board/sipeed/maix/MAINTAINERS b/board/sipeed/maix/MAINTAINERS
> index e7bb9ec433..969a0afbad 100644
> --- a/board/sipeed/maix/MAINTAINERS
> +++ b/board/sipeed/maix/MAINTAINERS
> @@ -4,7 +4,7 @@ S:	Maintained
>  F:	arch/riscv/dts/k210.dtsi
>  F:	arch/riscv/dts/k210-maix-bit.dts
>  F:	board/sipeed/maix/
> -F:	configs/sipeed_maix_bitm_defconfig
> +F:	configs/sipeed_maix*_defconfig
>  F:	doc/board/sipeed/
>  F:	include/configs/sipeed-maix.h
>  F:	include/dt-bindings/*/k210-sysctl.h
> diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig
> new file mode 100644
> index 0000000000..2516bb7258
> --- /dev/null
> +++ b/configs/sipeed_maix_smode_defconfig
> @@ -0,0 +1,10 @@
> +CONFIG_RISCV=y
> +CONFIG_SYS_TEXT_BASE=0x80020000
> +CONFIG_TARGET_SIPEED_MAIX=y
> +CONFIG_ARCH_RV64I=y
> +CONFIG_RISCV_SMODE=y
> +CONFIG_STACK_SIZE=0x100000
> +# CONFIG_NET is not set
> +# CONFIG_INPUT is not set
> +# CONFIG_DM_ETH is not set
> +# CONFIG_EFI_UNICODE_CAPITALIZATION is not set
> diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst
> index b1894f3a6f..efcde9aebf 100644
> --- a/doc/board/sipeed/maix.rst
> +++ b/doc/board/sipeed/maix.rst
> @@ -75,6 +75,49 @@ console shall be opened immediately. Boot output should look like the following:
>      Err:   serial@38000000
>      =>
> 
> +OpenSBI
> +^^^^^^^
> +
> +OpenSBI is an open source supervisor execution environment implementing the
> +RISC-V Supervisor Binary Interface Specification [1]. One of its features is
> +to intercept run-time exceptions, e.g. for unaligned access or illegal
> +instructions, and to emulate the failing instructions.
> +
> +The OpenSBI source can be downloaded via:
> +
> +.. code-block:: bash
> +
> +    git clone https://github.com/riscv/opensbi
> +
> +As OpenSBI will be loaded at 0x80000000 we have to adjust the U-Boot text base.
> +Furthermore we have to enable building U-Boot for S-mode::
> +
> +    CONFIG_SYS_TEXT_BASE=0x80020000
> +    CONFIG_RISCV_SMODE=y
> +
> +Both settings are contained in sipeed_maix_smode_defconfig so we can build
> +U-Boot with:
> +
> +.. code-block:: bash
> +
> +    make sipeed_maix_smode_defconfig
> +    make
> +
> +To build OpenSBI with U-Boot as a payload:
> +
> +.. code-block:: bash
> +
> +    cd opensbi
> +    make \
> +    PLATFORM=kendryte/k210 \
> +    FW_PAYLOAD=y \
> +    FW_PAYLOAD_OFFSET=0x20000 \
> +    FW_PAYLOAD_PATH=<path to U-Boot>/u-boot-dtb.bin
> +
> +The value of FW_PAYLOAD_OFFSET must match CONFIG_SYS_TEXT_BASE - 0x80000000.
> +
> +The file to flash is build/platform/kendryte/k210/firmware/fw_payload.bin.
> +
>  Loading Images
>  ^^^^^^^^^^^^^^
> 
> @@ -363,3 +406,9 @@ Address    Size      Description
>                       interrupts)
>  0x8801f000 0x1000    credits
>  ========== ========= ===========
> +
> +Links
> +-----
> +
> +[1] https://github.com/riscv/riscv-sbi-doc
> +    RISC-V Supervisor Binary Interface Specification
> --
> 2.28.0
> 

Reviewed-by: Sean Anderson <seanga2@gmail.com>
diff mbox series

Patch

diff --git a/board/sipeed/maix/MAINTAINERS b/board/sipeed/maix/MAINTAINERS
index e7bb9ec433..969a0afbad 100644
--- a/board/sipeed/maix/MAINTAINERS
+++ b/board/sipeed/maix/MAINTAINERS
@@ -4,7 +4,7 @@  S:	Maintained
 F:	arch/riscv/dts/k210.dtsi
 F:	arch/riscv/dts/k210-maix-bit.dts
 F:	board/sipeed/maix/
-F:	configs/sipeed_maix_bitm_defconfig
+F:	configs/sipeed_maix*_defconfig
 F:	doc/board/sipeed/
 F:	include/configs/sipeed-maix.h
 F:	include/dt-bindings/*/k210-sysctl.h
diff --git a/configs/sipeed_maix_smode_defconfig b/configs/sipeed_maix_smode_defconfig
new file mode 100644
index 0000000000..2516bb7258
--- /dev/null
+++ b/configs/sipeed_maix_smode_defconfig
@@ -0,0 +1,10 @@ 
+CONFIG_RISCV=y
+CONFIG_SYS_TEXT_BASE=0x80020000
+CONFIG_TARGET_SIPEED_MAIX=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_STACK_SIZE=0x100000
+# CONFIG_NET is not set
+# CONFIG_INPUT is not set
+# CONFIG_DM_ETH is not set
+# CONFIG_EFI_UNICODE_CAPITALIZATION is not set
diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst
index b1894f3a6f..efcde9aebf 100644
--- a/doc/board/sipeed/maix.rst
+++ b/doc/board/sipeed/maix.rst
@@ -75,6 +75,49 @@  console shall be opened immediately. Boot output should look like the following:
     Err:   serial@38000000
     =>

+OpenSBI
+^^^^^^^
+
+OpenSBI is an open source supervisor execution environment implementing the
+RISC-V Supervisor Binary Interface Specification [1]. One of its features is
+to intercept run-time exceptions, e.g. for unaligned access or illegal
+instructions, and to emulate the failing instructions.
+
+The OpenSBI source can be downloaded via:
+
+.. code-block:: bash
+
+    git clone https://github.com/riscv/opensbi
+
+As OpenSBI will be loaded at 0x80000000 we have to adjust the U-Boot text base.
+Furthermore we have to enable building U-Boot for S-mode::
+
+    CONFIG_SYS_TEXT_BASE=0x80020000
+    CONFIG_RISCV_SMODE=y
+
+Both settings are contained in sipeed_maix_smode_defconfig so we can build
+U-Boot with:
+
+.. code-block:: bash
+
+    make sipeed_maix_smode_defconfig
+    make
+
+To build OpenSBI with U-Boot as a payload:
+
+.. code-block:: bash
+
+    cd opensbi
+    make \
+    PLATFORM=kendryte/k210 \
+    FW_PAYLOAD=y \
+    FW_PAYLOAD_OFFSET=0x20000 \
+    FW_PAYLOAD_PATH=<path to U-Boot>/u-boot-dtb.bin
+
+The value of FW_PAYLOAD_OFFSET must match CONFIG_SYS_TEXT_BASE - 0x80000000.
+
+The file to flash is build/platform/kendryte/k210/firmware/fw_payload.bin.
+
 Loading Images
 ^^^^^^^^^^^^^^

@@ -363,3 +406,9 @@  Address    Size      Description
                      interrupts)
 0x8801f000 0x1000    credits
 ========== ========= ===========
+
+Links
+-----
+
+[1] https://github.com/riscv/riscv-sbi-doc
+    RISC-V Supervisor Binary Interface Specification