BORA SOM/BELK-L/Deployment/Restoring U-Boot on NOR flash

From DAVE Developer's Wiki
Jump to: navigation, search


Restoring U-Boot on SPI NOR flash[edit | edit source]

This article describes how to restore U-Boot on SPI NOR flash in case it gets corrupted or it is deleted accidentally.

The example refers to BoraXEVB carrier board but the procedure is the same for BoraEVB board as well. The procedure was tested with the binaries released with BXELK 2.0.0. As such, it is valid for BELK 4.x as well.

At the end of the procedure, the default partitioning of the NOR flash will be restored. It is depicted in the following image.


NOR flash default partitioning scheme

Instructions[edit | edit source]

First of all, create a bootable microSD card as described here.

Then, boot the board with the microSD card and stop automatic boot process of U-Boot in order to access the console.

U-Boot SPL 2017.01-belk-4.0.0-rc1 (Jul 03 2017 - 01:00:18)
mmc boot
Trying to boot from MMC1
reading fpga.bit
spl_load_image_fat: error reading image fpga.bit, err - -1
spl: error reading image fpga.bit, err - 1
reading u-boot.img
reading u-boot.img


U-Boot 2017.01-belk-4.0.0-rc1 (Jul 03 2017 - 01:00:18 +0200)

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff2e000, new gd at 3eaedee8, sp at 3eaedec0
NAND:  1024 MiB
MMC:   sdhci@e0100000: 0 (SD)
reading bora.env

** Unable to read "bora.env" from mmc0:1 **
Using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SOM ConfigID#: 00000004
SOM UniqueID#: 2a0e92c4:03193a4b
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
Bora>

Programming U-Boot from ethernet[edit | edit source]

Properly define the ethernet configuration parameter:

Bora> setenv ipaddr 192.168.0.91
Bora> setenv ethaddr 00:50:C2:1E:AF:B3
Bora> setenv serverip 192.168.0.23

Download via TFTP the U-Boot SPL and the U-Boot binary images. Then, burn them in NOR flash memory:

Bora> setenv SPL_base 0
Bora> setenv u-boot_base 0x40000
Bora> setenv update_spl 'sf probe 0 0 0;sf erase ${SPL_base} +${filesize};sf write ${loadaddr} ${SPL_base} ${filesize}'
Bora> setenv update 'sf probe 0 0 0;sf erase ${u-boot_base} +${filesize};sf write ${loadaddr} ${u-boot_base} ${filesize}'
zynq-uboot> tftpboot ${loadaddr} bora/u-boot/belk-4.1.4_borax_qspi_boot.bin
Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete... done
Using Gem.e000b000 device
TFTP from server 192.168.0.23; our IP address is 192.168.0.91
Filename 'bora/u-boot/belk-4.1.4_borax_qspi_boot.bin'.
Load address: 0x8000000
Loading: ##################
         782.2 KiB/s
done
Bytes transferred = 88940 (15b6c hex)
Bora> run update_spl
SF: Detected S25FL256S_64K with page size 64 KiB, total 32 MiB
SF: Successfully erased 131072 bytes @ 0x0
SF: program success 89036 bytes @ 0x0
Bora> tftpboot ${loadaddr} bora/u-boot/belk-4.1.4_borax_qspi_u-boot.img
Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete... done
Using Gem.e000b000 device
TFTP from server 192.168.0.23; our IP address is 192.168.0.91
Filename 'bora/u-boot/belk-4.1.4_borax_qspi_u-boot.img'.
Load address: 0x8000000
Loading: #################################################################
         #################################################################
         ####
         918 KiB/s
done
Bytes transferred = 683980 (a6fcc hex)
Bora> run update
SF: Detected S25FL256S_64K with page size 64 KiB, total 32 MiB
SF: Successfully erased 983040 bytes @ 0x40000
SF: program success 684100 bytes @ 0x40000
Bora>


Select the SPI NOR flash as boot device, remove the microSD card, and reset the board. The board should boot off the NOR flash as shown in the following image.

Bora> reset
resetting ...

U-Boot SPL 2017.01-belk-4.1.4 (Jul 28 2021 - 23:15:11)
qspi boot
Trying to boot from SPI

U-Boot 2017.01-belk-4.1.4 (Jul 28 2021 - 23:15:11 +0200), Build: belk-4.1.4

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff2e000, new gd at 3eaedee8, sp at 3eaedec0
NAND:  1024 MiB
MMC:   Card did not respond to voltage select!
Card did not respond to voltage select!
sdhci@e0100000 - probe failed: -95
Card did not respond to voltage select!

Card did not respond to voltage select!
** Bad device mmc 0 **
Using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SOM ConfigID#: 00000004
SOM UniqueID#: 2a0e92c4:03193a4b
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot

Notes about BELK 3.x.x/BXELK 1.x.x and older[edit | edit source]

Until BELK 3.x.x/BXELK 1.x.x, a little bit different partitioning scheme was used. It is illustrated in the following picture.


caption


This is due to the fact that those kits made use of the FSBL. Consquently, the header required by the Zynq'a bootrom and the FSBL binary image were stored at the bottom of the NOR flash. BELK 4.x.x and BXELK 2.x.x and newer are based on U-Boot SPL, instead. The U-Boot SPL binary image includes the header as well. This leads to a different partitioning.