歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

Linux下使用DNW下載鏡像-TQ2440

Linux下與TQ2440進行串口通信見 http://www.linuxidc.com/Linux/2011-12/48961.htm
本人使用的Ubuntu 10.04
開發板是TQ2440
在網上找到一個dnw for Linux。共享給大家
(secbulk目錄下是PC端USB驅動, dnw目錄是下載工具)

效果圖:

1.首先解壓縮文件:
# tar xvf dnw_for_linux.tar.gz
另:在ubuntu下右鍵解壓也很方便
2.然後切換到下面的目錄,編譯usb驅動模塊:
# cd dnw_for_linux/secbulk
# make -C /lib/modules/2.6.33.6-147.fc13.i686/build/ M=/home/libing/dnw_for_linux/secbulk/ modules


注意:相應路徑要替換成你機器的路徑。/lib/modules/2.6.32-33-generic/build/目錄中“2.6.32-33-generic”是當前啟動內核版本,如果你是多內核要注意了(不確定可以終端uname -r命令查看內核版本)。


當然了也可以在文件夾下新建一文檔,copy指令,然後保存,以可執行程序的方式運行之。
       
3.編譯完成後,會生成secbulk.ko文件:
# ls
Makefile       Module.symvers  secbulk.ko     secbulk.mod.o
modules.order  secbulk.c       secbulk.mod.c  secbulk.o


4.加載模塊到Linux內核:
# sudo insmod ./secbulk.ko        (注意要在root權限下)
# dmesg        (查看是否加載成功)
secbulk:secbulk loaded


usbcore: registered new interface driver secbulk        (看到這樣兩行就說明成功了)


5.下面開始編譯dnw工具
# cd ../dnw
# gcc -o dnw dnw.c


(編譯完成,會看到dnw可執行文件)


6.將文件copy到/usr/local/bin目錄
# sudo cp dnw /usr/local/bin


(這樣就可以在shell下面直接使用dnw命令了)


使用方法如下:

1.在minicom下,從Nor Flash啟動TQ2440,選擇a功能:  

關於串口通信的設置常見 http://www.linuxidc.com/Linux/2011-12/48961.htm

####    Boot for Nor Flash Main Menu   #####                                  
#####     EmbedSky USB download mode     #####                                 
                                                                               
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash           
[2] Download Eboot (eboot.nb0) to Nand Flash                                   
[3] Download Linux Kernel (zImage.bin) to Nand Flash                           
[5] Download CRAMFS image to Nand Flash                                        
[6] Download YAFFS image (root.bin) to Nand Flash                              
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it              
[8] Boot the system                                                            
[9] Format the Nand Flash                                                      
[0] Set the boot parameters                                                    
[a] Download User Program (eg: uCOS-II or TQ2440_Test)                         
[b] Download LOGO Picture (.bin) to Nand  Flash                                
[l] Set LCD Parameters                                                         
[n] Enter TFTP download mode menu                                              
[o] Download u-boot to Nor Flash                                               
[r] Reboot u-boot                                                              
[t] Test Linux Image (zImage)                                                  
[q] quit from menu                                                             
Enter your selection: a                                                        
USB host is connected. Waiting a download. 

minicom的輸出信息
Enter your selection: a                                                        
USB host is connected. Waiting a download. 
2.此時,打開另一個終端:
# sudo dnw 1.bin
libing@ubuntu:~$ sudo dnw 1.bin
file name : 1.bin
file size : 1214004 bytes
Writing data...
100%     1214014 bytes     OK
重啟ARM,是不是程序已經下載進去啊,真是令人高興啊。

DNW_for_linux 下載:

免費下載地址在 http://linux.linuxidc.com/

用戶名與密碼都是www.linuxidc.com

具體下載目錄在 /pub/2011/12/08/Linux下使用DNW下載鏡像-TQ2440/

不過每次開機都要加載一次那個.ko模塊,大家可以自己將它寫到開機腳本裡,省去了每次都要手動加載的麻煩!

Copyright © Linux教程網 All Rights Reserved