• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : nand_write: Attempt to write not page aligned data 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 7800
精华: 0
发帖: 49
金钱: 490 两
威望: 257 点
贡献值: 0 点
综合积分: 98 分
注册时间: 2009-07-29
最后登录: 2017-09-13
楼主  发表于: 2009-10-22 11:51

 nand_write: Attempt to write not page aligned data

管理提醒: 本帖被 qq2440 从 Linux技术交流专区 移动到本区(2010-02-08)
小弟在mini2440上移植了nand 启动(nand 型号K9F1G08U0B) ,现在使用nand write 命令出错,还请高手指教!!
出错信息:
[mini2440]# tftp 30800000 ramdisk.gz
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
TFTP from server 192.168.9.101; our IP address is 192.168.9.100
Filename 'ramdisk.gz'.
Load address: 0x30800000
Loading: T #######################################
done
Bytes transferred = 564557 (89d4d hex)
[mini2440]# nand write 30008000 400000 89d4d
NAND write: device 0 offset 0x400000, size 0x89d4d
Skip bad block 0x00400000
nand_write: Attempt to write not page aligned data
NAND write to offset 4a0000 failed -22
524288 bytes written: ERROR
好像应该修改 nand_base.c中的nand_write函数,但是具体怎么修改呢?好像是没有对齐数据,网上说是分区要128K对齐,但是uboot的分区信息在哪里修改?我是在内核修改的,所以好像烧写也与uboot分区也无关吧?我仅仅是写入指定偏移的数据,只要指定的偏移满足128k对齐就行了吧?我这个地址400000是对齐的啊,大家帮帮忙吧。或者谁做过联系我QQ:168244380 万分感谢!
[ 此帖被linuxway在2009-10-23 14:45重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-10-22 12:49
不只是分区要128K对齐,写入NAND Flash的数据的offset和size也必须是2K对齐的(128M NAND Flash的一个页面大小)。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2009-10-22 17:48
基本上你不用担心mkyaffs2image生成的image,它会自己处理对齐问题。你要注意的是那些没有“NAND Flash概念”的数据,比如booltoader镜像,内核镜像和initramfs镜像。这些数据的大小必须手动调整使之符合2K对齐的标准。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2009-10-23 14:41

 Re:128M nand flash(型号:K9F1G08U0B)write 问题:nand_write: Attempt to write not page aligned ..

引用第5楼linuxway于2009-10-23 14:40发表的 Re:128M nand flash(型号:K9F1G08U0B)write 问题:nand_write: Attempt to write not page aligned .. :
谢谢 kasim nand write的问题解决了,但是我现在用nand write.yaffs出现问题!要怎么修改呢?

至少你也得告诉我你遇到什么问题了吧
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2009-10-23 15:33
复制代码
  1. if (((*length)%(nand->oobsize+nand->writesize)) != 0) {
  2.     printf ("Attempt to write error length data!\n");
  3.     return -EINVAL;
  4. }

这段代码不需要修改,对于128M的NAND Flash来说,nand->oobsize = 64,nand->writesize = 2048,如果不是,去检查NAND Flash部分驱动的初始化流程。
记住yaffs镜像是包含OOB数据的,所以写入NAND Flash的数据应该是2112(=2048 + 64)字节的整数倍。
另外,从你提供的信息看,yaffs文件系统的镜像长度是1599312字节,并不是2112的整数倍,我想你最好用mkyaffs2image工具(http://www.arm123.com.cn/linux/mkyaffs2image.tgz)重新制作文件系统镜像再下载。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2009-10-23 15:54
引用第10楼linuxway于2009-10-23 15:41发表的  :
明白了,那我nand write.yaffs 30008000 offset filesize 这个filesize大小就按照我下载的大小写就行了?因为用mkyaffs2制作的必定是2112对齐的?

是的
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-10-23 16:02
引用第11楼linuxway于2009-10-23 15:50发表的  :
换了版主提供的mkyaffs2image 制作出来大小还是1599312,怎么回事?
但是1159312是2048的整数倍哦!

那我就不知道了,我用root_qtopia.tgz制作出来的yaffs2 image是38130048,2112字节的整数倍
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
7楼  发表于: 2009-10-23 16:21

 回 14楼(linuxway) 的帖子

不需要,你可以试试用http://www.arm123.com.cn/linux/root_qtopia.tgz,解压开来之后再用mkyaffs2image做成镜像。注意解压和制作镜像需要root权限,否则文件系统里的一些特殊文件比如设备节点可能会损坏。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2009-10-23 17:16

 回 18楼(linuxway) 的帖子

你换台电脑吧,我做出来的镜像是38M
至于为什么crash, 我没有你的源代码,不清楚具体crash在什么地方,只能靠你自己查了
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
9楼  发表于: 2009-10-24 21:42

 回 20楼(linuxway) 的帖子

如果不会用Jtag调试的话,printf()是最简单的方法
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go