硬件平台:
MainBoard:OK6410
CPU: S3C6410
RAM: 256M
FLASH:1G K9GAG08U0D
Kernel:Linux2.6.28
BootLoader:Uboot1.1.6
3.使用TFTP升级Uboot
发现使用tftp升级uboot的时候无法成功,但是升级fs和kernel的时候可以。
后发现S3C6410启动的时候会通过
NAND控制器将nandflash的头4K拷贝到SRAM中执行,这一步叫做steppingstone,SRAM的大小有8K,但是
steppingstone只用了其中的4K,另外NAND控制器支持每FLASH页读取的大小为512B/2K,所以当flash页大小为4K的时候,
它只能每块读取前2K,这里就需要在写Uboot的时候前面个PAGE每个只能写入2K,也即
- nand erase 0 100000
- nand write 50008000 0 1000
- nand write 50008800 1000 1000
- nand write 50009000 2000 FF000
飞凌提供的SD卡升级方式利用了SDRAM的全部大小,也即8K,所以它的写入步骤为:
- nand erase 0 100000
- nand write 50008000 0 1000
- nand write 50008800 1000 1000
- nand write 50009000 2000 1000
- nand write 50009800 3000 1000
- nand write 5000A000 4000 FE000
至此解决了TFTP升级Uboot问题。另外在do_nane中添加了命令nand write.uboot命令,可以直接一个命令搞定uboot升级,添加如下代码:
- else if(!read && !strcmp(s, ".uboot"))
- {
- /* for Page 2048 then just do normal writing */
- if(nand->writesize == 0x800)
- goto write;
- else if(nand->writesize == 0x1000)
- {
- /* try to simulate a 0x800 page size flash and do a remap */
- int blocks = 5, i = 0;
-
- for(; i < blocks; i++)
- {
- if(i == blocks - 1)
- size = 0xfe000;
- else
- size = 0x1000;
-
- printf("Write at Offset %x from Addr:%x with Size %x\n", off + i * 0x1000, addr + i * 0x800, size);
- ret = nand_write(nand, off + i * 0x1000, &size, (u_char *)(addr + i * 0x800));
-
- if(ret == 0)
- {
- uint *magic = (uint*)(PHYS_SDRAM_1);
- if((0x24564236 == magic[0]) && (0x20764316 == magic[1]))
- magic[0] = 0x27051956;
- }
-
- if(ret)
- {
- printf(" 0x%x bytes %s to 0x%x %s\n", size, read ? "read" : "written", off + i * 0x1000, 0x1000,
- ret ? "ERROR" : "OK");
- return 1;
- }
- }
-
- printf("Uboot have been updated, please do reset!\n");
- return 0;
- }
- else
- {
- printf("Only support page size 2K and 4K!\n");
- return 1;
- }
- }
阅读(1510) | 评论(0) | 转发(2) |