加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

DM8168 nand flash烧写与启动步骤

发布时间:2020-12-15 17:31:55 所属栏目:百科 来源:网络整理
导读:!先觉条件 0:确保硬件设计和使用正确!(中枪) 1 :确保 SD 卡的 boot 分区有用于烧写到 nand?flash 的 Uboot 文件 2 :确保 EVM 的 SW4? 的 NAND?FLASH 选通开关正确 3 :确保 NAND?FLASH? 的位宽设置正确 (中枪) 在设置过程中,官方文档的描述: http

!先觉条件

0:确保硬件设计和使用正确!(中枪)

1:确保SD卡的boot分区有用于烧写到nand?flashUboot文件

2:确保EVMSW4?NAND?FLASH选通开关正确

3:确保NAND?FLASH?的位宽设置正确(中枪)

在设置过程中,官方文档的描述:http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide#Flashing_TI816X_U-Boot_to_NAND_using_SD_boot

PsFlashing?TI816X?U-Boot?to?NAND?using?SD?boot

Before?proceeding?with?any?of?the?commands?given?in?this?section?please?make?sure?that?NAND?is?enabled?on?the?EVM.?The?switch?for?enabling?NAND?on?TI8168?EVM?is?SW4.

Copy?the?U-Boot?image?u-boot.noxip.bin?built?for?NAND?as?described?[#U-Boot_for_NAND_boot?here]?in?the?FAT?partition?on?the?SD?card.?(The?release?package?contains?a?pre-built?image?u-boot.noxip.bin?which?can?be?used?for?this?purpose)

Once?the?second?stage?of?SD?boot?comes?up?use?the?following?commands?to?flash?to?NAND

TI8168_EVM#?mmc?rescan?0

TI8168_EVM#?fatload?mmc?0?0x81000000?u-boot.noxip.bin

TI8168_EVM#?nand?erase?0x0?0x260000

TI8168_EVM#?nand?write.i?0x81000000?0x0?0x33800

After?this?the?EVM?switch?settings?can?be?changed?to?[#NAND_boot?NAND?boot?mode]?if?boot?out?of?NAND?is?required.

官方的这最新的wiki上全部的描述就是这样,但是在实际的烧写过程中:

TI8168_EVM#?nand?erase?0x0?0x1c0000命令返回的结果是

No?available?device

但是,通过nand?device命令可以看到有nand?flash设备存在

Device?0:?<NULL>,?sector?size?128?KiB

各种百度,各种手册,弄了半个上午,一无所获,一气之下,google之,在第一条结果就给出了有用的信息,原来除了wiki上的?SW4需要设置正确之外,在SW3上的CS0BW位也需要设置成16bit模式,这样才能正确的烧写,鄙视一下TI的这篇WIKI?和我大天朝的Baidu

所以完全正确的方式步骤是:

1:拷贝你想要烧写的u-boot.noxip.bin到SD卡的boot分区

2SW4拨到nand?flash启动的位

3SW3CS0BW位拨到16bit模式【左边】

4:按照wiki上的步骤烧写即可,在新版本的修改中,对ecc校验做了少许修改,所以在实际的烧写中,有的前辈给出的烧写代码中添加了 ?【设置硬件ECC校验模式为BCH8】 的设置指令

Boot?Pin?Settings

?

SW-1/SW-3?

SW-2/SW-4/SW-5*?

Boot?Mode

BTM?4

BTM?3

BTM?2

BTM?1

BTM?0

NAND

SPI

NAND

1

0

X

SPI

X

1

UART

SD

NOR

EMAC

X


注意:u -boot,kernel,ubifs的Size须与Nand Flash每页Size(2048字节,0x800)严格对齐:
? ?
例如u-boot.noxip.bin: 210320字节,210320/2048 == 103,103x2048 = 210944 (0x33800)
? kernel,ubifs方法同上



SW3设置为SD mode[1:10]=1110100100;同时SW4 mode[1:2]=10 nand使能(16bit nand flash)


SD卡启动进入Uboot命令行输入以下指令:

烧写UBoot


mmc rescan 0

mw.b 0x81000000 0xFF 0x260000 ? ? ? ? ? ? //初始化内存区域,全部置1
fatload mmc 0 81000000 u-boot.noxip.bin ? //从SD卡中下载相应文件到初始化内存区域
nand erase 0x0 0x260000 ? ? ? ? ? ? ? ? ? //对将要使用的nand flash内存区域进行擦除操作
nandecc hw 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ?//设置硬件ECC校验模式BCH8
nand write.i 0x81000000 0x0 0x33800 ? ??? ? ? //把初始化内存区域下载的文件写到nand flash
nandecc hw 0 ? //设置硬件ECC校验模式Hamming Code




烧写内核uImage
mw.b 0x81000000 0xFF 0x440000?
fatload mmc 0 81000000 uImage?
nand erase 0x00280000 0x00440000?
nandecc hw 2
nand write 0x81000000 0x00280000 0x00299000 ? ? ?//参照所使用uImage Size大小
nandecc hw 0


烧写文件系统

mw.b 0x81000000 0xFF 0x0C820000?
fatload mmc 0 81000000 ubi.img?
nand erase 0x006C0000 0x0C820000?
nandecc hw 2
nand write 0x81000000 0x006C0000 0x001300000 ? ? ?//参照所使用ubi.img Size大小
nandecc hw 0



关机重启,SW3设置为Nand mode[1:10]=0100100100;同时SW4 mode[1:2]=10 nand使能(16bit nand flash)

Nand启动进入Uboot命令行输入以下指令设置env变量:


setenv bootcmd 'nand read 81000000 280000 440000;bootm 81000000'
setenv bootargs 'console=ttyO2,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:rootfs init=/init'





本文主要参照 http://blog.csdn.net/luhao806/article/details/7341439?

http://blog.csdn.net/aihu_1201/article/details/8963919

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读