SD card boot and flashing tool for TI davinic DM368

實驗環境:

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 dump
9,選擇 2 - install,就可以把 UBL, u-boot, uImage ... 下載到 NAND flash 中

10,再斷電,設置 LW3xx 爲從 NAND 啓動(LW3xx 平臺是 R428 接地),重新上電即從 NAND 啓動了








發佈了34 篇原創文章 · 獲贊 8 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章