Difference between revisions of "Restoring U-Boot on SPI NOR flash (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 18: Line 18:
  
 
===Instructions===
 
===Instructions===
First of all, create a bootable microSD card as described [[System boot and recovery via microSD card (BELK/BXELK)|here]].
+
First of all, create a bootable microSD card as described [[BORA_SOM/BELK-L/Development/How_to_create_a_bootable_microSD_card|here]].
  
 
Then, boot the board with the microSD card and stop automatic boot process of U-Boot in order to access the console.
 
Then, boot the board with the microSD card and stop automatic boot process of U-Boot in order to access the console.
Line 68: Line 68:
 
</pre>
 
</pre>
  
 
+
====Programming U-Boot from ethernet====
Download via TFTP the U-Boot SPL and the U-Boot binary images. Then, burn them in NOR flash memory.
+
Properly define the ethernet configuration parameter:
 
<pre class="board-terminal">
 
<pre class="board-terminal">
Bora> setenv ipaddr 192.168.0.81
+
Bora> setenv ipaddr 192.168.0.91
 
Bora> setenv ethaddr 00:50:C2:1E:AF:B3
 
Bora> setenv ethaddr 00:50:C2:1E:AF:B3
 
Bora> setenv serverip 192.168.0.23
 
Bora> setenv serverip 192.168.0.23
Bora> tftpboot ${loadaddr} borax/boot.bin
+
</pre>
Using ethernet@e000b000 device
+
 
TFTP from server 192.168.0.23; our IP address is 192.168.0.81
+
Download via TFTP the U-Boot SPL and the U-Boot binary images. Then, burn them in NOR flash memory:
Filename 'borax/boot.bin'.
+
<pre class="board-terminal">
Load address: 0x2080000
+
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: ##################
 
Loading: ##################
         2.2 MiB/s
+
         782.2 KiB/s
 
done
 
done
Bytes transferred = 88876 (15b2c hex)
+
Bytes transferred = 88940 (15b6c hex)
 
Bora> run update_spl
 
Bora> run update_spl
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
+
SF: Detected S25FL256S_64K with page size 64 KiB, total 32 MiB
SF: 131072 bytes @ 0x0 Erased: OK
+
SF: Successfully erased 131072 bytes @ 0x0
device 0 offset 0x0, size 0x15b2c
+
SF: program success 89036 bytes @ 0x0
SF: 88876 bytes @ 0x0 Written: OK
+
Bora> tftpboot ${loadaddr} bora/u-boot/belk-4.1.4_borax_qspi_u-boot.img
Bora> tftpboot ${loadaddr} borax/u-boot.img
+
Gem.e000b000:7 is connected to Gem.e000b000.  Reconnecting to Gem.e000b000
Using ethernet@e000b000 device
+
Gem.e000b000 Waiting for PHY auto negotiation to complete... done
TFTP from server 192.168.0.23; our IP address is 192.168.0.81
+
Using Gem.e000b000 device
Filename 'borax/u-boot.img'.
+
TFTP from server 192.168.0.23; our IP address is 192.168.0.91
Load address: 0x2080000
+
Filename 'bora/u-boot/belk-4.1.4_borax_qspi_u-boot.img'.
 +
Load address: 0x8000000
 
Loading: #################################################################
 
Loading: #################################################################
         ################################################
+
         #################################################################
         2 MiB/s
+
         ####
 +
        918 KiB/s
 
done
 
done
Bytes transferred = 577256 (8cee8 hex)
+
Bytes transferred = 683980 (a6fcc hex)
 
Bora> run update
 
Bora> run update
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
+
SF: Detected S25FL256S_64K with page size 64 KiB, total 32 MiB
SF: 589824 bytes @ 0x40000 Erased: OK
+
SF: Successfully erased 983040 bytes @ 0x40000
device 0 offset 0x40000, size 0x8cee8
+
SF: program success 684100 bytes @ 0x40000
SF: 577256 bytes @ 0x40000 Written: OK
 
 
Bora>
 
Bora>
 
</pre>
 
</pre>
  
  
[[BoraXEVB#Boot_mode_selection_-_S5|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_Xpress_SOM/BORA_Xpress_Evaluation_Kit/Getting_started/Boot_Configurations|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.
 
<pre class="board-terminal">
 
<pre class="board-terminal">
 
Bora> reset
 
Bora> reset
 
resetting ...
 
resetting ...
  
U-Boot SPL 2017.01-belk-4.0.0-rc1 (Jul 03 2017 - 01:00:18)
+
U-Boot SPL 2017.01-belk-4.1.4 (Jul 28 2021 - 23:15:11)
 
qspi boot
 
qspi boot
 
Trying to boot from SPI
 
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
U-Boot 2017.01-belk-4.0.0-rc1 (Jul 03 2017 - 01:00:18 +0200)
 
  
 
Model: Bora
 
Model: Bora
Line 154: Line 164:
 
Hit ENTER within 3 seconds to stop autoboot
 
Hit ENTER within 3 seconds to stop autoboot
 
</pre>
 
</pre>
 +
 
===Notes about BELK 3.x.x/BXELK 1.x.x and older===
 
===Notes about BELK 3.x.x/BXELK 1.x.x and older===
 
Until BELK 3.x.x/BXELK 1.x.x, a little bit different partitioning scheme was used. It is illustrated in the following picture.
 
Until BELK 3.x.x/BXELK 1.x.x, a little bit different partitioning scheme was used. It is illustrated in the following picture.

Latest revision as of 14:38, 23 November 2021

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress



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.