您的位置:首页 > 其它

利用CCS和DM814x Flash烧写工具烧写Nand Flash

2014-12-15 20:56 375 查看
新得到的DM8148开发板,NandFlash里面似乎是空的。向Nand Flash烧写程序共需要三个步骤:

1.     利用Nand Flash烧写工具烧写第一阶段u-boot;

2.     在第一阶段u-boot中利用loadb命令烧写第二阶段u-boot;

3.     在第二阶段u-boot中利用tftp烧写操作系统系统内核和文件系统。

这里仅记录Nand Flash烧写第一阶段u-boot的方法。

 

操作系统: Windows XP Home Edition(32-bit), Version 2002, Service Pack 3

CCS软件:CCS v5.1.1.00031

开发板型号:TMDXEVM8148(PG2.1)

 

1.     硬件准备

(1)    连接电源线;

(2)    连接JTAG仿真器(Emulator),板上位置J11,仿真器型号Ashling Opella-XDS100v2,仿真器另一端线路插入电脑USB接口;

(3)    开发板上S1所有开关拨到“0”位置(OFF),即图中S1所有开关拨到下方;



(4)    开发板上SW2开关(控制NAND 和SPI Flash)中,Nand开关拨到“ON”位置,即下图中左侧开关拨到上方;



(5)    开发板上电。

 

2.     启动CCS

(1)    启动Code Composer Studio;

(2)    选择"View -> Target Configurations";

(3)    在窗口右上角点击 "New Target Configuration File"按钮,并为新的配置文件命名(比如:ti814x_usb.ccxml)并单击“Finish”;

(4)    在设置窗口中,“connection”=“Texas Instruments XDS100v2 USB Emulator”,“Board orDevice”=“TI814x”;

(5)    保存配置内容,下一次就可以直接调用这个配置文件;

(6)    在CCS中选择“Window --> Open Perspective --> CCS Debug”,出现调试界面;

(7)    选择“View -> Target Configurations”,展开"UserDefined"配置目录,右键单击刚刚设置好的配置文件,并选择"Launch Selected Configuration";

(8)    在Debug窗口中,右键点击最下边的“Texas Instruments XDS100v2 USB Emulator _0/Cortex A8”模块(此时状态为Disconnected:Unknown),选择"ConnectTarget";这时模块状态变为Suspended;

(9)    选择“View -> Registers”,在弹出的Registers窗口中找到“Core Register ->CPSR”,将其中的“T”域设置为0,这样就将ARM状态由“Thumb”设
4000
置为了“ARM”模式。

 

3.     装载GEL文件

烧写工具需要GEL文件来初始化PLL,DDR,片上Ram和GPMC。

(1)    确认GEL文件,这里使用的开发板版本为PG2.1,如果GEL文件错误,可能无法读出Nand Flash ID,此处使用的是开发板附件光盘中附带的GEL文件:PG2.1_DM814X_20Mhz_Si.gel.gel;

(2)    在CCSIDE中选择“Tools --> GEL Files”,在弹出的“GEL Files(Cortex A8)”窗口中单击右键,选择“LoadGEL…”,打开PG2.1_DM814X_20Mhz_Si.gel.gel文件;

(3)    在“Scripts”下拉菜单中选择“Scripts->PG 2.0 DM814x->ALL_ADPLL_CLOCKS_ENABLE_API”,设置PLL;

(4)    选择“Scripts->PG 2.0 DM814x->DDR3_EMIF0_EMIF1_Config_Full_Leveling”,设置DDR;

(5)    选择“Scripts->DM814x System Initialization->GPMC_CLOCKENABLE”,设置GPMC。

打印调试信息如下:

CortexA8: Output: 	 ****  DM814X2 ALL ADPLL INIT IS In Progress .........
CortexA8: GEL Output: 	 MODENA ADPLLJ CLKOUT  value is  = 600
CortexA8: GEL Output: 	 L3  ADPLLJ CLKOUT  value is  = 200
CortexA8: GEL Output: 	 DSP ADPLLJ CLKOUT  value is  = 500
CortexA8: GEL Output: 	 DSS ADPLLJ CLKOUT  value is  = 200
CortexA8: GEL Output: 	 ISS ADPLLJ CLKOUT  value is  = 400
CortexA8: GEL Output: 	 IVA ADPLLJ CLKOUT  value is  = 266
CortexA8: GEL Output: 	 SGX ADPLLJ CLKOUT  value is  = 200
CortexA8: GEL Output: 	 USB ADPLLJ CLKOUT  value is  = 192
CortexA8: GEL Output: 	 VIDEO-0 ADPLLJ CLKOUT  value is  = 54
CortexA8: GEL Output: 	 VIDEO-1 ADPLLJ CLKOUT  value is  = 148
CortexA8: GEL Output: 	 VIDEO-2/HDMI ADPLLJ CLKOUT  value is  = 148
CortexA8: GEL Output: 	 DDR ADPLLJ CLKOUT  value is  = 333
CortexA8: GEL Output: 	 AUDIO ADPLLJ CLKOUT  value is  = 200
CortexA8: Output: 	 **** SATA PLL INIT IS In Progress Please wait .....
CortexA8: Output: 	 **** SATA PLL INIT IS In DONE *****************
CortexA8: GEL Output: exiting pll setup

CortexA8: GEL Output: CONFIGURE PRCM CLOCKS of EMAC in progress

CortexA8: GEL Output: PRCM CLOCKS of EMAC  is complete

CortexA8: Output: 	 ****  DM814X2 ALL ADPLL INIT IS  Done **************
CortexA8: Output: 	 ****  DM814X2 DDR3 Full_leveling EMIF0 and EMIF1 configuration in progress.........
CortexA8: Output: 	Busy reading back DMM registers Please wait ...
CortexA8: Output: 	DMM register read successfully
CortexA8: Output: 	 ****  DM814X2 DDR3 Full_leveling EMIF0 and EMIF1 configuration is DONE ****
CortexA8: Output: 	Enabling Clock for GPMC is in Progress, Please wait.....
CortexA8: Output: 	GPMC Clock is Active
CortexA8: GEL Output: Reg default Value: 0x00040000
CortexA8: Output: 	PINMUX configuration is in Progress, Please wait.....
CortexA8: GEL Output: Reg written value: 0x00040001
CortexA8: Output: 	Pinmux is configured successfully !!!
CortexA8: Output: 	Wait .... busy writing memory
CortexA8: Output: 	GPMC Memory write failed, Try again ...

注意:虽然最后显示有操作失败,但是GPMC时钟已打开,失败内容不影响后面的操作。

 

4.     烧写Flash

(1)    选择“Run -> Load -> Load Program”并找到“nand-flash-writer.out”文件,打开运行;

(2)    选择“Run->Resume”重新启动;

(3)    在提示下列菜单后输入1,烧写Flash;

Choose your operation
Enter 1 ---> To Flash an Image
Enter 2 ---> To ERASE the whole NAND
Enter 3 ---> To EXIT

(4)    在提示输入文件路径时,输入完整的第一阶段u-boot文件(如:c:\u-boot_DM814X_TI_EVM.min.nand);

Enter image file path

(5)    在提示输入偏移量时输入0,意为从Flash开头位置烧写,注意这里是16进制数;

Enter offset (in hex):
(6)    在提示纠错码时选择1,总是为U-Boot选择BCH 8,因为ROM代码就是使用BCH 8纠错;

Choose the ECC scheme from given options
Enter 1 ---> BCH 8 bit
Enter 2 ---> HAM
Enter 3 ---> T0 EXIT
Please enter ECC scheme type :

(7)    如果显示以下信息,说明烧写成功了。

[CortexA8] Welcome to CCS Nand Flash Utility
[CortexA8]
[CortexA8]
[CortexA8] Choose your operation
[CortexA8] Enter 1 ---> To Flash an Image
[CortexA8] Enter 2 ---> To ERASE the whole NAND
[CortexA8] Enter 3 ---> To EXIT
1
[CortexA8] Enter image file path
c:\u-boot_DM814X_TI_EVM.min.nand
[CortexA8] Enter offset (in hex):
0
[CortexA8] Choose the ECC scheme from given options :
[CortexA8] Enter 1 ---> BCH 8 bit
[CortexA8] Enter 2 ---> HAM
[CortexA8] Enter 3 ---> T0 EXIT
[CortexA8] Please enter ECC scheme type :
1
[CortexA8] Starting NETRA NAND writer
[CortexA8]
[CortexA8] The NAND Flash is ONFI compatible
[CortexA8]
[CortexA8]
[CortexA8] ----------------------
[CortexA8]   NAND FLASH DETAILS
[CortexA8] ----------------------
[CortexA8]  Device ID : 0xca
[CortexA8]  Manufacture ID : 0x2c
[CortexA8]  Page Size : 2048 Bytes
[CortexA8]  Spare Size : 64 Bytes
[CortexA8]  Pages_Per_Block : 64
[CortexA8]  Number_of_Blocks : 2048
[CortexA8]  Device_width : 2 Byte
[CortexA8]  DeviceSize : 256 MB
[CortexA8]
[CortexA8]  Setting the ECC scheme
[CortexA8]   Set the BCH 8 bit ECC scheme  .... done
[CortexA8] Preparing to Flash image ....
[CortexA8] Opening image ... done.
[CortexA8] Erasing Required Blocks [start = 0, count = 1]...[CortexA8] Done
[CortexA8] Flashing image ...
[CortexA8] Number of blocks needed for header and data: 0x1
[CortexA8] Attempting to start write in block number 0x0.
[CortexA8] Writing image data to Block 0 Page0x0
[CortexA8] Writing image data to Block 0 Page0x1
[CortexA8] Writing image data to Block 0 Page0x2
[CortexA8] Writing image data to Block 0 Page0x3
[CortexA8] Writing image data to Block 0 Page0x4
[CortexA8] Writing image data to Block 0 Page0x5
[CortexA8] Writing image data to Block 0 Page0x6
[CortexA8] Writing image data to Block 0 Page0x7
[CortexA8] Writing image data to Block 0 Page0x8
[CortexA8] Writing image data to Block 0 Page0x9
[CortexA8] Writing image data to Block 0 Page0xa
[CortexA8] Writing image data to Block 0 Page0xb
[CortexA8] Writing image data to Block 0 Page0xc
[CortexA8] Writing image data to Block 0 Page0xd
[CortexA8] Writing image data to Block 0 Page0xe
[CortexA8] Writing image data to Block 0 Page0xf
[CortexA8] Writing image data to Block 0 Page0x10
[CortexA8] Writing image data to Block 0 Page0x11
[CortexA8] Writing image data to Block 0 Page0x12
[CortexA8] Writing image data to Block 0 Page0x13
[CortexA8] Writing image data to Block 0 Page0x14
[CortexA8] Writing image data to Block 0 Page0x15
[CortexA8] Writing image data to Block 0 Page0x16
[CortexA8] Writing image data to Block 0 Page0x17
[CortexA8] Writing image data to Block 0 Page0x18
[CortexA8] Writing image data to Block 0 Page0x19
[CortexA8] Writing image data to Block 0 Page0x1a
[CortexA8] Writing image data to Block 0 Page0x1b
[CortexA8] Writing image data to Block 0 Page0x1c
[CortexA8] Writing image data to Block 0 Page0x1d
[CortexA8] Writing image data to Block 0 Page0x1e
[CortexA8] Writing image data to Block 0 Page0x1f
[CortexA8] Writing image data to Block 0 Page0x20
[CortexA8] Writing image data to Block 0 Page0x21
[CortexA8] Writing image data to Block 0 Page0x22
[CortexA8] Writing image data to Block 0 Page0x23
[CortexA8] Writing image data to Block 0 Page0x24
[CortexA8] Writing image data to Block 0 Page0x25
[CortexA8] Writing image data to Block 0 Page0x26
[CortexA8] Writing image data to Block 0 Page0x27
[CortexA8] Writing image data to Block 0 Page0x28
[CortexA8] Writing image data to Block 0 Page0x29
[CortexA8] Writing image data to Block 0 Page0x2a
[CortexA8] Writing image data to Block 0 Page0x2b
[CortexA8] Writing image data to Block 0 Page0x2c
[CortexA8] Writing image data to Block 0 Page0x2d
[CortexA8] Writing image data to Block 0 Page0x2e
[CortexA8] Writing image data to Block 0 Page0x2f
[CortexA8] Writing image data to Block 0 Page0x30
[CortexA8] Writing image data to Block 0 Page0x31
[CortexA8] Writing image data to Block 0 Page0x32
[CortexA8] Writing image data to Block 0 Page0x33
[CortexA8] Writing image data to Block 0 Page0x34
[CortexA8] Writing image data to Block 0 Page0x35
[CortexA8] Writing image data to Block 0 Page0x36
[CortexA8] Application is successfully flashed
[CortexA8]
[CortexA8]
[CortexA8] NAND flashing successful!

(8)    开发板关电,断开仿真器连接。

参考资料:

1.     http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_Flashing_Tools_Guide#Starting_CCS

除了Nand Flash的烧写,NOR和SPI Flash的烧写也可参考这个资料。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ccs dm8148 flash