6 nRF51 DFU 初始化包
来源:互联网 发布:java base64 编码 编辑:程序博客网 时间:2024/06/06 07:43
当升级数据包时,在应用程序映像传输之前,在DFU中需要初始化包来执行映像的安全检测。这个初始化包作为升级流程的一部分提供了安全检测机制,因此被升级的设备只能接收兼容的应用程序。
初始化包包括以下信息可用于安全检测(参见dfu_init_packet_t)
/**@brief Structure contained in an init packet. Contains information on device type, revision, *and supported SoftDevices. */typedef struct{ uint16_t device_type; uint16_t device_rev; uint32_t app_version; uint16_t softdevice_len; uint16_t softdevice[1]; } dfu_init_packet_t;l Device type:一个2个字节的值,可由开发者定义,以指示设备的类型,如Heart Rate Belt。
/**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production.It can be located in UICR or FICR. */
l Device revision:一个2个字节的值,用于限制一个设备只能使用一个定义的版本号进行升级。
/**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production.It can be located in UICR or FICR. */
l Application version:一个4字节的值,用来标识用于传输的应用程序的版本,这个值用来只允许软件升级而不能降级。没有示例代码使用这个值。
/**< Application version for the image software. This field allows for additional checking,for example ensuring that a downgrade is not allowed. */
l Supported SoftDevices:一个2个字节的列表标识与应用程序兼容的SoftDevices,如S110 v7.0 和 S110 v7.1。
/**< Variable length array of SoftDevices compatible with this application. The length of the array is specified in the length field.SoftDevice firmware id 0xFFFE indicates any SoftDevice. */
l Checksum:2个字节的循环校验码,用于校验映像。
SDK提供一个模板dfu_init_template.c
用于执行初始化包的安全检测。这个模板是为了增强DFU的安全性而增加的。
1 设备和版本类型
设备和版本类型在nRF51芯片的UICR(0x10001080)寄存器的用户保留区中保存,如果这个区域用于其他目的,更新dfu_init.h中的偏移:UICR_CUSTOMER_DEVICE_INFO_OFFSET。
#defin UICR_CUSTOMER_DEVICE_INFO_OFFSET 0x0 /**< Variable length array of SoftDevices compatible with this application. The length of the array is specified in the length field.SoftDevice firmware id 0xFFFE indicates any SoftDevice. */
2 应用程序版本在UICR中默认值为0xFFFF,这个值意味着初始化数据包中任何设备和版本信息的DFU数据都会被接收。
/* In order to support application versioning this check should be updated. This template allows for any application to be installed however customer could place a revision number at bottom of application to be verified by bootloader. This could be done at a relative location to this papplication for example Application start address + 0x0100.*/
3 SoftDevice列表
SoftDevice S110icS1
FWID
S110 v7.0.0
0x004F
S110 v7.1.0
0x005A
Development/any
0xFFFE
4 DFU初始化包生成方法
Tan-v提供了DFU初始化包生成工具:make_dfu_initpacket.bat,生成的DFU init packet可直接用于手机APP升级,使用方法:
1. 把编译生成的hex文件“nrf51422_xxac.hex”(官方示例默认生成的hex文件名)放到 make initpacket 文件夹路径之下。注意:此hex文件名不可改变。
2. 点击 make_dfu_initpacket.bat ,则生成 bin 文件:nrf51422_xxac.bin 和DFU Init packet 文件:bootloader_initpacket.dat。
3. 把 bootloader_initpacket.dat 和nrf51422_xxac.hex保存到手机中,可直接用手机 DFU APP 进行升级。
注意:生成的DFU Init packet文件默认配置是支持任何设备类型、支持任何设备版本、支持S110 V7.0.0 和S110 V7.1.0,若要更改,更改config.dat文件中对应字段。
DFU 初始化包生成工具下载链接:http://pan.baidu.com/s/1dDgZQMX
摘自:http://www.cnblogs.com/tan-v/p/4291509.html
- 6 nRF51 DFU 初始化包
- NRF51-SDK的低功耗蓝牙广播包的单通道扫描实现
- DFU分析
- DFU Version
- 搭建nRF51开始环境
- NRF51 BOOTLOADER 编译注意事项
- NRF51 startup 反汇编
- nrf51 官方PWM库
- NRF51修改MAC Address
- arp应答包初始化
- iOS初始化资源包
- 包的初始化
- u-boot DFU implement ---- dfu-util (1)
- nRF51/52 : Disable Unused GPIOs
- STM32 Nor Flash DFU
- STM32 SPI Flash DFU
- CSR8670的DFU功能
- 51822 DFU服务
- 一致性哈希算法是分布式系统中常用的算法
- WEB编辑器
- UIWebView 内容自适应屏幕
- 在淘宝上买一元夺宝代码受骗记
- ICCV 2015 papers
- 6 nRF51 DFU 初始化包
- VLFeat和Piotr’s Image & Video Matlab Toolbox
- shell里如何完美判断环境变量是否存在?
- Android模拟产生事件
- MFC中属性页的用法
- ibatis selectKey
- Android adb命令选择设备操作
- App Transport Security has blocked a cleartext HTTP
- HDU_2196_Computer(树上节点的最长路径 · dfs / bfs)