一、支持NAND FLASH读写
修改配置文件include\configs\tq2440.h打开之前注释掉的NAND相关的宏
#defineCONFIG_CMD_NAND
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET0x40000
#define CONFIG_ENV_SIZE 0x20000
编译出错
iteral-Wno-format-security -os3c2410_nand.o s3c2410_nand.c -c
s3c2410_nand.c: In function's3c2410_hwcontrol':
s3c2410_nand.c:57: warning:implicit declaration of function 's3c2410_get_base_nand'
s3c2410_nand.c:57: warning:initialization makes pointer from integer without a cast
s3c2410_nand.c:72: error:dereferencing pointer to incomplete type
s3c2410_nand.c:72: error:dereferencing pointer to incomplete type
s3c2410_nand.c:75: error:dereferencing pointer to incomplete type
s3c2410_nand.c:75: error:dereferencing pointer to incomplete type
s3c2410_nand.c: In function's3c2410_dev_ready':
s3c2410_nand.c:85: warning:initialization makes pointer from integer without a cast
s3c2410_nand.c:87: error:dereferencing pointer to incomplete type
s3c2410_nand.c: In function'board_nand_init':
s3c2410_nand.c:129: warning:initialization makes pointer from integer without a cast
s3c2410_nand.c:150: error:dereferencing pointer to incomplete type
s3c2410_nand.c:153: error:dereferencing pointer to incomplete type
s3c2410_nand.c:154: error:dereferencing pointer to incomplete type
make[1]: ***[s3c2410_nand.o] Error 1
make[1]: Leaving directory`/home/work/u-boot-2012.04.01/drivers/mtd/nand'
make: ***[drivers/mtd/nand/libnand.o] Error 2
将drivers/mtd/nand/s3c2410_nand.c拷贝为drivers/mtd/nand/s3c2440_nand.c
root@zjh:/home/work/u-boot-2012.04.01#cp drivers/mtd/nand/s3c2410_nand.c drivers/mtd/nand/s3c2440_nand.c
在drivers/mtd/nand/Makefile文件中增加一行
COBJS-$(CONFIG_NAND_S3C2440)+= s3c2440_nand.o
将s3c2440_nand.c中所有的2410替换为2440
修改配置文件include\configs\tq2440.h
#define CONFIG_NAND_S3C2440
#define CONFIG_SYS_S3C2440_NAND_HWECC
修改drivers\mtd\nand\s3c2440_nand.c中的board_nand_init()函数
#ifdefined(CONFIG_S3C24XX_CUSTOM_NAND_TIMING)
tacls =CONFIG_S3C24XX_TACLS;
twrph0 = CONFIG_S3C24XX_TWRPH0;
twrph1 =CONFIG_S3C24XX_TWRPH1;
#else
tacls = 0;
twrph0 =1;
twrph1 = 0;
#endif
#if 0
cfg = S3C2440_NFCONF_EN;
cfg |= S3C2440_NFCONF_TACLS(tacls - 1);
cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1);
cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1);
#endif
cfg = (tacls << 12)|(twrph0 << 8)|(twrph1 << 4);
writel(cfg, &nand_reg->nfconf);
/*初始化ECC、禁止片选、使能NANDFLASH控制器*/
writel((1 << 4)|(1 << 1)|(1<< 0), &nand_reg->nfcont);
nand->select_chip = s3c2440_nand_select;
添加函数s3c2440_nand_select
static voids3c2440_nand_select(struct mtd_info *mtd, int chipnr)
{
structs3c2440_nand *nand = s3c2440_get_base_nand();
switch(chipnr) {
case-1: /*
取消选中 */
nand->nfcont |= (1<<1);
break;
case0: /*
选中 */
nand->nfcont&= ~(1<<1);
break;
default:
BUG();
}
}
修改s3c2440_hwcontrol()函数
/*
** ctrl:表示做什么(选中芯片/取消选中,发命令还是发地址)
** cmd:命令值或地址值
*/
static voids3c2440_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct s3c2440_nand*nand = s3c2440_get_base_nand();
if(ctrl & NAND_CLE) {
/*发命令 */
writeb(cmd,&nand->nfcmd);
}else if (ctrl & NAND_ALE) {
/*
发地址 */
writeb(cmd,&nand->nfaddr);
}
}
重新编译烧到NOR FLASh执行
TQ2440 # tftp 32000000u-boot.bin
dm9000 i/o: 0x20000000, id:0x90000a46
DM9000: running in 16 bitmode
MAC: 00:0c:29:4d:e4:f4
Using dm9000 device
TFTP from server172.28.12.60; our IP address is 172.28.12.10
Filename 'u-boot.bin'.
Load address: 0x32000000
Loading: T ################
done
Bytes transferred = 226588(3751c hex)
TQ2440 # pro off all
Un-Protect Flash Bank # 1
TQ2440 # erase 0 +40000
....... done
Erased 7 sectors
TQ2440 # cp.b 32000000 040000
Copy to Flash...9....8....7....6....5....4....3....2....1....done
TQ2440 # res
resetting ...
U-Boot 2012.04.01 (Dec 292012 - 21:53:59)
CPUID: 32440001
FCLK: 400 MHz
HCLK: 100 MHz
PCLK: 50 MHz
DRAM: 64 MiB
WARNING: Caches not enabled
Flash: 2 MiB
NAND: 256 MiB
*** Warning - bad CRC, usingdefault environment
In: serial
Out: serial
Err: serial
Net: dm9000
TQ2440 #
测试
将SDRAM的0x32000000地址的0xff字节数据写到NAND FLASH的0地址
TQ2440 # nand write 320000000 ff
NAND write: device 0 offset0x0, size 0xff
255 bytes written: OK
从NAND FLASH的0地址读0xff字节数据到SDRAM的0x31000000地址
TQ2440 # nand read 310000000 ff
NAND read: device 0 offset0x0, size 0xff
255 bytes read: OK
比较
TQ2440 # cmp.b 3100000032000000 ff
Total of 255 byteswere the same
分享到:
相关推荐
现在网上已经有了u-boot-2012.04.01移植到TQ2440的过程,我也是看的别人的移植笔记,但是还是有些地方没有那么详细。所以细化了一下!给对u-boot移植不太熟悉的同学参考一下!
u-boot-2010.06移植到TQ2440,串口可以打印出东西,支持nor flash、nand flash、DM9000.
u-boot-2012.04.01移植具体需要修改的代码部分,红色表示要修改的
移植环境:ubuntu16.04.交叉编译器:4.3.2.参考了韦东山老师的第二期毕业班视频,S3C2440支持了NAND启动。
u-boot-1.1.6.tar.bz & u-boot-1.1.6_jz2440.patch
基于mini2440(256M)的u-boot.bin,使用JLINK/JTAG下载到NorFlash/NandFlash使用
本人原创, 最新u-boot-2012.07 mini2440基于nandflash启动的移植, 新鲜出炉, 与旧版本不同, 本资源是基于nand_boot函数移植的, 应该说这种移植方法才是u-boot官方推荐的nandflash启动方法。 不多吹了, 见运行...
一、首先建立自己的开发板 二、修改时钟 三、移植NOR FLASH 四、移植网卡DM9000 五、支持NAND FLASH读写 六、支持NAND FLASH启动 七、添加分区信息并启动jffs2文件系统 八、支持烧写yaffs文件系统
u-boot-2012.04.01.tar
TI的AM335X EVM板的Uboot源码u-boot-2011.09-psp04.06.00.08.tar.gz
赠送jar包:spring-boot-autoconfigure-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-autoconfigure-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-autoconfigure-2.3.12.RELEASE-sources.jar; 赠送...
很多同学都喜欢学习嵌入式,但是个人觉得u-boot 可以很明显的体现个人的嵌入式水平。这里是u-boot-2013.01.tar.bz2的源代码。
u-boot-tiny6410.tar.gz支持sd卡启动,修改u-boot - mini6410 - 20101106.tar.gz而来,屡试不爽
赠送jar包:spring-boot-actuator-autoconfigure-2.3.12.RELEASE.jar; 赠送原API文档:spring-boot-actuator-autoconfigure-2.3.12.RELEASE-javadoc.jar; 赠送源代码:spring-boot-actuator-autoconfigure-2.3.12....
u-boot-xlnx-xilinx-v2017.4.tar,zynq7000系列UBOOT源文件,可以使用petalinux进行编译。
标准的u-boot源代码,对于学习、练习u-boot,深入学习内核有很大的帮助,请尽情使用,谢谢!
u-boot移植到TQ2440手册,串口打印调试信息,支持nor flash、nand flash、DM9000.实现自己检测是从nor flash还是nand flash启动,不管下载到内存还是nand flash都可以运行,对下载地址无关性还在进一步研究中。
u-boot-2014.04-tq210,实现uboot初步移植,适用于S5PV210平台
u-boot-2011.09-2012R1-RC4.tar.bz2适用于上海远景bf609开发板,我已按其教程移植过了.这个uboot压缩包我先放到了一个文件夹里,再在xp下压缩为zip压缩包的,所以用的话先在xp下解压后才能得到里面的u-boot-2011.09-...
当前,U-Boot项目正在他的领军之下,众多有志于开放源码BOOT LOADER移植工作的嵌入式开发人员正如火如荼地将各个不同系列嵌入式处理器的移植工作不断展开和深入,以支持更多的嵌入式操作系统的装载与引导。