nRF Connect SDK v2.6.1 DFU
1. 参考:Add DFU support to your application
Add DFU support to your application
首先我们使用SDK v2.6.1新建一个project,请根据上述链接中的配置工程。
DFU over Bluetooth
Modify the Peripheral LBS sample
重点:
#Enable MCUBOOT bootloader build in the application
CONFIG_BOOTLOADER_MCUBOOT=y
#Include MCUMGR and the dependencies in the build
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
以上使用NRF52840DK 测试通过。
2. 配置原有的旧porject
因为我们的project是 SDK v2.1.0 版本的,SDK v2.6.1的DFU配置已经变化了很多,所以我们根据第一步参考的配置移植。
有关 CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU 的描述请点击链接查看,其使能了很多相关配置。
将上述配置复制到我们project的overlay-dfu.conf 文件,需要更改格式,如下:
# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
#Enable MCUBOOT bootloader build in the application
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
# Enable the Bluetooth mcumgr transport (unauthenticated).
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
# transmitted with the maximum possible MTU value: 498 bytes.
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
# Enable the Shell mcumgr transport.
#CONFIG_BASE64=y
#CONFIG_SHELL=y
#CONFIG_SHELL_BACKEND_SERIAL=y
#CONFIG_MCUMGR_TRANSPORT_SHELL=y
# #if (SETTINGS_FCB || SETTINGS_NVS)
# # Enable support for the storage erase operation only when the storage
# # partition is created by the Partition Manager.
# CONFIG_MCUMGR_GRP_ZBASIC=y
# CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y
# #endif # (SETTINGS_FCB || SETTINGS_NVS)
以上配置测试通过。