开发环境

Vivado 2018.2

Petalinux 2018.2

问题描述

当同时激活 SD0 (对应SD卡座) 和 SD1 (对应板载 emmc) 时,当从 emmc 启动,报如下错误,

U-Boot 2018.01 (Apr 14 2020 - 10:49:36 +0800) Xilinx Zynq ZC702

Board: Xilinx Zynq
Silicon: v3.1
DRAM:  ECC disabled 1 GiB
MMC:   Card did not respond to voltage select!
mmc_init: -95, time 23
sdhci@e0100000 - probe failed: -95
sdhci_transfer_data: Error detected in status(0x208000)!
Card did not respond to voltage select!
mmc_init: -95, time 23

SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environment

In:    serial@e0000000
Out:   serial@e0000000
Err:   serial@e0000000
Board: Xilinx Zynq
Silicon: v3.1
Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
U-BOOT for drive_usb_qspi_sd_ethernet_with_boot_from_emmc

ethernet@e000b000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Hit any key to stop autoboot:  4  3  2  1  0 
no mmc device at slot 0
Zynq> 

解决方法

root cause: 配置 Primary SD 为 SD1 后,对应到更改没有更新到 u-boot 中去。

打开 <petalinux-project-path>/project-spec/meta-plnx-generated/recipes-bsp/u-boot/configs 下的文件 platform-auto.h,有如下宏,

... 
	"netboot=tftpboot ${netstart} ${kernel_img} && bootm"  
	"default_bootcmd=run uenvboot; run cp_kernel2ram && bootm ${netstart}"  
""

/* BOOTCOMMAND */
#define CONFIG_BOOTCOMMAND	"run default_bootcmd"

#endif /* __PLNX_CONFIG_H */

打开 <petalinux-project-path>/project-spec/meta-user/recipes-bsp/u-boot/files 下到文件 platform-top.h,添加如下内容 (对上述宏作一个重置),

/*************************************************************************************************************************************/
/* fix SD0 is sd card, SD1 is emmc, if no card insert into SD0 slot, zynq cannot detect SD1 emmc. (Vivado 2018.2 + Petalinux 2018.2) */
/*************************************************************************************************************************************/
#ifdef CONFIG_BOOTCOMMAND
#undef CONFIG_BOOTCOMMAND
#define CONFIG_BOOTCOMMAND "mmc dev ${sdbootdev}; run default_bootcmd"
#endif
/*************************************************************************************************************************************/

重新编译工程即可。

参考文件

https://www.xilinx.com/support/answers/69780.html?tdsourcetag=s_pcqq_aiomsg

https://forums.xilinx.com/t5/Embedded-Linux/BOOting-image-ub-from-eMMC/m-p/979363/highlight/false

完。