Difference between revisions of "System boot and recovery via microSD card (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
(15 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{Applies To Bora}}
 
{{Applies To Bora}}
 
{{Applies To BoraX}}
 
{{Applies To BoraX}}
 +
{{Applies To BoraLite}}
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
  
Line 15: Line 16:
 
|[[Bora_Embedded_Linux_Kit_(BELK)#BELK_software_components|3.0.0]]
 
|[[Bora_Embedded_Linux_Kit_(BELK)#BELK_software_components|3.0.0]]
 
|First release
 
|First release
 +
|-
 +
|2.0.0
 +
|December 2016
 +
|BELK 3.0.1 / BXELK 1.0.0
 +
|Added information about new kits
 +
|-
 +
|3.0.0
 +
|July 2017
 +
|BELK 4.0.0 / BXELK 2.0.0
 +
|Added information about new kits
 
|-
 
|-
 
|}
 
|}
  
==Instructions==
+
==Introduction==
It is assumed that the development environment has been set up properly as described [[Build_system_(BELK)|here]].
+
BELK provides a bootable microSD that can be used not only to quickly start the system, but also as a recovery method in case the primary boot device (eg. QSPI NOR flash) gets erased or corrupted. The following sections describe how to create a bootable SD card and how to configure the system for booting from SD. [[Restoring_U-Boot_on_SPI_NOR_flash_(BELK/BXELK)|This article]], for example, shows how to make use of such a card to restore the U-Boot image onto the NOR flash.
BELK provides a bootable microSD that can be used not only to quickly start the system, but also as a recovery method in case the primary boot device (eg. SPI NOR flash) gets erased or corrupted. The following sections describe how to create a bootable SD card and how to configure the system for booting from SD.
+
 
3.4.9.1 How to create a bootable MicroSD card
+
{{ImportantMessage|text=It is worth remembering that the bootable microSD card described in this article is not configured to perform a full boot sequence, including the operating system bootstrap. The bootable microSD card delivered along with the kit is set up to do a full bootstrap sequence, instead. For more details, please refer to [[Working_with_the_Yocto_build_system#bootscript|this section]].}}
This section describes how to create a new bootable microSD card from scratch.
+
 
 +
==How to create a bootable microSD card==
 +
===BELK <= 3.0.2 / BXELK <= 1.0.1===
 +
This section describes how to create a new bootable microSD card from scratch for '''BELK <= 3.0.2''' and '''BXELK <= 1.0.1'''.
 
The following components must be available:
 
The following components must be available:
FSBL built with Vivado 2014.4 as described in Section 3.4.2
+
*FSBL built with Vivado 2014.4 as described [[Creating_and_building_example_Vivado_project_(BELK)|here]]
U-boot built in elf format, as described in Section 3.4.4
+
*U-boot built in elf format, as described in [[Building_U-Boot_(BELK)|here]]
FPGA bitstream (optional)
+
*FPGA bitstream (optional).
 
The procedure is the following:
 
The procedure is the following:
from the Vivado 2014.4 SDK, apply the required patches to the main.c project file.This step can be done in two ways:
+
*from the Vivado 2014.4 SDK, apply the required patches to the <code>main.c</code> project file.This step can be done in two ways:
manually, directly modifying the main.c file adding the following code snippets:
+
**manually, directly modifying the <code>main.c</code> file adding the following code snippets:
 +
<pre>
 
----CUT----
 
----CUT----
 
/*
 
/*
Line 58: Line 73:
 
#ifdef XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR
 
#ifdef XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR
 
----CUT----
 
----CUT----
automatically, using the Apply Patch function and selecting the belk-sd-boot.patch file provided with the BELK (please refer to the following images):
+
</pre>
 +
**automatically, using the ''Apply Patch'' function and selecting the <code>belk-sd-boot.patch</code> file provided with the BELK (please refer to the following images):
 +
[[File:Patch sd 1.png|thumb|center|600px|Automatic patch applying (1/3)]]
 +
[[File:Patch sd 2.png|thumb|center|600px|Automatic patch applying (2/3)]]
 +
[[File:Patch sd 3.png|thumb|center|600px|Automatic patch applying (3/3)]]
 +
*once the patch is applied, rebuild the FSBL project
 +
*from the Xilinx Tools menu, select ''Create Zynq Boot Image''
 +
*select Create New BIF file and insert path and name of the .bif file
 +
*in the ''Boot image partitions'' section, click on ''Add'' to browse and add the following files:
 +
**FSBL in .elf format, with ''bootloader'' as partition type
 +
**(optional) FPGA bitstream in .bit format, with partition type ''datafile''
 +
**U-boot binary with .elf extension, with partition type ''datafile''
 +
*in the ''Output path'' section, browse and select the path where saving the <code>boot.bin</code> file
 +
*on a PC, format the microSD card creating a FAT32 partition
 +
*copy the <code>boot.bin</code> file to the microSD card FAT32 partition.
  
 +
===BELK-4.0.0 / BXELK-2.0.0===
 +
This section describes how to create a new bootable microSD card from scratch for '''BELK-4.0.0''' and '''BXELK-2.0.0'''.
 +
The following components must be available:
 +
*U-boot SPL and U-boot second stage built as described in [[Building_U-Boot_(BELK)|here]]
 +
*FPGA bitstream (optional).
 +
The procedure is the following:
 +
*on a PC, format the microSD card creating a FAT32 partition
 +
*copy the following files to the microSD card FAT32 partition:
 +
** U-boot SPL: <code>boot.bin</code>
 +
** U-boot second stage: <code>u-boot.img</code>
 +
** Fpga bitstream .bit (optional): <code>fpga.bit</code>
  
 +
==How to configure the system for microSD boot==
 +
For Bora/BoraEVB systems please refer to [[BoraEVB#Boot_mode_selection_-_S5|this link]].
  
once the patch are applied, rebuild the FSBL project
+
For BoraX/BoraXEVB systems please refer to [[BoraXEVB#Boot_mode_selection_-_S5|this link]].
from the Xilinx Tools menù, select Create Zynq Boot Image
 
select Create New BIF file and insert path and name of the .bif file
 
in the Boot image partitions section, click on Add to browse and add the following files:
 
FSBL in .elf format, with partition type “bootloader”
 
(optional) FPGA bitstream in .bit format, with partition type “datafile”
 
U-boot binary with .elf extension, with partition type “datafile”
 
in the Output path section, browse and select the path where saving the boot.bin file
 
on a PC, format the microSD card creating a FAT32 partition
 
copy the boot.bin file to the microSD card FAT32 partition
 
3.4.9.2 How to configure the system for SD boot
 
The S5 dip-switch on the BORAEVB carrier board is used for configuring the boot mode. Please refer to the following table to select the MicroSD mode (highlighted in green):
 
 
 
 
 
  
{| {{table}}
+
{{ImportantMessage|text=In case the microSD card provided along with the kit is used, the Programmable Logic is automatically programmed with the [[Creating_and_building_example_Vivado_project_(BELK/BXELK)|example design]] during the boot process.
| align="center" style="background:#f0f0f0;"|''''''
+
}}
| align="center" style="background:#f0f0f0;"|'''S5 dip-switch positions'''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
| align="center" style="background:#f0f0f0;"|''''''
 
|-
 
| Boot mode||1||2||3||4||5||6||7||8
 
|-
 
| MicroSD||OFF||ON||OFF||ON||ON||OFF||ON||OFF
 
|-
 
| NOR SPI||OFF||ON||OFF||ON||ON||ON||ON||OFF
 
|-
 
| NAND||OFF||ON||OFF||ON||ON||OFF||ON||ON
 
|-
 
|
 
|}
 

Revision as of 13:48, 16 October 2019

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

History[edit | edit source]

Version Date BELK version Notes
1.0.0 November 2015 3.0.0 First release
2.0.0 December 2016 BELK 3.0.1 / BXELK 1.0.0 Added information about new kits
3.0.0 July 2017 BELK 4.0.0 / BXELK 2.0.0 Added information about new kits

Introduction[edit | edit source]

BELK provides a bootable microSD that can be used not only to quickly start the system, but also as a recovery method in case the primary boot device (eg. QSPI NOR flash) gets erased or corrupted. The following sections describe how to create a bootable SD card and how to configure the system for booting from SD. This article, for example, shows how to make use of such a card to restore the U-Boot image onto the NOR flash.


200px-Emblem-important.svg.png

It is worth remembering that the bootable microSD card described in this article is not configured to perform a full boot sequence, including the operating system bootstrap. The bootable microSD card delivered along with the kit is set up to do a full bootstrap sequence, instead. For more details, please refer to this section.

How to create a bootable microSD card[edit | edit source]

BELK <= 3.0.2 / BXELK <= 1.0.1[edit | edit source]

This section describes how to create a new bootable microSD card from scratch for BELK <= 3.0.2 and BXELK <= 1.0.1. The following components must be available:

  • FSBL built with Vivado 2014.4 as described here
  • U-boot built in elf format, as described in here
  • FPGA bitstream (optional).

The procedure is the following:

  • from the Vivado 2014.4 SDK, apply the required patches to the main.c project file.This step can be done in two ways:
    • manually, directly modifying the main.c file adding the following code snippets:
----CUT----
	/*
	 * Unlock SLCR for SLCR register write
	 */
	SlcrUnlock();

+	*((u32 *)0xF8000830) = 0x003F003F;
+	*((u32 *)0xF8000834) = 0x003F003F;

	/* If Performance measurement is required 
	 * then read the Global Timer value , Please note that the
----CUT----

----CUT----
	/*
	 * Read bootmode register
	 */
	BootModeRegister = Xil_In32(BOOT_MODE_REG);
	BootModeRegister &= BOOT_MODES_MASK;

+	// always init QSPI
+	InitQspi();
	
	/*
	 * QSPI BOOT MODE
	 */
#ifdef XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR
----CUT----
    • automatically, using the Apply Patch function and selecting the belk-sd-boot.patch file provided with the BELK (please refer to the following images):
Automatic patch applying (1/3)
Automatic patch applying (2/3)
Automatic patch applying (3/3)
  • once the patch is applied, rebuild the FSBL project
  • from the Xilinx Tools menu, select Create Zynq Boot Image
  • select Create New BIF file and insert path and name of the .bif file
  • in the Boot image partitions section, click on Add to browse and add the following files:
    • FSBL in .elf format, with bootloader as partition type
    • (optional) FPGA bitstream in .bit format, with partition type datafile
    • U-boot binary with .elf extension, with partition type datafile
  • in the Output path section, browse and select the path where saving the boot.bin file
  • on a PC, format the microSD card creating a FAT32 partition
  • copy the boot.bin file to the microSD card FAT32 partition.

BELK-4.0.0 / BXELK-2.0.0[edit | edit source]

This section describes how to create a new bootable microSD card from scratch for BELK-4.0.0 and BXELK-2.0.0. The following components must be available:

  • U-boot SPL and U-boot second stage built as described in here
  • FPGA bitstream (optional).

The procedure is the following:

  • on a PC, format the microSD card creating a FAT32 partition
  • copy the following files to the microSD card FAT32 partition:
    • U-boot SPL: boot.bin
    • U-boot second stage: u-boot.img
    • Fpga bitstream .bit (optional): fpga.bit

How to configure the system for microSD boot[edit | edit source]

For Bora/BoraEVB systems please refer to this link.

For BoraX/BoraXEVB systems please refer to this link.


200px-Emblem-important.svg.png

In case the microSD card provided along with the kit is used, the Programmable Logic is automatically programmed with the example design during the boot process.