News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

TEBF0808 Booting from QSPI

Started by Aaron, April 09, 2019, 08:04:47 PM

Previous topic - Next topic

Aaron

I'd like to be able to build a bootable petalinux image that can be flashed to the QSPI using petalinux 2017.2. 

The StarterKit template includes a platform-top.h that defines some uboot variables that, I presume, give the uboot some premade environment variables, with things like:

/* Extra U-Boot Env settings */
#define CONFIG_EXTRA_ENV_SETTINGS \
.
.
.
        "cp_kernel2ram=mmcinfo && fatload mmc 1 ${netstart} ${kernel_img}\0" \
.
.
.
        "default_bootcmd=run cp_kernel2ram && bootm ${netstart}\0" \


I believe this makes a SD card boot happen by default, but how can I override this to make it boot from QSPI?

Aaron

Maybe I should be more specific:

I  flashed the QSPI with an image using Xilinx's SDK (adjusting SW5 before and after).  I removed the SD card, then power-cycled, and found it unable to boot... I would have expected it to fall back on the QSPI, but instead, it seems obsessed with the missing SD card:

ZynqMP> Xilinx Zynq MP First Stage Boot Loader
Release 2017.2   Apr  3 2019  -  11:58:54
Xilinx Zynq MP First Stage Boot Loader
Release 2017.2   Apr  3 2019  -  11:58:54
Xilinx Zynq MP First Stage Boot Loader
Release 2017.2   Apr  3 2019  -  11:58:54
NOTICE:  ATF running on XCZU9EG/silicon v4/RTL5.1 at 0xfffea000, with PMU firmware
NOTICE:  BL31: Secure code at 0x0
NOTICE:  BL31: Non secure code at 0x8000000
NOTICE:  BL31: v1.3(release):0d9d51a
NOTICE:  BL31: Built : 20:01:58, Apr  9 2019


U-Boot 2017.01 (Apr 09 2019 - 16:02:50 -0400) Xilinx ZynqMP ZCU102 revB

I2C:   Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
ready
DRAM:  4 GiB
EL Level:       EL2
Chip ID:        xczu9eg
MMC:   sdhci_send_command: MMC: 1 busy timeout increasing to: 200 ms.
sdhci_send_command: MMC: 1 busy timeout increasing to: 400 ms.
sdhci_send_command: MMC: 1 busy timeout increasing to: 800 ms.
sdhci_send_command: MMC: 1 busy timeout increasing to: 1600 ms.
sdhci_send_command: MMC: 1 busy timeout increasing to: 3200 ms.
sdhci_send_command: MMC: 1 busy timeout.
sdhci_send_command: MMC: 1 busy timeout.
sdhci@ff170000 - probe failed: -70
sdhci@ff160000: 0 (eMMC)sdhci_send_command: MMC: 1 busy timeout.
sdhci_send_command: MMC: 1 busy timeout.

SF: Detected n25q512a with page size 512 Bytes, erase size 128 KiB, total 128 MiB
*** Warning - bad CRC, using default environment

Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
In:    serial
Out:   serial
Err:   serial
Bootmode: QSPI_MODE
Net:   ZYNQ GEM: ff0e0000, phyaddr 1, interface rgmii-id
eth0: ethernet@ff0e0000
U-BOOT for 6trenz

ethernet@ff0e0000 Waiting for PHY auto negotiation to complete....... done
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded
Hit any key to stop autoboot:  0
Device: sdhci@ff160000
Manufacturer ID: 13
OEM: 14e
Name: Q2J54
Tran Speed: 25000000
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 3.6 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 3.6 GiB WRREL
Boot Capacity: 16 MiB ENH
RPMB Capacity: 512 KiB ENH
sdhci_send_command: MMC: 1 busy timeout.
sdhci_send_command: MMC: 1 busy timeout.
** Bad device mmc 1 **



I tried editing the platform-top.h and commenting out the
#define CONFIG_EXTRA_ENV_SETTINGS \
.
.
.


That allowed me to boot from the QSPI, but I received an "invalid FIT image"-type message from uboot, so I'm not sure if that was the correct thing to meddle with.

Any help is appreciated.

JH

Hi,
use petalinux-config to change location from SD to QSPI. Create Boot.bin with image.ub included. Offset of the image.ub file on the Boot.bin must be the same like defined on petalinux-config for flash partitions.
br
John

Aaron

There are a few problems with what you are telling me.  Please read, as I don't think I've explained the problem well enough so that you understand:

1) when I do as you suggest, I end up with a uboot log that I showed above. It tries to boot from MMC by default, and MMC isn't there because the SD card was removed, so it fails with "bad device mmc 1"
    The default_bootcmd is defined in the StarterKit for 2017.2.  There, there is a file project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h that has a "#define CONFIG_EXTRA_ENV_SETTINGS".  I believe this sets the uboot environment variables.

2) If I ignore the fact that the default boot mode is SD, and attempt to boot my linux image anyway, I get an invalid FIT image error:


ZynqMP> sf read ${netstart} 0x1e40000 0x3DC0000
device 0 offset 0x1e40000, size 0x3dc0000
SF: 64749568 bytes @ 0x1e40000 Read: OK
ZynqMP> bootm ${netstart}
## Loading kernel from FIT Image at 10000000 ...
Bad FIT kernel image format!
ERROR: can't get kernel image!


This image was created with:
$ petalinux-package --boot --fsbl Trenz_FSBL.elf  --fpga firmware/trenz_sk/bin/StarterKit.bit --u-boot --force --kernel


The bif file that petalinux-package used is:
$ cat build/bootgen.bif
the_ROM_image:
{
        [fsbl_config] a53_x64
        [bootloader] /tmp/tmp.ZqvZZk2TJM/Trenz_FSBL.elf
        [pmufw_image] /tmp/tmp.ZqvZZk2TJM/pmufw.elf
        [destination_device=pl] /tmp/tmp.ZqvZZk2TJM/StarterKit.bit
        [destination_cpu=a53-0, exception_level=el-3, trustzone] /tmp/tmp.ZqvZZk2TJM/bl31.elf
        [destination_cpu=a53-0, exception_level=el-2] /tmp/tmp.ZqvZZk2TJM/u-boot.elf
        [destination_cpu=a53-0, offset=0x1e40000, partition_owner=uboot] /tmp/tmp.ZqvZZk2TJM/image.ub
}


My petalinux config options are consistent:

    Primary Flash (psu_qspi_0)  ---> 
[*] Advanced Flash Auto Configuration
    *** partition 0 ***               
(boot) name                           
(0x1e00000) size                     
()  flash partition flags             
    *** partition 1 ***               
(bootenv) name                       
(0x40000) size                       
()  flash partition flags             
    *** partition 2 ***               
(kernel) name                         
(0x3DC0000) size                     
()  flash partition flags             
    *** partition 3 ***               
(application) name                   
(0x2400000) size                     
()  flash partition flags             
    *** partition 4 ***               
()  name                             


--- Advanced bootable images storage Settings
       boot image settings  --->             
image storage media (primary flash)  --->
(boot) flash partition name               
(BOOT.BIN) image name                     
   
       u-boot env partition settings  ---> 
image storage media (primary flash)  ---> 
(bootenv) flash partition name             
   
       kernel image settings  --->           
image storage media (primary flash)  ---> 
(kernel) flash partition name             
(image.ub) image name                     
   
       jffs2 rootfs image settings  --->   
image storage media (primary flash)  ---> 
(jffs2) flash partition name               
(rootfs.jffs2) image name                 
       dtb image settings  --->             
image storage media (from boot image)  --->
(system.dtb) image name                   


On Linux, with petalinux 2017.2 I did:

petalinux-config --get-hw-description=firmware/trenz_sk/bin/
petalinux-build
petalinux-package --boot --fsbl Trenz_FSBL.elf  --fpga firmware/trenz_sk/bin/StarterKit.bit --u-boot --force --kernel


Then, I flashed the resulting BOOT.BIN with the 2017.2 SDK on Windows.
I hit the "reset" button on the side of the Thermaltake box.  I wait for it to finish its failed attempt at default booting, and then I try to boot from the QSPI device manually, and get the "bad FIT image" error.

I will now try to verify the image.ub is what it is supposed to be.



Aaron

Regarding the invalid FIT image:  With careful attention to detail and quite a bit of debugging (my kernel image was too big), I was able to create a working bootable image if I type the "sf read" and "bootm" commands manually.

Regarding the "Bad device mmc 1" error:  I can only boot automatically if I comment out the "#define CONFIG_EXTRA_ENV_SETTINGS " line in platform-top.h. 


JH

Hi,
QuoteWith careful attention to detail and quite a bit of debugging (my kernel image was too big),
There was no error message as you has configured flash with this boot.bin, which was to big?

QuoteRegarding the "Bad device mmc 1" error:  I can only boot automatically if I comment out the "#define CONFIG_EXTRA_ENV_SETTINGS " line in platform-top.h.
If SD is not needed, you can also disable on PS IP and generate all files again or check platform-auto.h and disable SD defines with undef.

br
John