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

 

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