[PATCH 2/2] board: qemu-riscv: enable semihosting

Sean Anderson sean.anderson at seco.com
Thu Sep 15 18:05:46 CEST 2022



On 9/15/22 8:45 AM, Kautuk Consul wrote:
> [You don't often get email from kconsul at ventanamicro.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> To use semihosting on qemu RISCV virt machine, we need the
> CONFIG_SPL_FS_LOAD_PAYLOAD_NAME define in qemu-riscv.h.
> 
> We also need to enable the following configs in defconfigs:
> CONFIG_SEMIHOSTING
> CONFIG_SPL_SEMIHOSTING
> CONFIG_SEMIHOSTING_SERIAL
> CONFIG_SERIAL_PROBE_ALL
> 
> Signed-off-by: Kautuk Consul <kconsul at ventanamicro.com>
> ---
>  configs/qemu-riscv32_defconfig       | 4 ++++
>  configs/qemu-riscv32_smode_defconfig | 4 ++++
>  configs/qemu-riscv32_spl_defconfig   | 5 +++++
>  configs/qemu-riscv64_defconfig       | 4 ++++
>  configs/qemu-riscv64_smode_defconfig | 4 ++++
>  configs/qemu-riscv64_spl_defconfig   | 5 +++++
>  include/configs/qemu-riscv.h         | 2 ++
>  7 files changed, 28 insertions(+)
> 
> diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig
> index 9634d7f77f..4961652548 100644
> --- a/configs/qemu-riscv32_defconfig
> +++ b/configs/qemu-riscv32_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -20,3 +21,6 @@ CONFIG_CMD_NVEDIT_EFI=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set

Does this have any affect on performance? It does for hardware,
but for software the overhead should be much smaller.

> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
> diff --git a/configs/qemu-riscv32_smode_defconfig b/configs/qemu-riscv32_smode_defconfig
> index 1c5a0617aa..91e4ffebc2 100644
> --- a/configs/qemu-riscv32_smode_defconfig
> +++ b/configs/qemu-riscv32_smode_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -21,4 +22,7 @@ CONFIG_CMD_NVEDIT_EFI=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set
> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
>  CONFIG_SYSRESET_SBI=y
> diff --git a/configs/qemu-riscv32_spl_defconfig b/configs/qemu-riscv32_spl_defconfig
> index 2421c9a371..90dbc329e0 100644
> --- a/configs/qemu-riscv32_spl_defconfig
> +++ b/configs/qemu-riscv32_spl_defconfig
> @@ -1,4 +1,6 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
> +CONFIG_SPL_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -25,5 +27,8 @@ CONFIG_SYS_BOOTM_LEN=0x4000000
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set
> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
>  CONFIG_SYSRESET_SBI=y
>  # CONFIG_BINMAN_FDT is not set
> diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig
> index d5eae95c80..87478f4481 100644
> --- a/configs/qemu-riscv64_defconfig
> +++ b/configs/qemu-riscv64_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -21,3 +22,6 @@ CONFIG_CMD_NVEDIT_EFI=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set
> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
> diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
> index 2861d07f97..5e9d6af3be 100644
> --- a/configs/qemu-riscv64_smode_defconfig
> +++ b/configs/qemu-riscv64_smode_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -24,4 +25,7 @@ CONFIG_CMD_NVEDIT_EFI=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set
> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
>  CONFIG_SYSRESET_SBI=y
> diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig
> index 1ecfa27ce2..fb951293dd 100644
> --- a/configs/qemu-riscv64_spl_defconfig
> +++ b/configs/qemu-riscv64_spl_defconfig
> @@ -1,4 +1,6 @@
>  CONFIG_RISCV=y
> +CONFIG_SEMIHOSTING=y
> +CONFIG_SPL_SEMIHOSTING=y
>  CONFIG_SYS_MALLOC_LEN=0x800000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_ENV_SIZE=0x20000
> @@ -25,5 +27,8 @@ CONFIG_SYS_BOOTM_LEN=0x4000000
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
>  CONFIG_SYS_MAX_FLASH_BANKS=2
> +# CONFIG_SERIAL_PUTS is not set
> +CONFIG_SERIAL_PROBE_ALL=y
> +CONFIG_SEMIHOSTING_SERIAL=y
>  CONFIG_SYSRESET_SBI=y
>  # CONFIG_BINMAN_FDT is not set
> diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h
> index d81e5d6c86..257d9c5d93 100644
> --- a/include/configs/qemu-riscv.h
> +++ b/include/configs/qemu-riscv.h
> @@ -48,4 +48,6 @@
>         "ramdisk_addr_r=0x8c300000\0" \
>         BOOTENV
> 
> +#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME       "u-boot.itb"

This is a Kconfig since 4a11e34bc9c ("Convert
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME et al to Kconfig")

>  #endif /* __CONFIG_H */
> --
> 2.34.1
> 


More information about the U-Boot mailing list