* [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package
@ 2022-01-09 16:47 Julien Olivain
2022-01-09 16:47 ` [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig Julien Olivain
2022-01-11 22:08 ` [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Julien Olivain @ 2022-01-09 16:47 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Thomas Petazzoni
Spike, the RISC-V ISA Simulator, implements a functional model of one
or more RISC-V harts.
The host package provides an alternative solution to qemu.
https://github.com/riscv-software-src/riscv-isa-sim
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
DEVELOPERS | 1 +
package/Config.in | 1 +
package/Config.in.host | 1 +
| 34 +++++++++++++++++++
package/riscv-isa-sim/Config.in | 18 ++++++++++
package/riscv-isa-sim/Config.in.host | 13 +++++++
package/riscv-isa-sim/riscv-isa-sim.hash | 3 ++
package/riscv-isa-sim/riscv-isa-sim.mk | 13 +++++++
8 files changed, 84 insertions(+)
create mode 100644 package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch
create mode 100644 package/riscv-isa-sim/Config.in
create mode 100644 package/riscv-isa-sim/Config.in.host
create mode 100644 package/riscv-isa-sim/riscv-isa-sim.hash
create mode 100644 package/riscv-isa-sim/riscv-isa-sim.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index ed65c74319..59a8dba2ab 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1588,6 +1588,7 @@ F: package/fluidsynth/
F: package/glslsandbox-player/
F: package/ptm2human/
F: package/python-pyalsa/
+F: package/riscv-isa-sim/
N: Julien Viard de Galbert <julien@vdg.name>
F: package/dieharder/
diff --git a/package/Config.in b/package/Config.in
index 85193f7802..b20cf45698 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2126,6 +2126,7 @@ menu "Miscellaneous"
source "package/proj/Config.in"
source "package/qemu/Config.in"
source "package/qpdf/Config.in"
+ source "package/riscv-isa-sim/Config.in"
source "package/rtl_433/Config.in"
source "package/shared-mime-info/Config.in"
source "package/sunwait/Config.in"
diff --git a/package/Config.in.host b/package/Config.in.host
index b3e00bb482..22aafb858a 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -77,6 +77,7 @@ menu "Host utilities"
source "package/qoriq-rcw/Config.in.host"
source "package/raspberrypi-usbboot/Config.in.host"
source "package/rauc/Config.in.host"
+ source "package/riscv-isa-sim/Config.in.host"
source "package/rustc/Config.in.host"
source "package/s6-rc/Config.in.host"
source "package/sam-ba/Config.in.host"
--git a/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch b/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch
new file mode 100644
index 0000000000..461f34e3a1
--- /dev/null
+++ b/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch
@@ -0,0 +1,34 @@
+From 980d5143089bf32ef8a6dfdf1bb9e9fe92fa7bf5 Mon Sep 17 00:00:00 2001
+From: Julien Olivain <ju.o@free.fr>
+Date: Sun, 9 Jan 2022 13:38:48 +0100
+Subject: [PATCH] riscv: disable precompiled headers
+
+While precompiling header, some toolchains fail with the message:
+
+ /path/to/toolchain/bin/ld: /path/to/sysroot/usr/lib/Scrt1.o: in function `_start':
+ (.text+0x54): undefined reference to `main'
+
+The patch totally disable precompiled headers.
+
+Signed-off-by: Julien Olivain <ju.o@free.fr>
+---
+ riscv/riscv.mk.in | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in
+index 2347ce6..4f56eaf 100644
+--- a/riscv/riscv.mk.in
++++ b/riscv/riscv.mk.in
+@@ -35,9 +35,6 @@ riscv_hdrs = \
+
+ riscv_install_hdrs = mmio_plugin.h
+
+-riscv_precompiled_hdrs = \
+- insn_template.h \
+-
+ riscv_srcs = \
+ processor.cc \
+ execute.cc \
+--
+2.34.1
+
diff --git a/package/riscv-isa-sim/Config.in b/package/riscv-isa-sim/Config.in
new file mode 100644
index 0000000000..1f5c8aad18
--- /dev/null
+++ b/package/riscv-isa-sim/Config.in
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_RISCV_ISA_SIM
+ bool "riscv-isa-sim"
+ depends on BR2_INSTALL_LIBSTDCPP
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on !BR2_STATIC_LIBS
+ help
+ Spike, the RISC-V ISA Simulator, implements a functional
+ model of one or more RISC-V harts.
+
+ https://github.com/riscv-software-src/riscv-isa-sim
+
+comment "riscv-isa-sim needs a toolchain w/ C++11, threads, wchar and dynamic library"
+ depends on !BR2_INSTALL_LIBSTDCPP || \
+ !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+ !BR2_TOOLCHAIN_HAS_THREADS || \
+ !BR2_USE_WCHAR || \
+ BR2_STATIC
diff --git a/package/riscv-isa-sim/Config.in.host b/package/riscv-isa-sim/Config.in.host
new file mode 100644
index 0000000000..01a189a075
--- /dev/null
+++ b/package/riscv-isa-sim/Config.in.host
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_HOST_RISCV_ISA_SIM
+ bool "host riscv-isa-sim"
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++11
+ help
+ Spike, the RISC-V ISA Simulator, implements a functional
+ model of one or more RISC-V harts.
+
+ The host package provides an alternative solution to qemu.
+
+ https://github.com/riscv-software-src/riscv-isa-sim
+
+comment "host riscv-isa-sim needs a toolchain w/ C++11"
+ depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
diff --git a/package/riscv-isa-sim/riscv-isa-sim.hash b/package/riscv-isa-sim/riscv-isa-sim.hash
new file mode 100644
index 0000000000..d787a03e4c
--- /dev/null
+++ b/package/riscv-isa-sim/riscv-isa-sim.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256 9b29c220fed1e867e3bea4b5c565f2629237d525a4d9fe1668699c4406003a1f riscv-isa-sim-1.1.0.tar.gz
+sha256 c65e436d18972c9c4bd192494fe4870bd2e158179474975b80a3559f27631632 LICENSE
diff --git a/package/riscv-isa-sim/riscv-isa-sim.mk b/package/riscv-isa-sim/riscv-isa-sim.mk
new file mode 100644
index 0000000000..df5d4db9a2
--- /dev/null
+++ b/package/riscv-isa-sim/riscv-isa-sim.mk
@@ -0,0 +1,13 @@
+################################################################################
+#
+# riscv-isa-sim
+#
+################################################################################
+
+RISCV_ISA_SIM_VERSION = 1.1.0
+RISCV_ISA_SIM_SITE = $(call github,riscv-software-src,riscv-isa-sim,v$(RISCV_ISA_SIM_VERSION))
+RISCV_ISA_SIM_LICENSE = BSD-3-Clause
+RISCV_ISA_SIM_LICENSE_FILES = LICENSE
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig
2022-01-09 16:47 [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Julien Olivain
@ 2022-01-09 16:47 ` Julien Olivain
2022-01-11 22:08 ` Thomas Petazzoni
2022-01-11 22:08 ` [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Julien Olivain @ 2022-01-09 16:47 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Thomas Petazzoni
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
DEVELOPERS | 2 ++
board/spike/riscv64/readme.txt | 39 +++++++++++++++++++++++++++++++++
board/spike/riscv64/start.sh | 13 +++++++++++
configs/spike_riscv64_defconfig | 12 ++++++++++
4 files changed, 66 insertions(+)
create mode 100644 board/spike/riscv64/readme.txt
create mode 100755 board/spike/riscv64/start.sh
create mode 100644 configs/spike_riscv64_defconfig
diff --git a/DEVELOPERS b/DEVELOPERS
index 59a8dba2ab..bf495be538 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1578,10 +1578,12 @@ F: package/paho-mqtt-c
N: Julien Olivain <ju.o@free.fr>
F: board/qmtech/zynq/
+F: board/spike/
F: board/technexion/imx8mmpico/
F: board/technexion/imx8mpico/
F: configs/imx8mmpico_defconfig
F: configs/imx8mpico_defconfig
+F: configs/spike_riscv64_defconfig
F: configs/zynq_qmtech_defconfig
F: package/fluid-soundfont/
F: package/fluidsynth/
diff --git a/board/spike/riscv64/readme.txt b/board/spike/riscv64/readme.txt
new file mode 100644
index 0000000000..5ad7df46df
--- /dev/null
+++ b/board/spike/riscv64/readme.txt
@@ -0,0 +1,39 @@
+Linux on Spike RISC-V ISA simulator
+===================================
+
+This configuration provides a minimal working setup to run a Linux
+kernel in the Spike RISC-V ISA simulator.
+
+The Spike ISA simulator can be an interresting alternative to Qemu, in
+some specific cases. For example: simulating new instructions (see [1]),
+simulating riscv-openocd/gdb debug sessions (see [2], [3]), or
+generating an accurate per-instruction log of execution (see
+riscv-isa-sim spike -l option)...
+
+To run Buildroot Linux in Spike, use the commands:
+
+ make spike_riscv64_defconfig
+ make
+ ./board/spike/riscv64/start.sh
+
+The boot is made with the standard RISC-V OpenSBI boot loader. In
+order to keep the simulation simple, the rootfs is passed as an initrd
+ramfs.
+
+Note: at the time of this writing, Spike v1.1.0 and OpenSBI v1.0 does
+not support console input emulation for 32bit RISC-V systems. A 32bit
+Linux system can boot and reach the login, but it's not possible to
+login. See [4].
+
+
+[1].
+https://github.com/riscv-software-src/riscv-isa-sim/tree/v1.1.0#simulating-a-new-instruction
+
+[2].
+https://github.com/riscv-software-src/riscv-isa-sim/tree/v1.1.0#debugging-with-gdb
+
+[3].
+https://github.com/riscv/riscv-openocd
+
+[4].
+https://github.com/riscv-software-src/opensbi/blob/v1.0/lib/utils/sys/htif.c#L127
diff --git a/board/spike/riscv64/start.sh b/board/spike/riscv64/start.sh
new file mode 100755
index 0000000000..75b1412df8
--- /dev/null
+++ b/board/spike/riscv64/start.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+SCRIPT_DIR="$(dirname "$0")"
+BR_BASEDIR="$(readlink -e "${SCRIPT_DIR}/../../..")"
+
+# Use Buildroot host spike by default, but allow the caller to
+# redefine another spike binary
+: "${SPIKE:=${BR_BASEDIR}/output/host/usr/bin/spike}"
+
+exec "${SPIKE}" \
+ --initrd "${BR_BASEDIR}"/output/images/rootfs.cpio \
+ "${@}" \
+ "${BR_BASEDIR}"/output/images/fw_payload.elf
diff --git a/configs/spike_riscv64_defconfig b/configs/spike_riscv64_defconfig
new file mode 100644
index 0000000000..4cce20b360
--- /dev/null
+++ b/configs/spike_riscv64_defconfig
@@ -0,0 +1,12 @@
+BR2_riscv=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.13"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
+BR2_TARGET_ROOTFS_CPIO=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_PLAT="generic"
+BR2_TARGET_OPENSBI_LINUX_PAYLOAD=y
+BR2_PACKAGE_HOST_RISCV_ISA_SIM=y
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package
2022-01-09 16:47 [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Julien Olivain
2022-01-09 16:47 ` [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig Julien Olivain
@ 2022-01-11 22:08 ` Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2022-01-11 22:08 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Sun, 9 Jan 2022 17:47:55 +0100
Julien Olivain <ju.o@free.fr> wrote:
> Spike, the RISC-V ISA Simulator, implements a functional model of one
> or more RISC-V harts.
>
> The host package provides an alternative solution to qemu.
>
> https://github.com/riscv-software-src/riscv-isa-sim
>
> Signed-off-by: Julien Olivain <ju.o@free.fr>
Thanks for your patch!
> diff --git a/package/Config.in b/package/Config.in
> index 85193f7802..b20cf45698 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -2126,6 +2126,7 @@ menu "Miscellaneous"
> source "package/proj/Config.in"
> source "package/qemu/Config.in"
> source "package/qpdf/Config.in"
> + source "package/riscv-isa-sim/Config.in"
> source "package/rtl_433/Config.in"
> source "package/shared-mime-info/Config.in"
> source "package/sunwait/Config.in"
It wasn't clear to me what was the use-case/reasoning for having a
target variant of this package, so I've dropped the target variant and
kept only the host variant.
> diff --git a/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch b/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch
> new file mode 100644
> index 0000000000..461f34e3a1
> --- /dev/null
> +++ b/package/riscv-isa-sim/0001-riscv-disable-precompiled-headers.patch
> @@ -0,0 +1,34 @@
> +From 980d5143089bf32ef8a6dfdf1bb9e9fe92fa7bf5 Mon Sep 17 00:00:00 2001
> +From: Julien Olivain <ju.o@free.fr>
> +Date: Sun, 9 Jan 2022 13:38:48 +0100
> +Subject: [PATCH] riscv: disable precompiled headers
> +
> +While precompiling header, some toolchains fail with the message:
> +
> + /path/to/toolchain/bin/ld: /path/to/sysroot/usr/lib/Scrt1.o: in function `_start':
> + (.text+0x54): undefined reference to `main'
Has this been reported upstream? Will it be fixed upstream?
Anyway: patch applied to master, with the target variant dropped.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig
2022-01-09 16:47 ` [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig Julien Olivain
@ 2022-01-11 22:08 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2022-01-11 22:08 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Sun, 9 Jan 2022 17:47:56 +0100
Julien Olivain <ju.o@free.fr> wrote:
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> DEVELOPERS | 2 ++
> board/spike/riscv64/readme.txt | 39 +++++++++++++++++++++++++++++++++
> board/spike/riscv64/start.sh | 13 +++++++++++
> configs/spike_riscv64_defconfig | 12 ++++++++++
> 4 files changed, 66 insertions(+)
> create mode 100644 board/spike/riscv64/readme.txt
> create mode 100755 board/spike/riscv64/start.sh
> create mode 100644 configs/spike_riscv64_defconfig
Applied to master, thanks. I've just added an explicit BR2_RISCV_64=y
in the defconfig to really clarify that this is a RISC-V 64-bit
configuration (even though BR2_RISCV_64=y is indeed the default).
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-11 22:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-09 16:47 [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Julien Olivain
2022-01-09 16:47 ` [Buildroot] [PATCH 2/2] configs/spike_riscv64: new defconfig Julien Olivain
2022-01-11 22:08 ` Thomas Petazzoni
2022-01-11 22:08 ` [Buildroot] [PATCH 1/2] package/riscv-isa-sim: new package Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox