Instructions for setting up SPI flash on Zero

Install sunxi tools on a Linux/MacOS machine:
git clone -b spiflash-a20-test https://github.com/ssvb/sunxi-tools.git
cd sunxi-tools/
make

On the same machine, install sunxi-spi u-boot version:
git clone -b sunxi-spi https://github.com/StephanvanSchaik/u-boot
cd u-boot/

Patch include/configs/sunxi-common.h
Before the line with "#include <config_distro_bootcmd.h>" add the following line:
#define CONFIG_BOOTCOMMAND "sf probe; sf read 40000000 180000 20000; bootm 40000000"

Build u-boot:
make CROSS_COMPILE=arm-none-eabi- orangepi_zero_defconfig
make CROSS_COMPILE=arm-none-eabi- -j$(nproc)

Boot the Orange Pi Zero from SDCard and interrupt the boot process (using PuTTY on UART0).
Go into FEL mode with : go 0xffff0020

Back on the Linux/MacOS machine:
sudo ./sunxi-fel -p spiflash-write 0 <your path>/u-boot-sunxi-with-spl.bin
sudo ./sunxi-fel -p spiflash-write 0x180000 <your path>/orangepi_zero.uImage 
 
Remove the SDCard and reboot the Orange Pi Zero. The application is now starting from SPI flash.
Comments