PetaLinux学习笔记 3
过年回家没带开发板。终于可以搞一搞了。更新petaLinux到2019.2。重建项目,flash调整一下。启动过程中提示:
m25p80 spi0.0: found w25q256, expected n25q512a
m25p80 spi0.0: failed to read ear reg
m25p80 spi0.0: w25q256 (32768 Kbytes)
主要是flash的型号不正确。全局搜索n25q512a
,上次的2018版本可以定位到build/tmp/work-shared/plnx-zynq7/kernel-source/drivers/mtd/spi-nor/spi-nor.c
,这次居然找不到这个路径了。当时怎么操作的没有记录,找来找去,需要在这里开启:
petalinux-config
# → Linux Components Selection → linux-kernel(remote)
# → Linux Components Selection → Remote linux-kernel settings ---> Remote linux-kernel git URL (https://github.com/Xilinx/linux-xlnx)
# → Linux Components Selection → Remote linux-kernel settings ---> Remote linux-kernel git TAG/Commit ID (xlnx_rebase_v4.19)
petalinux-build
编译过程中会自动下载内核代码。
现在就可以看到文件了,这回使用了VS CODE,将build文件夹直接隐藏掉。源代码直接可以从components
里找到。上次找偏了。这次在components/plnx_workspace/sources/linux-xlnx/drivers/mtd/spi-nor/spi-nor.c
这个里面有很多FLASH。找到w25q256
:
1661: { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
看看INFO,计算一下
{name: "w25q256",id: {0xef, 0x40, 0x19, 0, 0},id_len: 3,sector_size: 65536,n_sectors: 512,page_size: 256,flags: SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ
},
写到设备树里:
&flash0 {compatible = "w25q256";
};
另一个"micron,m25p80"在文章开头有说明,这个s个文件是基于m25p80所写的。删了编译一下。
m25p80 spi0.0: failed to read ear reg
m25p80 spi0.0: w25q256 (32768 Kbytes)
还有一个failed。这个ear reg的警告在 spi-nor.c
的函数spi_nor_scan
中。前面有这么一段代码:
3453: dev_warn(dev, "found %s, expected %s\n",
3454: jinfo->name, info->name);
就是一开始的那个警告。已经解决了。回到正题
3664: int status;
3665:
3666: nor->addr_width = 3;
3667: set_4byte(nor, info, 0);
3668: status = read_ear(nor, info);
3669: if (status < 0)
3670: => dev_warn(dev, "failed to read ear reg\n");
3671: else
3672: nor->curbank = status & EAR_SEGMENT_MASK;
前面设置了addr_width
为3,这个是寻址宽度,3个字节。应该是16M
,而这个芯片是32M
的。
看看手册吧。
有个3bit和4bit寻址模式。4bit可以支持到512M。
使用13h
和 0Ch
来设置 4bit 和 3bit模式。一头雾水。
在这里找到一些东西:使用四字节命令读写256Mb QSPI Flash
在手册 ug821-zynq-7000-swdev.pdf
中也能找到这样一段内容:
This QSPI boot mode is for x4 mode. The BootROM searches the first 256 Mb in x8 mode. In QSPI boot mode (where the QSPI device is >128Mb), to use MultiBoot, place the multiple images in such a way that they fit in memory locations less than 128Mb. To effect this mode, the images should have only (FSBL+U-Boot) to fit in the <128Mb memory. Then, the rest of the partitions, possibly residing in a portion of memory that is >128Mb, must be handled by U-Boot. In this case, update the zynq_common.h file to add the commands to load the required partitions. You can find further details on the usage, along with an example, in the Xilinx Zynq-7000 AP SoC Solution Center。
直接找到QSPI的控制器说明上。在手册 ug585-Zynq-7000-TRM.pdf
中:
16 MB addressing per device (32 MB for two devices)
这里就是更本原因了。所以说,为什么ZYNQ就不支持4bit呢。。。。
继续往下看。有点意思,这个函数里面有个注释是专门针对这块FLASH的。
/* Enable/disable 4-byte addressing mode. */
static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,int enable)
{int status;bool need_wren = false;u8 cmd;switch (JEDEC_MFR(info)) {case SNOR_MFR_ST:case SNOR_MFR_MICRON:/* Some Micron need WREN command; all will accept it */need_wren = true;case SNOR_MFR_MACRONIX:case SNOR_MFR_WINBOND:if (need_wren) // <= need_wren : falsewrite_enable(nor);cmd = enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B; // <= enable : 0; cmd = SPINOR_OP_EX4Bstatus = nor->write_reg(nor, cmd, NULL, 0); // SPINOR_OP_EX4B: 退出4BIT模式if (need_wren) // <= need_wren : falsewrite_disable(nor);if (!status && !enable &&JEDEC_MFR(info) == SNOR_MFR_WINBOND) { // <= if(true)/** On Winbond W25Q256FV, leaving 4byte mode causes* the Extended Address Register to be set to 1, so all* 3-byte-address reads come from the second 16M.* We must clear the register to enable normal behavior.*/write_enable(nor);nor->cmd_buf[0] = 0;nor->write_reg(nor, SPINOR_OP_WREAR, nor->cmd_buf, 1);write_disable(nor);}return status;default:/* Spansion style */nor->cmd_buf[0] = enable << 7;return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1);}
}
看起来就是将FLASH设置为了3bit模式。下一段:
/*** read_ear - Get the extended/bank address register value* @nor: Pointer to the flash control structure** This routine reads the Extended/bank address register value** Return: Negative if error occured.*/
static int read_ear(struct spi_nor *nor, struct flash_info *info)
{int ret;u8 val;u8 code;/* This is actually Spansion */if (JEDEC_MFR(info) == CFI_MFR_AMD)code = SPINOR_OP_BRRD;/* This is actually Micron */else if (JEDEC_MFR(info) == CFI_MFR_ST ||JEDEC_MFR(info) == CFI_MFR_MACRONIX ||JEDEC_MFR(info) == SNOR_MFR_ISSI)code = SPINOR_OP_RDEAR;elsereturn -EINVAL;ret = nor->read_reg(nor, code, &val, 1);if (ret < 0)return ret;return val;
}
这里面没有支持WINBOND,给他添加上,这里是要读设置BANK的寄存器。这个指令在手册上有说明,不知为何这里不支持。后面的定义SPINOR_OP_RDEAR
就是C8h
,修改一下。
- JEDEC_MFR(info) == SNOR_MFR_ISSI)
+ JEDEC_MFR(info) == SNOR_MFR_ISSI ||
+ JEDEC_MFR(info) == SNOR_MFR_WINBOND)
再编译一次,跑一下。
root@ax7021:/dev# dmesg | grep spi
m25p80 spi0.0: w25q256 (32768 Kbytes)
4 fixed-partitions partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
OK,SPI-FLASH这边就没有问题了。
中间还有这样的一个报错:
[INFO] building project
[INFO] sourcing bitbake
ERROR: Failed to source bitbake
ERROR: Failed to build project
不管使用任何petalinux的命令都是这样。
查看日志:/home/godenfreemans/FTP_Folder/project_1/project_1.petalinux/build/build.log
,发现这么一段:
ERROR: No space left on device or exceeds fs.inotify.max_user_watches?
ERROR: To check max_user_watches: sysctl -n fs.inotify.max_user_watches.
ERROR: To check max_user_watches: sysctl -n fs.inotify.max_user_watches.
ERROR: To modify max_user_watches: sysctl -n -w fs.inotify.max_user_watches=<value>.
ERROR: To modify max_user_watches: sysctl -n -w fs.inotify.max_user_watches=<value>.
ERROR: Root privilege is required to modify max_user_watches.
ERROR: Root privilege is required to modify max_user_watches.
按照操作执行后得到8192,这个东西感觉像是文件的监视器??一个用户可以同时监视(比方说打开)的文件数量。
使用下面的命令把它改大一点,128000,然后就可以正常编译了。
PetaLinux学习笔记 3相关推荐
- PetaLinux学习笔记 2
现在遇到这样一个问题,没有USB,甚至于USB都没有电压输出,检查电路,USB供电是由一个TPS2051BDBV来控制的,这个芯片又是USB3320C来控制的,说明这个芯片没有工作.经过一天的排查,最 ...
- 5、赛灵思-Zynq UltraScale+ MPSoC学习笔记:Petalinux 的设计流程及定制Linux系统
5.赛灵思-Zynq UltraScale+ MPSoC学习笔记:Petalinux 的设计流程及定制Linux系统 声明:本文是学习赛灵思 Zynq UltraScale+ MPSoC 5EV过程中 ...
- PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 call
您的位置 首页 PyTorch 学习笔记系列 PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 发布: 2017年8月4日 7,195阅读 ...
- 容器云原生DevOps学习笔记——第三期:从零搭建CI/CD系统标准化交付流程
暑期实习期间,所在的技术中台-效能研发团队规划设计并结合公司开源协同实现符合DevOps理念的研发工具平台,实现研发过程自动化.标准化: 实习期间对DevOps的理解一直懵懵懂懂,最近观看了阿里专家带 ...
- 容器云原生DevOps学习笔记——第二期:如何快速高质量的应用容器化迁移
暑期实习期间,所在的技术中台-效能研发团队规划设计并结合公司开源协同实现符合DevOps理念的研发工具平台,实现研发过程自动化.标准化: 实习期间对DevOps的理解一直懵懵懂懂,最近观看了阿里专家带 ...
- 2020年Yann Lecun深度学习笔记(下)
2020年Yann Lecun深度学习笔记(下)
- 2020年Yann Lecun深度学习笔记(上)
2020年Yann Lecun深度学习笔记(上)
- 知识图谱学习笔记(1)
知识图谱学习笔记第一部分,包含RDF介绍,以及Jena RDF API使用 知识图谱的基石:RDF RDF(Resource Description Framework),即资源描述框架,其本质是一个 ...
- 计算机基础知识第十讲,计算机文化基础(第十讲)学习笔记
计算机文化基础(第十讲)学习笔记 采样和量化PictureElement Pixel(像素)(链接: 采样的实质就是要用多少点(这个点我们叫像素)来描述一张图像,比如,一幅420x570的图像,就表示 ...
- Go 学习推荐 —(Go by example 中文版、Go 构建 Web 应用、Go 学习笔记、Golang常见错误、Go 语言四十二章经、Go 语言高级编程)
Go by example 中文版 Go 构建 Web 应用 Go 学习笔记:无痕 Go 标准库中文文档 Golang开发新手常犯的50个错误 50 Shades of Go: Traps, Gotc ...
最新文章
- fileinput_open_读写文件_python
- php内核探索方法与资源
- 7-57 又来一个上三角数字三角形 (10 分)
- 习题6-6 使用函数输出一个整数的逆序数 (20 分)
- java queue源码_Java高并发系列之ArrayBlockingQueue源码解析
- Windows监听进程是否退出C++
- AfxMessageBox
- L1-062 幸运彩票 (15 分)
- leetcode 448. 找到所有数组中消失的数字(Find All Numbers Disappeared in an Array)
- 关于STL allocator
- jmeter笔记02
- 常用的NoSQL数据库
- 个人选择黑苹果配置--中端机
- android脚本录制脚本,Android 屏幕录制GIF脚本
- arcgis地理空间数据库学习记录01-复制地理数据库
- 第九章----java数据类型和字符串处理
- oracle rman crosscheck,rman的crosscheck命令
- 校验日期+时间部分的常用方法
- java高并发编程--03--线程间通信
- 国外大神数据,全球主板厂商信息汇总,A B X系在主板汇总