实验环境:
DM368 平台 : LW3xx
SD card : Micro SD 128MB
HOST : ubuntu 10.04.4 64-bit
CROSS_COMPILE : CodeSourcery GNU Toolchain for ARM Processors: 2009q1-203 version
1,参考网址
http://processors.wiki.ti.com/index.php/SD_card_boot_and_flashing_tool_for_DM355_and_DM365
http://wiki.linpert.de/index.php?title=LeopardBoard/SD_CARD
2,下载 SD boot 工具 dm3xx_sd_boot
3,解压 dm3xx_sd_boot-6.1.tgz,并重新编译
#export PATH=$PATH:/opt/arm-2009.q1-203/bin #make clean #make CROSSCOMPILE=arm-none-linux-gnueabi-
编译时有错误发生,解决方法请参考http://wiki.linpert.de/index.php?title=LeopardBoard/SD_CARD
arm-none-linux-gnueabi-gcc -Wl,-T../flash_utils/DM36x/GNU/ubl/ubl.lds -nostdlib DM36x/boot.o DM36x/selfcopy.o DM36x/device.o DM36x/debug.o DM36x/uart.o DM36x/util.o DM36x/memory_test.o DM36x/sdcard_flash.o DM36x/mmcsd_protocol.o DM36x/mmcsd_evm.o DM36x/nand.o DM36x/device_nand.o DM36x/sdc_debug.o DM36x/nand_copy.o -o DM36x/sdcard_flash DM36x/selfcopy.o:(.ARM.exidx.selfcopy+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' DM36x/boot.o:(.ARM.exidx.boot+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' DM36x/device.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' DM36x/debug.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr1'
修改 sdcard_flash/Makefile,增加下面一行就可以解决问题(记得要重新 make clean & make)
CFLAGS+= -mabi=aapcs-linux
4,在 dm3xx_sd_boot-6.1/original 目录准备好适用于 LW3xx 平台的 UBL,u-boot,uImage 二进制文件,并修改文件 dm3xx_sd.config
DM36x) ubl=original/ubl_DM36x_ARM432_DDR340_OSC24_NAND.bin uboot=original/u-boot-2011.12.bin kernel=original/uImage-3.3.4 ;;
注意:UBL 要选用 NAND 版本的
编译 LW3xx UBL 请参考《TI davinci DM368 UBL 编译方法》
编译 LW3xx uboot 请参考《TI davinci DM368 u-boot 编译方法》
编译 LW3xx uImage 请参考《编译 davinci linux 的方法》
5,插入 SD 卡,并格式化 SD 卡
#./dm3xx_sd_boot format /dev/mmcblk0
1000+0 records in 1000+0 records out 1024000 bytes (1.0 MB) copied,0.424695 s,2.4 MB/s disk /dev/mmcblk0: 3880 cylinders,4 heads,16 sectors/track sfdisk: ERROR: sector 0 does not have an msdos signature /dev/mmcblk0: unrecognized partition table type Old situation: No partitions found New situation: Units = mebibytes of 1048576 bytes,blocks of 1024 bytes,counting from 0 Device Boot Start End MiB #blocks Id System /dev/mmcblk0p1 * 0+ 39 40- 40959+ b W95 fat32 /dev/mmcblk0p2 * 40 121- 82- 83200 83 Linux /dev/mmcblk0p3 0 - 0 0 0 Empty /dev/mmcblk0p4 0 - 0 0 0 Empty Successfully wrote the new partition table Re-reading the partition table ... mkfs.vfat 3.0.7 (24 Dec 2009) Seek to 114115107840:Invalid argument 0+0 records in 0+0 records out 0 bytes (0 B) copied,2.6408e-05 s,0.0 kB/s 0+1 records in 0+1 records out 19 bytes (19 B) copied,3.237e-05 s,587 kB/s total 15000 -rwxr-xr-x 1 root root 15360000 2012-05-02 14:57 dm3xx.dat SD card /dev/mmcblk0 formatted 10000+0 records in 10000+0 records out 10240000 bytes (10 MB) copied,0.799747 s,12.8 MB/s dm3xx_boot_data_addr=0x0a1c00 Image dm3xx_boot_rec:a1aced00 100 3c 50f 0 0 0 0 a1c00 10000+0 records in 10000+0 records out 10240000 bytes (10 MB) copied,0.796888 s,12.8 MB/s dm3xx boot record is written Please reinsert the card for auto mounting or mount it manually根据提示,重新插拔 SD 卡
6,将 ubl,u-boot... 写到 SD 卡中
#make install
./dm3xx_sd_boot data copying data to Writing /media/AE9D-9DF6/dm3xx.dat 000200-006538,25400 bytes <- sdcard_flash/sdcard_flash_DM36x.bin 008000-008200,512 bytes <- test pattern 1 2 3 010000-01333c,13116 bytes <- original/ubl_DM36x_ARM432_DDR340_OSC24_NAND.bin 020000-06b228,307752 bytes <- original/u-boot-2011.12.bin ERROR: overlapping at 60000 (ftell = 6b228) 060000-2547c8,2049992 bytes <- original/uImage-dm365 400000-6740c7,2572487 bytes <- original/ramdisk.gz syncing DM355 boot data copied in data file /media/AE9D-9DF6/dm3xx.dat on Filesystem 1K-blocks Used Available Use% Mounted on /dev/mmcblk0p1 40313 15001 25313 38% /media/AE9D-9DF6
此处有一个错误 "ERROR: overlapping at 60000 (ftell = 6b228)"
这是由于 u-boot 太大了,已经覆盖到了 uImage 的分区,解决方法如下:
首先,修改 sdcard_flash/sdboot_flash_cfg.h
第31行
#define UBOOT_SIZE (160*KB) 修改为 #define UBOOT_SIZE (512*KB)
第42行
#define KERNEL_SDC 0x060000 修改为 #define KERNEL_SDC 0x080000
其次,修改 dm3xx_sd_boot-6.1/Makefile
第3行
arch=$(shell uname -m | sed -e "s/i.86.*/x86/" -e "s/arm.*/arm/" -e "s/x86.*/x86/")第23行
rm -f $(BIN)/dm3xx_boot_make_image最后执行
#make #make CROSSCOMPILE=arm-none-linux-gnueabi- #make install
7,将 SD 卡插入 LW3xx SD卡槽,然后设置 LW3xx 为从 SDMMC 启动(LW3xx 平台是 R428 接 3.3v)
8,LW3xx 上电后,即可以看到如下信息:
SD card boot and flashing tool for DM355 and DM365 by Constantine Shulyupin http://www.LinuxDriver.co.il/ Online manual: http://wiki.davincidsp.com/index.PHP/SD_card_boot_and_flashing_tool_for_DM355_and_DM365 based on TI DM35x FlashAndBootUtils 1.10 SFT,TI flash_utils and SpectrumDigital evmdm355,evmdm365 Compiled on May 2 2012 at 16:04:51 with gcc 4.3.3 SYstem->DEVICE_ID=0x8B83E02F &EMIFStart=0x02000000 nand->devID=0x000000D3 nand->dataBytesPerPage=2048 nand->pagesPerBlock=64 nand->numBlocks=8192 nand_size=1073741824 sdcard_init sdcard_read sdc_src=0x00001000 dst=0x80001044 len=0x00000200 dst + len=0x80001244 *data0=0xA1ACED00 flasher_data=0x000A1C00 sdcard_read sdc_src=0x000A9C00 dst=0x80001044 len=0x00000200 dst + len=0x80001244 *data0=0x00010000 check_pattern_123 1 - boot; 2 - install; 3 - erase flash,4 - nand boot,5 - test first 16MB of RAM u - install ubl only,d - nand flash dump9,选择 2 - install,就可以把 UBL,uImage ... 下载到 NAND flash 中
10,再断电,设置 LW3xx 为从 NAND 启动(LW3xx 平台是 R428 接地),重新上电即从 NAND 启动了