mini2440移植uboot 2014.04(五)
代码上传到github上:https://github.com/qiaoyuguo/u-boot-2014.04-mini2440
前几篇博文: 《mini2440移植uboot 2014.04(一)》
(九)修改nand flash代码错误(代码中一些错误修正):
用tftp将uboot加载到mini2440,然后nand erase擦除nand flash,然后再用nand write写入到nand flash后,重新加载uboot,结果又出现了下面的错误(前面已经出现过一次):
Flash: fwc addr cmd f0 00f0 16bit x bit
fwc addr 0000aaaa cmd aa 00aa 16bit x bit
fwc addr cmd 16bit x bit
fwc addr 0000aaaa cmd 16bit x bit
fwc addr cmd f0 00f0 16bit x bit
JEDEC PROBE: ID f0 ffff
fwc addr cmd ff 00ff 16bit x bit
fwc addr cmd 16bit x bit
fwc addr cmd ff 00ff 16bit x bit
JEDEC PROBE: ID ffff
*** failed ***
### ERROR ### Please RESET the board ###
如果将include/configs/mini2440.h中的#define DEBUG注释掉,显示信息如下:
U-Boot 2014.04-gb749c10-dirty (Jun - ::) CPUID:
FCLK: MHz
HCLK: 101.250 MHz
PCLK: 50.625 MHz
DRAM: MiB
WARNING: Caches not enabled
Flash: *** failed ***
### ERROR ### Please RESET the board ###
再次出现了无法检测nor flash的情况.
暂时先将官方uboot烧写到开发板(先擦除整个nand flash,然后烧写官方uboot)。
然后打开三个控制台,一个执行"sudo minicom",另一个执行"openocd -f interface/jlink.cfg -f board/mini2440.cfg",最后一个控制台执行下面内容:
telnet localhost 4444
reset
init_2440
nand probe 0
nand erase 0
nand write 0 /home/host/soft/mini2440/u-boot/u-boot.bin 0
reset
在minicom所在控制台上可以正常显示和进入uboot。
执行nand write命令需要很长时间,下面是执行该命令的输出信息:
wrote file /home/host/soft/mini2440/u-boot/u-boot.bin to NAND flash up to offset 0x00038800 in .817383s (0.320 Ki/s)
231KB的文件足足花了十多分钟,我差点以为telnet命令挂掉了。
修改下面代码(drivers/mtd/nand/s3c2410_nand.c):
#if defined(CONFIG_S3C2440)
if (ctrl & NAND_NCE)
- writel(readl(&nand->nfconf) & ~S3C2410_NFCONT_nFCE,
- &nand->nfconf);
+
+ &nand->nfcont);
else
- writel(readl(&nand->nfconf) | S3C2410_NFCONT_nFCE,
- &nand->nfconf);
+ writel(readl(&nand->nfcont) | S3C2410_NFCONT_nFCE,
+ &nand->nfcont);
} #if defined(CONFIG_S3C2440)
- writel(readl(&nand->nfconf) | S3C2410_NFCONT_INITECC, &nand->nfconf);
+ writel(readl(&nand->nfcont) | S3C2410_NFCONT_INITECC, &nand->nfcont);
#endif
'-'号表示需要删除的代码行,'+'号表示需要添加的代码行。
修改代码后重新编译:
make CROSS_COMPILE=arm-linux-
执行下面命令加载uboot文件:
reset
init_2440
load_image /home/host/soft/mini2440/u-boot-2014.04/u-boot.bin 0x33e80000 bin
resume 0x33e80000
在minicom中得到下面输出信息后就重启系统了:
U-Boot 2014.04-gb749c10-dirty (Jun - ::) U-Boot code: 33E80000 -> 33EFA3D8 BSS: -> 33F48ED0
CPUID:
FCLK: MHz
HCLK: 101.250 MHz
PCLK: 50.625 MHz
monitor len: 000C8ED0
ramsize:
TLB table from 33ff0000 to 33ff4000
Top of RAM usable for U-Boot at: 33ff0000
Reserving 803k for U-Boot at: 33f27000
Reserving 4160k for malloc() at: 33b17000
Reserving Bytes for Board Info at: 33b16fe0
Reserving Bytes for Global Data at: 33b16f40
New Stack Pointer is: 33b16f30
RAM Configuration:
Bank #: MiB
addr=33f27000,_start=33e80000
relocation Offset is: 000a7000
WARNING: Caches not enabled
monitor flash len: 00084CF8
dram_bank_mmu_setup: bank:
Now running in RAM - U-Boot at: 33f27000
将include/configs/mini2440.h中CONFIG_SYS_TEXT_BASE修改为0x33E00000:
#define CONFIG_SYS_TEXT_BASE 0x33E00000
重新编译后,加载到系统中:
reset
init_2440
load_image /home/host/soft/mini2440/u-boot-2014.04/u-boot.bin 0x33e00000 bin
resume 0x33e00000
可以正常进入uboot(输出信息太长了,不再列出)。
在uboot下执行下面命令(需要查看md和nand dump输出内容是否一致):
nand read 0x100
nand dump 0x100
md
查看二者输出可以看到,二者输出信息是一致的(只是md的输出信息使用小端法表示,会有点难以比对)
再执行下面命令:
nand erase 0x100000 0x100000
nand dump 0x100000 0x100
nand write 0 0x100000 0x100
nand dump 0x100000 0x100
两次dump的信息一致,但是都是ff,这说明nand write并没有真正把数据写入到nand flash中。
参考《u-boot移植到mini2440,u-boot版本2008.10 》默认不会对写入进行校验,需要添加CONFIG_MTD_NAND_VERIFY_WRITE才能进行校验
在include/configs/mini2440中添加一行代码:
#define CONFIG_MTD_NAND_VERIFY_WRITE
重新编译uboot,并按照上面步骤载入并进入uboot.
然后执行nand write命令:
MINI2440 # nand write 0x100000 0x100 NAND write: device offset 0x100000, size 0x100
hwcontrol(): 0x70 0x83
hwcontrol(): 0xffffffff 0x81
hwcontrol(): 0x80 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0x00 0x05
hwcontrol(): 0x200 0x05
hwcontrol(): 0x02 0x05
hwcontrol(): 0xffffffff 0x81
hwcontrol(): 0x10 0x83
hwcontrol(): 0xffffffff 0x81
hwcontrol(): 0x70 0x83
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x00 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0x00 0x05
hwcontrol(): 0x200 0x05
hwcontrol(): 0x02 0x05
hwcontrol(): 0xffffffff 0x81
hwcontrol(): 0x30 0x83
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0xffffffff 0x80
NAND write to offset failed -
bytes written: ERROR
nand write执行失败。
修改drivers/mtd/nand/s3c2410_nand.c:
添加一行代码:
ulong IO_ADDR_W = CONFIG_SYS_NAND_BASE;
删除两行代码:
// struct nand_chip *chip = mtd->priv;
// chip->IO_ADDR_W = (void *)IO_ADDR_W; 修改下面一行代码(chip->替换成(void *):
writeb(cmd, chip->IO_ADDR_W);
还有一行代码中ulong需要删除掉:
ulong IO_ADDR_W = (ulong)nand;
然后再次编译、加载、运行uboot,
在uboot下执行下面命令:
md
nand erase 0x100000 0x100
nand write 0x100000 0x100
nand dump 0x100000 0x100
最后一条命令显示信息如下:
hwcontrol(): 0x00 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0x00 0x05
hwcontrol(): 0x200 0x05
hwcontrol(): 0x02 0x05
hwcontrol(): 0xffffffff 0x81
hwcontrol(): 0x30 0x83
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0xffffffff 0x80
Page dump:
f0 ea f0 9f e5 f0 9f e5 f0 9f e5
f0 9f e5 f0 9f e5 f0 9f e5 f0 9f e5
f8 c0 f8 f8 f8
e0 f8 f8 f8 ef be ad de
f8 f8 cc fb 9c b5 ff
de c0 ad 0b de c0 ad 0b 0f e1 1f c0 e3
d3 e3 f0 e1 a0 e3 a0 e3
e5 e0 e3 9f e5 e5
1c 9f e5 1c 9f e5 e5 9f e5
a0 e3 e5 1f ee e3
1f ee a0 e3 7f 2a a0 e3 e2
e5 5b eb c0 4f e2 1f e5
e1 0a f1 a0 e3 a0 e3
e5 3c a0 e3 e5 e3
2c 1a c4 9f e5 f1 a0 e3 e5
4e a0 e3 b8 9f e5 e5 e5
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
.......................
后面还有一些输出信息,都是ff,此处我都将其省略了。
mini2440移植uboot 2014.04(五)的更多相关文章
- mini2440移植uboot 2014.04(六)
上一篇博文:<mini2440移植uboot 2014.04(五)> 代码已经上传到github上:https://github.com/qiaoyuguo/u-boot-2014.04- ...
- mini2440移植uboot 2014.04(四)
我修改的代码已经上传到github上,地址:https://github.com/qiaoyuguo/u-boot-2014.04-mini2440.git 参考文章: <mini2440移植u ...
- mini2440移植uboot 2014.04(三)
我修改的代码已经上传到github上,地址:https://github.com/qiaoyuguo/u-boot-2014.04-mini2440.git 参考文档: s3c2440手册(下载地址) ...
- mini2440移植uboot 2014.04(七)
上一篇博文:<mini2440移植uboot 2014.04(六)> 代码已经上传到github上: https://github.com/qiaoyuguo/u-boot-2014.04 ...
- mini2440移植uboot 2014.04(二)
我修改的代码已经上传到github上,地址:https://github.com/qiaoyuguo/u-boot-2014.04-mini2440.git 参考文章: <u-boot-2011 ...
- mini2440移植uboot 2014.04(一)
最新版的uboot添加了很多新功能,我决定在最新版代码基础上重新移植一遍加深理解. 我修改的代码已经上传到github上,地址:https://github.com/qiaoyuguo/u-boot- ...
- mini2440移植uboot 2011.03(下)
参考博文: <u-boot-2011.03在mini2440/micro2440上的移植> 移植(五)添加nand支持: host@debian:~/soft/mini2440/u-boo ...
- 移植u-boot.2012.04.01
/*************************************************** *u-boot版本:u-boot2012.04.01 *gcc版本:arm-linux-gcc ...
- mini2440移植uboot 2011.03(上)
参考博文: <u-boot-2011.03在mini2440/micro2440上的移植> 本来我想移植最新版的uboot,但是移植却不太成功,所以先模仿他人的例子重新执行一遍,对uboo ...
随机推荐
- JavaScript中对象属性的加入和删除
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- sscanf
#include<stdio.h> 1.sscanf和scanf的不同是输入来源,前者是一个字符串,后者则是标准输入设备 2.sscanf的使用,以解析时间字符串为例,将字符串“2009- ...
- ExtJs学习-搭建开发环境
Extjs是一个非常棒的ajax框架,可以用来开发十分绚丽外观的客户端框架,能使B/S框架更加具有活力.它是一个用javascript编写的框架,与后台技术无关的ajax框架.因此,可以把ExtJs使 ...
- 强大的find命令
find命令确实很强大,自己懒得计,转载一篇: 原文出处:http://roclinux.cn/?p=18 1. 想查看当前文件夹及子文件夹里有没有文件名为“abc”的文件 # find . -nam ...
- day21 os random 序列json
一.random模块 import random # print(random.random()) #0到1之间数 # print(random.uniform(10,20)) #范围内小数 ...
- mysql 高级语法手记
Select字段时: CASE WHEN type=1 THEN 1 ELSE 0 END as type1 sum和count同样可以使用case then 时间戳转时间: FRO ...
- 辛星教你高速掌握PHP的正則表達式
首先说一下,这篇文章也是我在看了数个大牛的博客之后总结出来的,因此首先向这些大牛表示崇高的敬意和感谢,因为人数众多.并且来源也是特别分散,就不一一介绍了,见谅. ************跨语言的主题* ...
- linux用户与组管理
普通用户的管理 用户管理的基本任务包括添加新用户.删除用户.修改用户属性以及对现有用户的访问参数进行设置.与密切 相关的文件包含/etc/passwd./etc/shadow以及/home目录下的文件 ...
- Android自动化测试工具之—UiAutomator环境配置
1.相关软件下载: 1)JDK: 1.6及其以上版本 2)Eclipse 3)Android SDK 其中Eclipse和Android SDK已经被Google打包成ADT(Android Deve ...
- cmd命令 sc
SC 是用于与服务控制管理器和服务进行通信的命令行程序. 用法:sc <server> [command] [service name] <option1> <optio ...