smart210 dnw下載

 

下載地址https://download.csdn.net/download/u011171361/10888629

包含兩個工具:scebulk(USB驅動) 、dnw(下載工具)

一.編譯安裝scebulk

1.進入dnw4linux-master/secbulk_driver

root@ubuntu:/opt/smart210/mywork/u-boot/smart210# cd dnw4linux-master/
root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master# cd secbulk_driver/
root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver# 

2.電腦用USB線連接到開發板,上電,執行dmsg  可以得知,開發板 idVendor=18d1, idProduct=0002 , 記住這兩個數(可以先執行dmesg -c 清除之前的記錄信息,上電,再dmesg)

root@mylubuntu:/opt/FriendlyARM/mini210/linux/u-boot/smart210/dnw4linux-master# dmesg 
[13659.955331] usb 1-1: USB disconnect, device number 6
[13664.697520] usb 1-1: new high-speed USB device number 7 using ehci-pci
[13664.997025] usb 1-1: New USB device found, idVendor=18d1, idProduct=0002
[13664.997029] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[13664.997031] usb 1-1: Product: 210Series
[13664.997033] usb 1-1: Manufacturer: FriendlyARM
[13664.997034] usb 1-1: SerialNumber: Mini210

3.進入secbulk目錄,編輯secbulk.c文件,找到如下:

#define BULKOUT_BUFFER_SIZE	512     //改成512 可以加快下載速度

#ifdef OK6410 
	#define		DOWNLOAD_USB_ID_MAJOR		0x04e8
	#define		DOWNLOAD_USB_ID_MINOR		0x1234
#else                                           /* add your usb info if neccessary */
	#define		DOWNLOAD_USB_ID_MAJOR		0x18d1    //根據自己的情況填寫
	#define		DOWNLOAD_USB_ID_MINOR		0x0002    //根據自己的情況填寫
#endif

4.編譯  make -C /lib/modules/`uname -r`/build M=`pwd` modules  ,順利會產生secbulk.ko

root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver# make -C /lib/modules/`uname -r`/build M=`pwd` modules 
make: Entering directory '/usr/src/linux-headers-4.8.0-52-generic'
  CC [M]  /opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.o
In file included from ./include/linux/printk.h:6:0,
                 from ./include/linux/kernel.h:13,
                 from /opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.c:1:
/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.c: In function ‘secbulk_write’:
./include/linux/kern_levels.h:4:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:10:18: note: in expansion of macro ‘KERN_SOH’
 #define KERN_ERR KERN_SOH "3" /* error conditions */
                  ^
/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.c:80:11: note: in expansion of macro ‘KERN_ERR’
    printk(KERN_ERR "secbulk:usb_bulk_msg failed!  ret = %d  to_write = %d actual_length = %d \n
           ^
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.mod.o
  LD [M]  /opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.ko
make: Leaving directory '/usr/src/linux-headers-4.8.0-52-generic'
root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver# ls
Makefile       Module.symvers  secbulk.ko     secbulk.mod.o
modules.order  secbulk.c       secbulk.mod.c  secbulk.o

5.安裝並查看安裝情況  insmod secbulk.ko

root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver# insmod secbulk.ko 
root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver# lsmod | grep secbulk 
secbulk                16384  0

6.開機自動加載secbulk.ko
開機的時候不會自動加載.ko文件,這樣每次都要先加載纔可以使用,此時將其加入開機腳本,
使其得到自動加載,編輯/etc/init.d/rc.local 在最後加上 insmod /所在路徑/secbulk.ko

sudo gedit /etc/init.d/rc.local

insmod /opt/smart210/mywork/u-boot/smart210/dnw4linux-master/secbulk_driver/secbulk.ko

二.測試DNW下載

 

方法一:進入dnw_src目錄,修改dnw.c文件中DOWNLOAD_ADDR的定義,將其設爲你的開發板的下載地址;

方法二:./dnw -a 0x20000000 -f buzzer.bin
root@ubuntu:/opt/smart210/mywork/u-boot/smart210/dnw4linux-master/dnw_src# ./dnw -a 0x20000000 -f buzzer.bin 
get hex addr: 0x20000000
File name : buzzer.bin
File size : 276 bytes
Start Sending data...
Dest address: 0x20000000
Sent 100% 	 286 bytes !OK

參考:https://blog.csdn.net/a470038781/article/details/53037814

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章