Zynq ZC702平台 QSPI + eMMC实现

Posted Kevin_HeYongyuan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zynq ZC702平台 QSPI + eMMC实现相关的知识,希望对你有一定的参考价值。

预备知识:

UG821

The processor system boot is a two-stage process:

• Another boot mode supported through FSBL is eMMC boot mode. 
This boot mode is possible only when the primary boot mode (set through the boot mode pins) is QSPI. This is used when you have a small QSPI flash and would like to store all the other partitions on a larger flash memory like eMMC.
In this case, place the FSBL on the QSPI flash, and all the other partitions on eMMC flash.

 

指导步骤:

To enable and use this boot mode:
1. Create a BSP with the library and set enable_mmc in the SDK options. For more details, see the library documentation. 
2. Enable the MMC_SUPPORT flag through SDK and build FSBL. The FSBL image build (fsbl.elf) now has eMMC support.
3. Stitch the boot image with FSBL as the only partition (using Bootgen). 
4. Place the boot image in the QSPI flash.
5. Stitch an image (using Bootgen) with all the other required partitions (like the bitstream or the U-Boot) and place it in the eMMC.
6. Set the boot mode to QSPI.
7. Power cycle the board.

 

具体实现:

Step1. Create a BSP with the library and set enable_mmc in the SDK options. For more details, see the library documentation. 

--建立FSBL,点击 Modify this BSP\'s Settings --> Supported Libaries中选中xilffs

--xilffs的pdf见《UG1032》

 

 

Step2:Enable the MMC_SUPPORT flag through SDK and build FSBL. The FSBL image build (fsbl.elf) now has eMMC support.

 --FSBL工程,右键,弹出菜单中选中 C/C++ Building Settings 添加 -DMMC_SUPPORT

 

Step3.  Stitch the boot image with FSBL as the only partition (using Bootgen). 

--SDK下用Bootgen只添加FSBL,生成BOOT.BIN,

 

Step4. Place the boot image in the QSPI flash.

--通过JTAG烧录step3中生产的BOOT.BIN文件到QSPI中

 

Step5. Stitch an image (using Bootgen) with all the other required partitions (like the bitstream or the U-Boot) and place it in the eMMC.

--SDK下用Bootgen添加bitstream or the U-Boot,生成BOOT.BIN, 这个文件要拷贝到eMMC中

 

Step6. 拷贝step5生产的BOOT.bin,以及uImage,devicetree,ramdisk到SD中,启动

--由于ZC702没有eMMC,用SD代理,原理一样,

--量产时eMMC用烧录器烧写

 

以下是log

U-Boot 2016.07 (Dec 12 2016 - 23:04:43 -0700)

Model: Zynq ZC702 Development Board
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
MMC:   sdhci@e0100000: 0
SF: Detected N25Q128A with page size 256 Bytes, erase size 64 KiB, total 16 MiB
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Zynq ZC702 Development Board
Board: Xilinx Zynq
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit any key to stop autoboot:  0 
Copying Linux from QSPI flash to RAM...
SF: Detected N25Q128A with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x500000
SF: 5242880 bytes @ 0x100000 Read: OK
device 0 offset 0x600000, size 0x20000
SF: 131072 bytes @ 0x600000 Read: OK
Copying ramdisk...
device 0 offset 0x620000, size 0x8f0000
SF: 9371648 bytes @ 0x620000 Read: OK
## Booting kernel from Legacy Image at 02080000 ...
   Image Name:   Linux-4.9.0-xilinx
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3756496 Bytes = 3.6 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 04000000 ...
   Image Name:   petalinux-minimal-zc702-zynq7-20
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    8487267 Bytes = 8.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Loading Kernel Image ... OK
   Loading Ramdisk to 1f7e7000, end 1ffff163 ... OK
   Loading Device Tree to 1f7e0000, end 1f7e694e ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.9.0-xilinx (root@localhost.localdomain) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #3 SMP PREEMPT Fri Aug 25 07:42:38 HKT 2017
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt:Machine model: Zynq ZC702 Development Board
cma: Reserved 16 MiB at 0x3f000000
Memory policy: Data cache writealloc
percpu: Embedded 14 pages/cpu @ef7ce000 s25984 r8192 d23168 u57344
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260608
Kernel command line: 
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1005028K/1048576K available (6144K kernel code, 201K rwdata, 1448K rodata, 1024K init, 230K bss, 27164K reserved, 16384K cma-reserved, 245760K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0700000   (7136 kB)
      .init : 0xc0900000 - 0xc0a00000   (1024 kB)
      .data : 0xc0a00000 - 0xc0a32680   ( 202 kB)
       .bss : 0xc0a32680 - 0xc0a6c09c   ( 231 kB)
Preemptible hierarchical RCU implementation.
        Build-time adjustment of leaf fanout to 32.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
efuse mapped to f0800000
slcr mapped to f0802000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at f0802100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at f080a000, irq=17
Console: colour dummy device 80x30
console [tty0] enabled
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100058
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor menu
zynq-gpio e000a000.gpio: could not find pctldev for node /amba/slcr@f8000000/pinctrl@700/gpio0-default, deferring probe
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: can\'t request region for resource [mem 0xfffc0000-0xffffffff]
zynq-ocm: probe of f800c000.ocmc failed with error -16
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
FPGA manager framework
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 8292K (df7e7000 - e0000000)
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=30 max_order=18 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac:        DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 27, base_baud = 3125000) is a xuartps
console [ttyPS0] enabled
[drm] Initialized
brd: module loaded
loop: module loaded
libphy: Fixed MDIO Bus: probed
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 29 (00:0a:35:00:01:22)
Marvell 88E1116R e000b000.etherne:07: attached PHY driver [Marvell 88E1116R] (mii_bus:phy_addr=e000b000.etherne:07, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 \'Enhanced\' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
e0002000.usb supply vbus not found, using dummy regulator
ULPI transceiver vendor/product ID 0x0424/0x0007
Found SMSC USB3320 ULPI transceiver.
ULPI integrity check: passed.
ci_hdrc ci_hdrc.0: EHCI Host Controller
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 24
si570 1-005d: registered, current frequency 148500000 Hz
i2c i2c-0: Added multiplexed i2c bus 1
i2c i2c-0: Added multiplexed i2c bus 2
at24 3-0054: 1024 byte 24c08 EEPROM, writable, 1 bytes/write
i2c i2c-0: Added multiplexed i2c bus 3
i2c i2c-0: Added multiplexed i2c bus 4
rtc rtc0: invalid alarm value: 2017-10-12 44:23:0
rtc-pcf8563 5-0051: rtc core: registered rtc-pcf8563 as rtc0
i2c i2c-0: Added multiplexed i2c bus 5
i2c i2c-0: Added multiplexed i2c bus 6
i2c i2c-0: Added multiplexed i2c bus 7
i2c i2c-0: Added multiplexed i2c bus 8
pca954x 0-0074: registered 8 multiplexed busses for I2C switch pca9548
ucd9200 8-0034: Device ID UCD9248-80|5.8.0.11400|091112
ucd9200 8-0034: 4 rails configured
random: fast init done
ucd9200 8-0035: Device ID UCD9248-80|5.8.0.11400|091112
ucd9200 8-0035: 4 rails configured
ucd9200 8-0036: Device ID UCD9248-80|5.8.0.11400|091112
ucd9200 8-0036: 2 rails configured
EDAC MC: ECC not enabled
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using DMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
NET: Registered protocol family 10
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20161123 t)
can: netlink gateway (rev 20130117) max_hops=1
zynq_pm_remap_ocm: OCM pool is not available
zynq_pm_suspend_init: Unable to map OCM.
Registering SWP/SWPB emulation handler
input: gpio-keys as /devices/soc0/gpio-keys/input/input0
rtc-pcf8563 5-0051: setting system clock to 2017-09-15 14:39:34 UTC (1505486374)
of_cfs_init
of_cfs_init: OK
ALSA device list:
  No soundcards found.
mmc0: new high speed SDHC card at address aaaa
Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
INIT: mmcblk0: mmc0:aaaa SS08G 7.40 GiB 
 mmcblk0: p1 p2
version 2.88 booting
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.24.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
done.
Starting Dropbear SSH server: Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMRmjIu3qRM1Viv6emSII3Cq7VPJ3Apf7KZvONpPDnS0GBqBPRaK8j0is1dG/U4kKB18M8+znGCaTfMvcQVkpRYsGw/HGRAnYIB1bMyzSFKRKCbNLYK+RtAcwZKg7NT9HqwSjAn0D5ovUtIL6mEAxjEGJHwTjPFZlW62SX6vyEuQE8WCtH99HrErVAhhvEwZ0N6kl0H8XbfdXnMBRXGpbLxgstZpn8hnj1NsbSoi1rBZp1bRau1Hp+g8q9LSA4Side8wu/ow40dE/O6OJPCQFHbiODCGS+p9538PIF0g9f8yGRhqMLmlWYyLKLMlRg09NXX7UxR14LpV0OXU6g5JRl root@zc702-zynq7
Fingerprint: md5 63:7c:dd:d5:af:05:b4:37:ba:ee:16:01:ab:26:4e:ee
dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: OK

PetaLinux 2016.4 zc702-zynq7 /dev/ttyPS0

zc702-zynq7 login: root
root@zc702-zynq7:~# pwd
/home/root
root@zc702-zynq7:~#

 

End

 

以上是关于Zynq ZC702平台 QSPI + eMMC实现的主要内容,如果未能解决你的问题,请参考以下文章

linux编译u-boot时显示[arch/arm/dts/zynq-zc702.dtb]错误?

ZynqMP升级方案Qspi+emmc

zynq运行操作系统之linux kernel编译

大于16MB的QSPI存放程序引起的ZYNQ重启风险

Zynq系列FPGA如何固化bit文件到QSPI_Flash

zynq中uboot的qspi启动报错及解决办法