public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kautuk Consul <kconsul@ventanamicro.com>
To: "Rick Chen" <rick@andestech.com>, Leo <ycliang@andestech.com>,
	"Sean Anderson" <sean.anderson@seco.com>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Anup Patel" <apatel@ventanamicro.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Simon Glass" <sjg@chromium.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Alexandru Gagniuc" <mr.nuke.me@gmail.com>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Rasmus Villemoes" <rasmus.villemoes@prevas.dk>,
	"Eugen Hristev" <eugen.hristev@microchip.com>,
	"Stefan Roese" <sr@denx.de>, "Pali Rohár" <pali@kernel.org>,
	"Qu Wenruo" <wqu@suse.com>,
	"Loic Poulain" <loic.poulain@linaro.org>,
	"Patrick Delaunay" <patrick.delaunay@foss.st.com>
Cc: u-boot@lists.denx.de, Kautuk Consul <kconsul@ventanamicro.com>
Subject: [PATCH v2 0/3] Add riscv semihosting support in u-boot
Date: Fri, 16 Sep 2022 13:42:30 +0530	[thread overview]
Message-ID: <20220916081233.1970135-1-kconsul@ventanamicro.com> (raw)

Semihosting is a mechanism that enables code running on
a target to communicate and use the Input/Output
facilities on a host computer that is running a debugger.
This patchset adds support for semihosting in u-boot
for RISCV64 targets.

CHANGES since v1:
-   Moved the identical smh_* and semihosting_enabled/disable_semihosting
	code of ARM and RISC-V to lib/semihosting.c
-	Extend the handle_trap() functionality to call disable_semihosting()
	if the cause is a breakpoint (i.e. ebreak instruction)
-	Change our implementation of semihosting_enabled to be exactly the
	same as the way ARM implemented it
-	Additionally enable the CONFIG_SPL_FS_EXT4 and CONFIG_SPL_FS_FAT
	configs for qemu defconfigs so that CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
	gets automatically enabled instead of us #defining it in
	include/configs/qemu-riscv.h

Compilation and test commands for SPL and S-mode configurations
=================================================================

U-Boot S-mode on QEMU virt
----------------------------
// Compilation of S-mode u-boot
ARCH=riscv
CROSS_COMPILE=riscv64-unknown-linux-gnu-
make qemu-riscv64_smode_defconfig
make
// Run riscv 64-bit u-boot with opensbi on qemu
qemu-system-riscv64 -M virt -m 256M -display none -serial stdio -bios\
opensbi/build/platform/generic/firmware/fw_jump.bin -kernel\
u-boot/u-boot.bin

U-Boot SPL on QEMU virt
------------------------
// Compilation of u-boot-spl
ARCH=riscv
CROSS_COMPILE=riscv64-unknown-linux-gnu-
make qemu-riscv64_spl_defconfig
make OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin
// Run 64-bit u-boot-spl in qemu
qemu-system-riscv64 -M virt -m 256M -display none -serial stdio -bios\
u-boot/spl/u-boot-spl.bin -device\
loader,file=u-boot/u-boot.itb,addr=0x80200000

Kautuk Consul (3):
  lib: Add common semihosting library
  arch/riscv: add semihosting support for RISC-V
  board: qemu-riscv: enable semihosting

 arch/arm/Kconfig                     |   2 +
 arch/arm/lib/semihosting.c           | 179 +-------------------------
 arch/riscv/Kconfig                   |  47 +++++++
 arch/riscv/include/asm/semihosting.h |  11 ++
 arch/riscv/include/asm/spl.h         |   1 +
 arch/riscv/lib/Makefile              |   2 +
 arch/riscv/lib/interrupts.c          |  11 ++
 arch/riscv/lib/semihosting.c         |  24 ++++
 configs/qemu-riscv32_defconfig       |   4 +
 configs/qemu-riscv32_smode_defconfig |   4 +
 configs/qemu-riscv32_spl_defconfig   |   7 +
 configs/qemu-riscv64_defconfig       |   4 +
 configs/qemu-riscv64_smode_defconfig |   4 +
 configs/qemu-riscv64_spl_defconfig   |   7 +
 include/semihosting.h                |  11 ++
 lib/Kconfig                          |   3 +
 lib/Makefile                         |   2 +
 lib/semihosting.c                    | 186 +++++++++++++++++++++++++++
 18 files changed, 331 insertions(+), 178 deletions(-)
 create mode 100644 arch/riscv/include/asm/semihosting.h
 create mode 100644 arch/riscv/lib/semihosting.c
 create mode 100644 lib/semihosting.c

-- 
2.34.1


             reply	other threads:[~2022-09-16 12:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  8:12 Kautuk Consul [this message]
2022-09-16  8:12 ` [PATCH v2 1/3] lib: Add common semihosting library Kautuk Consul
2022-09-17 17:39   ` Sean Anderson
2022-09-19 11:14     ` Kautuk Consul
2022-09-16  8:12 ` [PATCH v2 2/3] arch/riscv: add semihosting support for RISC-V Kautuk Consul
2022-09-16  8:12 ` [PATCH v2 3/3] board: qemu-riscv: enable semihosting Kautuk Consul
2022-09-16  9:08 ` [PATCH v2 0/3] Add riscv semihosting support in u-boot Pali Rohár
2022-09-16  9:10   ` Kautuk Consul
2022-09-16  9:12     ` Pali Rohár
2022-09-16 13:11       ` Sean Anderson
2022-09-16 14:32         ` Tom Rini
2022-09-17 17:24           ` Sean Anderson
  -- strict thread matches above, loose matches on Subject: below --
2022-09-16  8:19 Kautuk Consul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220916081233.1970135-1-kconsul@ventanamicro.com \
    --to=kconsul@ventanamicro.com \
    --cc=apatel@ventanamicro.com \
    --cc=bmeng.cn@gmail.com \
    --cc=eugen.hristev@microchip.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=loic.poulain@linaro.org \
    --cc=mr.nuke.me@gmail.com \
    --cc=pali@kernel.org \
    --cc=patrick.delaunay@foss.st.com \
    --cc=philippe.reynes@softathome.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=rick@andestech.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=wqu@suse.com \
    --cc=xypron.glpk@gmx.de \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox