Booting PetaLinux from SPI flash
Petalinux is using a 2-stage booting process. The first stage boot, FS-Boot, is running from the Spartan-6 FPGA's BRAM once powered on. It's responsibility is to load the main system bootloader, U-Boot, from the flash to the larger external DDR memory, and run U-Boot from the external memory. U-boot will then load the Linux image and start the Linux boot.
Booting from SPI flash run sequence
Here are all the operations that will take place when we boot PetaLinux from the SPI flash.
- Power-up the board or press the PROG FPGA push button on the board, to start the boot-up.
- The Spartan-6 FPGA will automatically transfer the configuration image from the SPI flash to the FPGA configuration memory together with the first stage bootloader that will copied to the MicroBlaze local memory (BRAM). The FPGA is now configured and fully operating.
- The first stage bootloader will start to execute and copy the u-boot loader from the SPI flash to the system memory (LPDDR).
- The u-boot loader will execute and bring in the PetaLinux image to the system memory.
- The system will boot up.
Copying the u-boot loader to SPI flash
We have already copied the FPGA configuration image and the first stage bootloader to SPI flash (see part 79). Now we only have to figure out how to move the u-boot loader and the PetaLinux image to SPI flash. For the first step we will involve the Xilinx Microprocessor Debugger (XMD).
Xilinx Microprocessor Debugger
The Xilinx Microprocessor Debugger (XMD) is a tool that facilitates debugging programs and verifying systems using the PowerPC® (405 or 440) processor or the MicroBlazeTM processor. We can use it to debug programs on MicroBlaze or PowerPC 405 processors running on a hardware board, cycle-accurate Instruction Set Simulator (ISS). XMD provides a Tool Command Language (Tcl) interface. This interface can be used for command line control and debugging of the target as well as for running complex verification test scripts to test a complete system. Today we will use it to download the u-boot.elf program to the MicroBlaze system memory (LPDDR).
Downloading the u-boot elf file
To download the u-boot.elf file we will create a small xmd init file (xmd.ini) that will automatically run when we start xmd. It looks like this:
--> cd /tftpboot
--> source source /opt/Xilinx/13.2/ISE_DS/settings64.sh
Here is a printout from the xmd startup:
After the u-boot program is loaded to LPDDR memory, it wil start and the following will be displayed on the LX9 MicroBoard console:
We have to be very alert and as soon as the text "Hit any key to stop autoboot" is displayed we have to stop it. We are now ready to copy the uboot and the PetaLinux images to SPI flash. We will use the tftp server running on the host to do the job. For more information on how to setup the tftp server see part 74.
Copying the PetaLinux image
Before starting the image copy we have to set the IP address to the host.
- Use the command /sbin/ifconfig on the host to find the IP address.
- Use the command set serverip to set the IP address in the PetaLinux console.
Use the command: run update_kernel to copy the PetaLinux kernel (image.ub) to SPI flash:
Copying the u-boot image
We use the command: run update_uboot to copy the u-boot binary file (u-boot-s.bin) to SPI flash:
That was all.
When we press the PROG push button the PetaLinux will boot and display the startup screen.
Use this command to turn on the four leds on the board.
Top Previous Next