cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rani.feldman
Observer
Observer
540 Views
Registered: ‎01-06-2019

U-Boot petaLinux QSPI configuration

Hello,

I am using Petalinux 2019.2 with Zynq7000. I want to load my images (BOOT.bin ,Linux image) from QSPI, so I followed the instruction in UG1165.

The QSPI is empty so there are no U-Boot variables, when booting we get a CRC error when reading the environment variables. 

When printing the U-Boot environment I still see the following:

bootcmd=run default_bootcmd

cp_kernel2ram=mmcinfo && fatload mmc ${sdbootdev} ${netstart} ${kernel_img}

default_bootcmd=run uenvboot; run cp_kernel2ram && bootm ${netstart} 

This means that the default boot is SD and not QSPI as was configured in the Petalinux configuration.

In order to fix this I had to do the following:

qspi_bootcmd=sf probe 0 0 0 && sf read 0x10000000 0x1e40000 0x1c00000 && bootm 0x10000000

bootcmd=run qspi_bootcmd

It looks like the Petalinux configuration for U-Boot has no effect. I thought that when I configure the the U-Boot to take the Linux image from the QSPI it will use this parameters and not use default hard coded (which is SD card).

Is it a known issue ? Am I doing something wrong? 

 

 

0 Kudos
2 Replies
aravindb
Moderator
Moderator
470 Views
Registered: ‎02-07-2018

HI @rani.feldman 

Please follow this below procedure, it should work. 

  1. Boot from SD/JTAG and stop at u-boot.
  2. Load the boot images to DDR & flash to QSPI.
  3. Then power off the board and change the jumper settings as per this link: http://www.wiki.xilinx.com/Prepare+Boot+Medium (Boot mode set for QSPI boot on a zc706) then restart the board. It will boot from QSPI.

Zynq>
Zynq> dhcp
BOOTP broadcast 1
BOOTP broadcast 2
DHCP client bound to address 10.175.32.129 (627 ms)
Zynq> setenv serverip 10.175.33.67
Zynq> sf probe 0 0 0
SF: Detected n25q128a with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Zynq> tftpb 0x10000000 BOOT.BIN
Using ethernet@e000b000 device
TFTP from server 10.175.33.67; our IP address is 10.175.32.129
Filename 'BOOT.BIN'.
Load address: 0x10000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
######
1.3 MiB/s
done
Bytes transferred = 4685552 (477ef0 hex)
Zynq> sf erase 0 0x500000      
SF: 5242880 bytes @ 0x0 Erased: OK
Zynq> sf write 0x10000000 0 0x477ef0  -→ (ex:sf write DDR_load_address  offset  image_size)
device 0 offset 0x0, size 0x477ef0
SF: 4685552 bytes @ 0x0 Written: OK
Zynq> sf erase 0x520000 0xa80000
SF: 11010048 bytes @ 0x520000 Erased: OK
Zynq> tftpb 0x10000000 image.ub
Using ethernet@e000b000 device
TFTP from server 10.175.33.67; our IP address is 10.175.32.129
Filename 'image.ub'.
Load address: 0x10000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
1.2 MiB/s
done
Bytes transferred = 10001224 (989b48 hex)
Zynq> sf write 0x10000000 0x520000 0x989b48
device 0 offset 0x520000, size 0x989b48
SF: 10001224 bytes @ 0x520000 Written: OK
Zynq>

 

For your info ,As per device tree QSPI partitions are mentioned below:

  spi@e000d000 {

         clock-names = "ref_clk", "pclk";

         clocks = <0x1 0xa 0x1 0x2b>;

         compatible = "xlnx,zynq-qspi-1.0";

         status = "okay";

         interrupt-parent = <0x4>;

         interrupts = <0x0 0x13 0x4>;

         reg = <0xe000d000 0x1000>;

         #address-cells = <0x1>;

         #size-cells = <0x0>;

         u-boot,dm-pre-reloc;

         is-dual = <0x0>;

         num-cs = <0x1>;

         spi-rx-bus-width = <0x4>;

         spi-tx-bus-width = <0x4>;

 

         flash@0 {

            compatible = "n25q512a", "micron,m25p80";

            reg = <0x0>;

            spi-tx-bus-width = <0x1>;

            spi-rx-bus-width = <0x4>;

            spi-max-frequency = <0x2faf080>;

            #address-cells = <0x1>;

            #size-cells = <0x1>;

 

            partition@0x00000000 {

               label = "boot";

               reg = <0x0 0x500000>;   ----   > this is <offset  size> used while erasing boot partition.

            };

 

            partition@0x00500000 {

               label = "bootenv";

               reg = <0x500000 0x20000>;

            };

      partition@0x00520000 {

               label = "kernel";

               reg = <0x520000 0xa80000>;----   > this is <offset  size> used while erasing  kernel partition.

            };

 

            partition@0x00fa0000 {

               label = "spare";

               reg = <0xfa0000 0x0>;

            };

         };

      };

 

Thanks & Regards

Aravind

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

0 Kudos
rani.feldman
Observer
Observer
453 Views
Registered: ‎01-06-2019

Hi @aravindb 

Thank you for your answer

In your answer you described the process of programming the BOOT.bin and the image.ub in the QSPI. I know how to do this and this is not my issue. After I burn the images to the QSPI and reset the board the U-Boot checks the environment variable section in the QSPI and does not find any valid information (it is erased). Since there is no valid information the U-Boot goes to the SD card (Hard coded in the U-Boot code) to fetch the Linux image.

In the Petalinux configuration you can specify for the U-Boot where to look for the linux image (QSPI or SD). So even if I set the parameter to QSPI the U-Boot code ignores this.  

0 Kudos