Khadas VIM3/VIM3L and VIM4 contains a 16 MB and 32 MB SPI-Flash that’s used as boot storage; so you can boot from it. This guide is about how to boot from the on-board SPI-Flash. Take VIM4 as a example.
Warnnote warn The U-Boot firmware that VIM3/VIM3L can use to burn to SPI is named
u-boot.bin
, VIM4 isu-boot.bin.spi.bin.signed
.
Build U-Boot for SPI-Flash
The U-Boot for SPI-Flash is the same as eMMC U-Boot. We recommend using Fenix Script to build U-Boot, as it’s easy this way.
This guide assumes that you have already setup a basic build environment. If not, please refer to Fenix Usage.
- Setup Environment:
1 | $ cd fenix |
Select VIM4
- Build U-Boot
1 | $ make uboot |
If successful, you will get a U-Boot for the SPI-Flash u-boot.bin.spi.bin.signed
, in the directory fenix/build/u-boot/./fip/_tmp/
.
Burn U-Boot to SPI-Flash
Copy u-boot.bin.signed
to an SD-Card or Thumbdrive (U-Disk) and insert it into your board or load it via TFTP.
Setup serial debugging tool and boot to the U-Boot Command Line.
Load U-Boot to DDR
- Load U-Boot from SD-Card:
1 | kvim4# load mmc 0 1080000 u-boot.bin.spi.bin.signed |
- Load U-Boot from Thumbdrive (U-Disk):
1 | kvim4# usb start |
- Load U-Boot via TFTP
Please refer here about how to setup the TFTP.
1 | kvim4# tftp 1080000 u-boot.bin.spi.bin.signed |
Burning
1 | kvim4# sf probe |
Setup Bootmode to SPI
If you want to boot from SPI-Flash, you have to setup the bootmode to SPI. The default bootmode is boot from eMMC.
- Check current bootmode:
1 | kvim4# kbi bootmode r |
Current bootmode is boot from eMMC.
- Setup bootmode to SPI:
1 | kvim4# kbi bootmode w spi |
Poweroff the system to make it available:
1 | kvim4# kbi poweroff |
Press the POWER
key to bootup, you will boot from the SPI-Flash.
Erase the SPI-Flash to Prevent Boot from It
1 | kvim4# sf probe |
Troubleshooting
Bootmode is boot from SPI, but the u-boot in SPI flash is corrupted, can’t enter u-boot command line.
1. If u-boot in eMMC is correct, you can try TST mode or try SPI MASKROM to boot from eMMC, then enter u-boot command line, erase the SPI flash or burn the new u-boot to SPI flash.
NoteDon’t use your PC to supply the power, or you will enter usb burning mode!
2. U-Boot in eMMC is also corrupted, you have to try TST mode to enter usb burning mode, and flash the image to emmc, then follow
step 1)
.NoteYou need to connect the board to your host PC!