1d4e28f0eSBin MengMicrochip PolarFire SoC Icicle Kit (``microchip-icicle-kit``) 2d4e28f0eSBin Meng============================================================= 3d4e28f0eSBin Meng 4d4e28f0eSBin MengMicrochip PolarFire SoC Icicle Kit integrates a PolarFire SoC, with one 5d4e28f0eSBin MengSiFive's E51 plus four U54 cores and many on-chip peripherals and an FPGA. 6d4e28f0eSBin Meng 7d4e28f0eSBin MengFor more details about Microchip PolarFire SoC, please see: 8d4e28f0eSBin Menghttps://www.microsemi.com/product-directory/soc-fpgas/5498-polarfire-soc-fpga 9d4e28f0eSBin Meng 10d4e28f0eSBin MengThe Icicle Kit board information can be found here: 11d4e28f0eSBin Menghttps://www.microsemi.com/existing-parts/parts/152514 12d4e28f0eSBin Meng 13d4e28f0eSBin MengSupported devices 14d4e28f0eSBin Meng----------------- 15d4e28f0eSBin Meng 16d4e28f0eSBin MengThe ``microchip-icicle-kit`` machine supports the following devices: 17d4e28f0eSBin Meng 18d4e28f0eSBin Meng* 1 E51 core 19d4e28f0eSBin Meng* 4 U54 cores 20d4e28f0eSBin Meng* Core Level Interruptor (CLINT) 21d4e28f0eSBin Meng* Platform-Level Interrupt Controller (PLIC) 22d4e28f0eSBin Meng* L2 Loosely Integrated Memory (L2-LIM) 23d4e28f0eSBin Meng* DDR memory controller 24d4e28f0eSBin Meng* 5 MMUARTs 25d4e28f0eSBin Meng* 1 DMA controller 26d4e28f0eSBin Meng* 2 GEM Ethernet controllers 27d4e28f0eSBin Meng* 1 SDHC storage controller 28d4e28f0eSBin Meng 29d4e28f0eSBin MengBoot options 30d4e28f0eSBin Meng------------ 31d4e28f0eSBin Meng 32d4e28f0eSBin MengThe ``microchip-icicle-kit`` machine can start using the standard -bios 33d4e28f0eSBin Mengfunctionality for loading its BIOS image, aka Hart Software Services (HSS_). 34143897b5SBin MengHSS loads the second stage bootloader U-Boot from an SD card. Then a kernel 35143897b5SBin Mengcan be loaded from U-Boot. It also supports direct kernel booting via the 36143897b5SBin Meng-kernel option along with the device tree blob via -dtb. When direct kernel 37143897b5SBin Mengboot is used, the OpenSBI fw_dynamic BIOS image is used to boot a payload 38143897b5SBin Menglike U-Boot or OS kernel directly. 39143897b5SBin Meng 40143897b5SBin MengThe user provided DTB should have the following requirements: 41143897b5SBin Meng 42143897b5SBin Meng* The /cpus node should contain at least one subnode for E51 and the number 43143897b5SBin Meng of subnodes should match QEMU's ``-smp`` option 44143897b5SBin Meng* The /memory reg size should match QEMU’s selected ram_size via ``-m`` 45143897b5SBin Meng* Should contain a node for the CLINT device with a compatible string 46143897b5SBin Meng "riscv,clint0" 47143897b5SBin Meng 48143897b5SBin MengQEMU follows below truth table to select which payload to execute: 49143897b5SBin Meng 50*6165dcb5SBin Meng===== ========== ========== ======= 51*6165dcb5SBin Meng-bios -kernel -dtb payload 52*6165dcb5SBin Meng===== ========== ========== ======= 53*6165dcb5SBin Meng N N don't care HSS 54*6165dcb5SBin Meng Y don't care don't care HSS 55*6165dcb5SBin Meng N Y Y kernel 56*6165dcb5SBin Meng===== ========== ========== ======= 57d4e28f0eSBin Meng 58d4e28f0eSBin MengThe memory is set to 1537 MiB by default which is the minimum required high 59d4e28f0eSBin Mengmemory size by HSS. A sanity check on ram size is performed in the machine 60d4e28f0eSBin Menginit routine to prompt user to increase the RAM size to > 1537 MiB when less 61d4e28f0eSBin Mengthan 1537 MiB ram is detected. 62d4e28f0eSBin Meng 63143897b5SBin MengRunning HSS 64143897b5SBin Meng----------- 65d4e28f0eSBin Meng 66d4e28f0eSBin MengHSS 2020.12 release is tested at the time of writing. To build an HSS image 67d4e28f0eSBin Mengthat can be booted by the ``microchip-icicle-kit`` machine, type the following 68d4e28f0eSBin Mengin the HSS source tree: 69d4e28f0eSBin Meng 70d4e28f0eSBin Meng.. code-block:: bash 71d4e28f0eSBin Meng 72d4e28f0eSBin Meng $ export CROSS_COMPILE=riscv64-linux- 73d4e28f0eSBin Meng $ cp boards/mpfs-icicle-kit-es/def_config .config 74d4e28f0eSBin Meng $ make BOARD=mpfs-icicle-kit-es 75d4e28f0eSBin Meng 76d4e28f0eSBin MengDownload the official SD card image released by Microchip and prepare it for 77d4e28f0eSBin MengQEMU usage: 78d4e28f0eSBin Meng 79d4e28f0eSBin Meng.. code-block:: bash 80d4e28f0eSBin Meng 81d4e28f0eSBin Meng $ wget ftp://ftpsoc.microsemi.com/outgoing/core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz 82d4e28f0eSBin Meng $ gunzip core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz 83d4e28f0eSBin Meng $ qemu-img resize core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic 4G 84d4e28f0eSBin Meng 85d4e28f0eSBin MengThen we can boot the machine by: 86d4e28f0eSBin Meng 87d4e28f0eSBin Meng.. code-block:: bash 88d4e28f0eSBin Meng 89d4e28f0eSBin Meng $ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 \ 90d4e28f0eSBin Meng -bios path/to/hss.bin -sd path/to/sdcard.img \ 91d4e28f0eSBin Meng -nic user,model=cadence_gem \ 92d4e28f0eSBin Meng -nic tap,ifname=tap,model=cadence_gem,script=no \ 93d4e28f0eSBin Meng -display none -serial stdio \ 94d4e28f0eSBin Meng -chardev socket,id=serial1,path=serial1.sock,server=on,wait=on \ 95d4e28f0eSBin Meng -serial chardev:serial1 96d4e28f0eSBin Meng 97d4e28f0eSBin MengWith above command line, current terminal session will be used for the first 98d4e28f0eSBin Mengserial port. Open another terminal window, and use `minicom` to connect the 99d4e28f0eSBin Mengsecond serial port. 100d4e28f0eSBin Meng 101d4e28f0eSBin Meng.. code-block:: bash 102d4e28f0eSBin Meng 103d4e28f0eSBin Meng $ minicom -D unix\#serial1.sock 104d4e28f0eSBin Meng 105d4e28f0eSBin MengHSS output is on the first serial port (stdio) and U-Boot outputs on the 106d4e28f0eSBin Mengsecond serial port. U-Boot will automatically load the Linux kernel from 107d4e28f0eSBin Mengthe SD card image. 108d4e28f0eSBin Meng 109*6165dcb5SBin MengDirect Kernel Boot 110*6165dcb5SBin Meng------------------ 111*6165dcb5SBin Meng 112*6165dcb5SBin MengSometimes we just want to test booting a new kernel, and transforming the 113*6165dcb5SBin Mengkernel image to the format required by the HSS bootflow is tedious. We can 114*6165dcb5SBin Menguse '-kernel' for direct kernel booting just like other RISC-V machines do. 115*6165dcb5SBin Meng 116*6165dcb5SBin MengIn this mode, the OpenSBI fw_dynamic BIOS image for 'generic' platform is 117*6165dcb5SBin Mengused to boot an S-mode payload like U-Boot or OS kernel directly. 118*6165dcb5SBin Meng 119*6165dcb5SBin MengFor example, the following commands show building a U-Boot image from U-Boot 120*6165dcb5SBin Mengmainline v2021.07 for the Microchip Icicle Kit board: 121*6165dcb5SBin Meng 122*6165dcb5SBin Meng.. code-block:: bash 123*6165dcb5SBin Meng 124*6165dcb5SBin Meng $ export CROSS_COMPILE=riscv64-linux- 125*6165dcb5SBin Meng $ make microchip_mpfs_icicle_defconfig 126*6165dcb5SBin Meng 127*6165dcb5SBin MengThen we can boot the machine by: 128*6165dcb5SBin Meng 129*6165dcb5SBin Meng.. code-block:: bash 130*6165dcb5SBin Meng 131*6165dcb5SBin Meng $ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 -m 2G \ 132*6165dcb5SBin Meng -sd path/to/sdcard.img \ 133*6165dcb5SBin Meng -nic user,model=cadence_gem \ 134*6165dcb5SBin Meng -nic tap,ifname=tap,model=cadence_gem,script=no \ 135*6165dcb5SBin Meng -display none -serial stdio \ 136*6165dcb5SBin Meng -kernel path/to/u-boot/build/dir/u-boot.bin \ 137*6165dcb5SBin Meng -dtb path/to/u-boot/build/dir/u-boot.dtb 138*6165dcb5SBin Meng 139*6165dcb5SBin MengCAVEATS: 140*6165dcb5SBin Meng 141*6165dcb5SBin Meng* Check the "stdout-path" property in the /chosen node in the DTB to determine 142*6165dcb5SBin Meng which serial port is used for the serial console, e.g.: if the console is set 143*6165dcb5SBin Meng to the second serial port, change to use "-serial null -serial stdio". 144*6165dcb5SBin Meng* The default U-Boot configuration uses CONFIG_OF_SEPARATE hence the ELF image 145*6165dcb5SBin Meng ``u-boot`` cannot be passed to "-kernel" as it does not contain the DTB hence 146*6165dcb5SBin Meng ``u-boot.bin`` has to be used which does contain one. To use the ELF image, 147*6165dcb5SBin Meng we need to change to CONFIG_OF_EMBED or CONFIG_OF_PRIOR_STAGE. 148*6165dcb5SBin Meng 149d4e28f0eSBin Meng.. _HSS: https://github.com/polarfire-soc/hart-software-services 150