Skip to content

Sifive HiFive Unmatched

NekoRouter edited this page Feb 22, 2023 · 3 revisions

Sifive Hifive Unmatched

CPU: SiFive Freedom U740 (FU740), RV64IMAC

Mem: 16GB DDR4

Boot Option: SPI Flash, MicroSD Card (Can't boot directly from NVMe drive)

Datasheet & Errata: https://www.sifive.com/boards/hifive-unmatched

Requirements

sudo apt install mmdebstrap debian-ports-archive-keyring

Binary file Source

U-boot files are from meta-sifive (https://github.com/sifive/meta-sifive/tree/master), Mainline U-boot with meta-sifive patches should be same.

Patches: https://github.com/sifive/meta-sifive/tree/master/recipes-bsp/u-boot/files/riscv64

TODO: Devicetree file? (package: linux-modules-xxx)

Install on MicroSD Card

TODO

Install on NVMe drive

For only sdcard: TODO (dd)

For sdcard + nvme disk: TODO (dd + mkimage-nvme.sh)

Flash U-Boot to SDCard

sudo mkimage-uboot.sh -d [sdcard device (/dev/sdx)]

This will make a sdcard only contains opensbi and u-boot, suitable for boot form nvme case.

Flash U-Boot Unmatched onboard Flash

the other/mkimage-uboot.sh will help to build a image only contain SPL and u-boot, so you can flash it to onboard SPI flash.

sudo mkimage-uboot.sh -o [image_file_name]
(copy output image file to unmatched)
sudo modprobe mtdblock    # Load the MTD block driver
sudo dd if=[image_file_name] of=/dev/mtdblock0 status=progress    # flash image to MTD device (SPI Flash)

After this step, set the "BOOT MODE SEL" switches to "0110" and boot.

FreeBSD wiki has a more detailed instruction, see https://wiki.freebsd.org/riscv/HiFiveUnmatched

Partitions

Rootfs: ext4, must have legacy_boot flag set for extlinux boot

EFI: vfat, must have boot,esp flag set for grub boot

Addtional

TODO (a hardware setup guide needed?)

BOOT MODE SEL (MSEL) switch

Boot from sdcard (SPI0): 1101

Boot from onboard flash (QSPI0): 0110

On hifive-unmatched-schematics-v3.pdf, SD Card is connected to SPI0, but on fu740-c000-manual-v1p6.pdf, there is a table 19 where mentioned "QSPI2 SD Card", and it matched boot from sd card case. need more research?