[PATCH v2 2/2] RISC-V: sifive: enable SPI Flash and SD in config

Antony Pavlov antonynpavlov at gmail.com
Mon Aug 22 04:32:42 PDT 2022


On Tue, 26 Apr 2022 08:46:04 +0200
Ahmad Fatoum <ahmad at a3f.at> wrote:

Hi Ahmad!

I'm trying to run SiFive target with emulate.pl, e.g.

barebox$ dd if=/dev/zero of=/tmp/1M count=1 bs=1M
barebox$ ./test/emulate.pl sifive_defconfig  -- -drive file=/tmp/1M,if=sd
...
qemu-system-riscv64: -drive file=/tmp/1M,if=sd: machine type does not support if=sd,bus=0,unit=0
Error running emulator: 256

I use QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-11+deb11u2), please see https://gitlab.com/frantony/barebox-gitlab-ci-runner .

If I skip the '-drive file=/tmp/1M,if=sd' qemu option then I see "Load access fault", e.g.

barebox$ ./test/emulate.pl sifive_defconfig
...
barebox 2022.08.0-00162-g7fce4ae853b0 #1 @1661158478


Board: SiFive HiFive Unleashed A00
Unhandled exception: 5 "Load access fault"
E [<0000000087e224fc>] ra: [<0000000087e224f0>] tval: 0000000010040014

sp:  0000000087fffd70 gp:  0000000000000000 tp:  0000000000000001
t0:  0000000083f16cf0 t1:  0000000000000002 t2:  ffffffffffffffff
s0:  0000000083f16c78 s1:  0000000087eaf590 a0:  0000000003f940aa
a1:  0000000083f0fee0 a2:  0000000000000001 a3:  0000000083f0f3d8
a4:  0000000000000002 a5:  0000000010040000 a6:  0000000000000001
a7:  0000000000ff0000 s2:  0000000083f0fee0 s3:  ffffffffffffffff
s4:  fffffffffffff000 s5:  0000000000000008 s6:  0000000080201ca0
s7:  0000000000000001 s8:  00000000000db4f8 s9:  0000000087fe0000
s10: 0000000000000000 s11: 0000000000000000 t3:  0000000000000048
t4:  0000000000000000 t5:  0000000000000000 t6:  fffffffffffffffd
### ERROR ### Please RESET the board ###

If I revert the 'RISC-V: sifive: enable SPI Flash and SD in config' commit then './test/emulate.pl sifive_defconfig' runs successfully.

> To test SD-Card:
> 
>   ./test/emulate.pl sifive_defconfig  -- -drive file=image.sdcard,if=sd
> 
> Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
> ---
> v1 -> v2:
>   - No change
> ---
>  arch/riscv/configs/sifive_defconfig | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/riscv/configs/sifive_defconfig b/arch/riscv/configs/sifive_defconfig
> index 59cfebf194df..6ebe6eaf3785 100644
> --- a/arch/riscv/configs/sifive_defconfig
> +++ b/arch/riscv/configs/sifive_defconfig
> @@ -13,13 +13,10 @@ CONFIG_HUSH_FANCY_PROMPT=y
>  CONFIG_CMDLINE_EDITING=y
>  CONFIG_AUTO_COMPLETE=y
>  CONFIG_MENU=y
> -CONFIG_IMD_TARGET=y
>  CONFIG_CONSOLE_ALLOW_COLOR=y
>  CONFIG_PBL_CONSOLE=y
>  CONFIG_PARTITION_DISK_EFI=y
>  CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> -CONFIG_BAREBOXENV_TARGET=y
> -CONFIG_BAREBOXCRC32_TARGET=y
>  CONFIG_STATE=y
>  CONFIG_STATE_CRYPTO=y
>  CONFIG_BOOTCHOOSER=y
> @@ -85,20 +82,21 @@ CONFIG_VIRTIO_CONSOLE=y
>  CONFIG_SERIAL_SIFIVE=y
>  CONFIG_DRIVER_NET_MACB=y
>  CONFIG_DRIVER_SPI_GPIO=y
> +CONFIG_SPI_SIFIVE=y
>  CONFIG_I2C=y
>  CONFIG_I2C_GPIO=y
>  CONFIG_MTD=y
> -# CONFIG_MTD_OOB_DEVICE is not set
> +CONFIG_MTD_RAW_DEVICE=y
>  CONFIG_MTD_CONCAT=y
>  CONFIG_MTD_M25P80=y
>  CONFIG_DRIVER_CFI=y
>  CONFIG_DRIVER_CFI_BANK_WIDTH_8=y
> -CONFIG_DISK=y
> -CONFIG_DISK_WRITE=y
>  CONFIG_VIRTIO_BLK=y
>  CONFIG_VIDEO=y
>  CONFIG_FRAMEBUFFER_CONSOLE=y
>  CONFIG_DRIVER_VIDEO_SIMPLEFB_CLIENT=y
> +CONFIG_MCI=y
> +CONFIG_MCI_SPI=y
>  CONFIG_CLOCKSOURCE_DUMMY_RATE=60000
>  CONFIG_EEPROM_AT24=y
>  CONFIG_HWRNG=y
> @@ -126,3 +124,6 @@ CONFIG_ZSTD_DECOMPRESS=y
>  CONFIG_XZ_DECOMPRESS=y
>  CONFIG_BASE64=y
>  CONFIG_DIGEST_CRC32_GENERIC=y
> +CONFIG_IMD_TARGET=y
> +CONFIG_BAREBOXENV_TARGET=y
> +CONFIG_BAREBOXCRC32_TARGET=y
> -- 
> 2.34.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list