zynq7020画原理图bug

@TOC

0 EN使能信号吗没连接

在这里插入图片描述

1.QSPI flash问题

1.1PS端挂载的DDR3,写入数据读出数据全为0

	说明DDR根本没有工作,所以检查原理图,发现时钟信号有问题

在这里插入图片描述

1.2复位信号应该接一个10k电阻然后接地

在这里插入图片描述

1.2flash加载bin文件后,qspi无法自启动

经过翻看ug585,看到这个需要按照如下复位,才能启动bootrom,所以只能在R63进行手动复位
在这里插入图片描述
在这里插入图片描述

1.3原理图直接画成qspi_flash启动

空的flash第一次固化,可能会遇到bin文件固化不进去
解决办法:用于下载的fsbl加如下代码,生成QSPI启动的bin的fsbl不加
在这里插入图片描述

1.3.2启动模式

在这里插入图片描述

在这里插入图片描述

2.RTL8211E-VL-CG 千兆网口PHY芯片调试

2.1 RTL8211E-VL-CG 千兆网口PHY芯片

先是出现下面的现象:说明网线连接没问题,但是PHY没有正常工作
在这里插入图片描述

在这里插入图片描述

2.2查找到原因:

phy地址按照原理图上是5,但是LWIP下载测试后,显示为1;
后面发现需要对PHYRSTB上电时先拉低,上电后再拉高,phy就可以正常工作。所以在R31接线出来手动复位
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
ping也可以ping通啦!
在这里插入图片描述

3.qspi flash启动

3.1制作qspi flash启动镜像

1.petalinux-config中,增加分区用于存储boot.scr,并且根据qspi flash大小合理划分空间
在这里插入图片描述
下面先全部设置为flash
在这里插入图片描述

在这里插入图片描述

开发板的qspi flash是32MB,因此分给BOOT.BIN的是10MB,给kernel的是15MB,bootscr分给64KB,bootenv我们没用到,但不能删除,删除后编译报错,因此也分给128KB。
注意:这里划分时,要注意最小单位应该是flash芯片的擦除块大小,可以参考uboot中打印的参数,本例程中是64KB。

2,设置boot脚本在flash上的偏移地址:
执行petalinux-conifg -c u-boot,
进入“ARM_architecture”,修改“Boot script offset”值,本例程中是0x1920000(就是bootscr的偏移量)
在这里插入图片描述

3,根据地址设计,更改u-boot加载脚本中的kernel地址及大小
修改文件/project-spec/meta-user/recipes-bsp/u-boot/u-boot-zynq-scr.bbappend
在这里插入图片描述
在这里插入图片描述
只需要根据实际设计更改kernel相关的两个值,

QSPI_KERNEL_OFFSET设置为kernel分区首地址,也就是image.ub文件存放在flash上的偏移地址,本例程中是0xA20000。

QSPI_FIT_IMAGE_SIZE设置为kernel分区分配大小,本例程中是0xF00000。

4,重新执行petalinux-build进行编译,并通过petalinux-package进行打包
最后需要的是3个文件,打包后的固件BOOT.BIN,包括kernel的文件image.ub,以及boot的加载脚本文件boot.scr。

正常的话,将这三个文件分别烧录到qspi flash的boot/kernel/bootscr分区,然后启动模式设置为qspi flash启动即可。

但是这样操作,加载boot.scr文件时,u-boot会报crc校验错误。因此需要下面的重要操作。
5,重要:生成的boot.scr,要手动扩展空间到分区大小,且填入为“0”

objcopy -I binary -O binary --pad-to=0x20000 --gap-fill=0x00 boot.scr bootscr-pad.bin

本例程中分区大小设置为0x20000,因此这里将boot.scr扩展至0x20000。

将新生成的bootscr-pad.bin替代上面的boot.scr,烧入qspi flash的bootscr分区空间,本例程是0x1920000,启动模式设置为qspi flash启动,即可看到系统正常加载了。
在这里插入图片描述

注意如果启动出现乱码:需要添加如下代码在platform-top.h里面
在这里插入图片描述

#define CONFIG_SYS_BOOTM_LEN 0xF000000

/*Required for uartless designs */
#ifndef CONFIG_BAUDRATE
#define CONFIG_BAUDRATE 115200
#ifdef CONFIG_DEBUG_UART
#undef CONFIG_DEBUG_UART
#endif
#endif

执行完前三步后,可以直接petalinux_build ,
然后执行petalinux-package --boot --u-boot --fpga --force
最后如下图建立一个BOOT_PACKAGE.sh文件,执行chomd +x BOOT_PACKAGE.sh(修改文件属性),然后./BOOT_PACKAGE.sh执行该文件,则生成BOOT-ALL.bin文件,拷贝.elf文件和BOOT-ALL.bin文件到物理机,下载即可。
在这里插入图片描述

objcopy -I binary -O binary --pad-to=0xA20000 --gap-fill=0x00 BOOT.BIN BOOT-pad.bin
objcopy -I binary -O binary --pad-to=0xF00000 --gap-fill=0x00 image.ub image-pad.bin
objcopy -I binary -O binary --pad-to=0x20000 --gap-fill=0x00 boot.scr bootscr-pad.bin
cat BOOT-pad.bin image-pad.bin bootscr-pad.bin > BOOT-ALL.bin

原文链接:https://blog.csdn.net/founderHAN/article/details/110523723
有用的参考文章链接:https://forums.xilinx.com/t5/Embedded-Development-Tools/Unable-to-boot-from-QSPI-using-Petalinux-2020-1-Upgrading-from/td-p/1145107

4.通过flash启动后对emmc进行分区

4.1删除emmc里的所有分区,然后重新创建两个分区。

第一个分区是primary分区,FAT32格式。
第二个分区也是primary分区,EXT4格式。

/* 查看emmc设备 */
root@2-emmc:~# ls /dev
...						
mmcblk0             ram13               tty2                tty47               vcsu1
mmcblk0boot0        ram14               tty20               tty48               vga_arbiter
mmcblk0boot1        ram15               tty21               tty49               watchdog
mmcblk0p1           ram2                tty22               tty5                watchdog0
mmcblk0p2           ram3                tty23               tty50               zero

/* 查看emmc当前的分区是否有挂载点  */
root@2-emmc:~# mount               
rootfs on / type rootfs (rw,size=503156k,nr_inodes=125789)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=503156k,nr_inodes=125789,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
/dev/mmcblk0p2 on /run/media/mmcblk0p2 type ext4 (rw,relatime)		//第一个分区有挂载点
/dev/mmcblk0p1 on /run/media/mmcblk0p1 type vfat (rw,relatime,gid=6,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)	//第二个分区也有挂载点
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)

/* 如果有挂载点需要先取消挂载,否则重新分区会出问题 */
root@2-emmc:~# umount /dev/mmcblk0p1 	
root@2-emmc:~# umount /dev/mmcblk0p2

/* 对emmc进行重新分区 */
root@2-emmc:~# fdisk /dev/mmcblk0

The number of cylinders for this disk is set to 1942528.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p
Disk /dev/mmcblk0: 59 GB, 63652757504 bytes, 124321792 sectors
1942528 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    0,1,1       1023,3,16           16    2097167    2097152 1024M 83 Linux
/dev/mmcblk0p2    1023,3,16   1023,3,16      2097168  123731983  121634816 58.0G  5 Extended

Command (m for help): d
Partition number (1-5): 1

Command (m for help): d
Selected partition 2

Command (m for help): p
Disk /dev/mmcblk0: 59 GB, 63652757504 bytes, 124321792 sectors
1942528 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type

Command (m for help): n
Partition type
  p   primary partition (1-4)
  e   extended
p
Partition number (1-4): 1
First sector (16-124321791, default 16): 
Using default value 16
Last sector or +size{
   ,K,M,G,T} (16-124321791, default 124321791): +1G	//主分区1G,用来存放image.ub

Command (m for help): n
Partition type
  p   primary partition (1-4)
  e   extended
e
Partition number (1-4): 2
First sector (2097168-124321791, default 2097168): 
Using default value 2097168
Last sector or +size{
   ,K,M,G,T} (2097168-124321791, default 124321791)://剩下的所有空间都给扩展分区,用来做文件系统 
Using default value 124321791

Command (m for help): p
Disk /dev/mmcblk0: 59 GB, 63652757504 bytes, 124321792 sectors
1942528 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    0,1,1       1023,3,16           16    2097167    2097152 1024M 83 Linux
/dev/mmcblk0p2    1023,3,16   1023,3,16      2097168  124321791  122224624 58.2G  5 Extended

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
mmcblk0: p1 p2 < >
mmcblk0: p1 p2 < >
root@2-emmc:~# 

4.2格式化分区

root@2-emmc:~# mkfs.vfat /dev/mmcblk0p1 
root@2-emmc:~# mkfs.ext4 /dev/mmcblk0p2 
mke2fs 1.44.3 (10-July-2018)
Found a dos partition table in /dev/mmcblk0p2
Proceed anyway? (y,N) y
64-bit filesystem support is not enabled.  The larger fields afforded by this feature enable full-strength checksumming.  Pass -O 64bit to rectify.
Discarding device blocks: done                            
Creating filesystem with 10485760 4k blocks and 2621440 inodes
Filesystem UUID: 81ea86ef-96b6-4e39-8b52-78940a5ef335
Superblock backups stored on blocks: 
       32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
       4096000, 7962624

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done   

如果没有mkfs.ext4命令,参照原文博客https://blog.csdn.net/tianyake_1/article/details/119387155

在这里插入图片描述
开始配置后,我去进行分区发现还是不行,原因是第二个分区的文件属性是extended;要在这个分区上继续创建logic分区才可以格式化,类似于下面的操作
在这里插入图片描述
原文链接:https://www.cnblogs.com/kerrycode/p/4423753.html

[root@GETTestLNX06 ~]# fdisk /dev
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 
Command (m for help): p
 
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       13054   104856223+   5  Extended
 
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-13054, default 1): 1
Last cylinder, +cylinders or +size{
   K,M,G} (1-13054, default 13054): 
Using default value 13054
 
Command (m for help): p
 
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd61351c9
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       13054   104856223+   5  Extended
/dev/sdb5               1       13054   104856192   83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

最后,挂载两个分区
root@2-emmc:~# cd /mnt/
root@2-emmc:/mnt# mkdir mmcp1
root@2-emmc:/mnt# mkdir mmcp5
root@2-emmc:/mnt# mount /dev/mmcblk0p1 /mnt/mmcp1/
root@2-emmc:/mnt# mount /dev/mmcblk0p5 /mnt/mmcp5/

5.zynq7020从emmc启动,使用ext4文件系统

用petalinux编译一个uboot 内核都放在sd卡、文件系统设为ext4的操作系统 然后先用qspi启动的系统挂载nfs 把新做的系统镜像复制到fat32分区 把文件系统解压同步到ext4分区

5.1硬件配置及代码存放说明

QSPI连接一个16MB的Flash
SD1接口接emmc
将zynq_fsbl.elf+fpga.bit +u-boot.elf组成的BOOT.BIN放在QSPI flash中
将emmc分成两个区,第一个区FAT32格式,用来存放iamge.ub。第二个区ext4格式,用来存放文件系统。
在这里插入图片描述

boot image settings ---> image storage media 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值