nRF52832合并BLE和UART空中升级Bootloader移植记录

本文记录了在MDK5环境下,将pca10040_ble_debug和pca10040_uart_debug工程合并,创建支持BLE和UART空中升级的Bootloader的过程。涉及文件添加、宏定义修改、编译错误解决,以及DFU升级包的制作和烧录方法。
摘要由CSDN通过智能技术生成

编译环境:MDK5.25
移植例程:pca10040_ble_debug和pca10040_uart_debug
PC端UART升级master:官方的nrfutil和博客Nordic nRF5 串口固件更新例子(C代码)

一、用mdk打开pca10040_ble_debug工程
目录:…\nRF5_SDK_15.3.0_59ac345\examples\dfu\secure_bootloader\pca10040_ble_debug\arm5_no_packs

二、由于bootloader采用了加密的方式进行升级,升级前比对密匙,正确则进行DFU操作,否则返回错误,具体参照前面网友的博客
三、添加文件
在nRF_DFU目录下添加nrf_dfu_serial.c nrf_dfu_serial_uart.c两个文件
在这里插入图片描述
在nRF_Drivers目录下添加nrf_drv_uart.c nrf_nvic.c nrf_soc.c nrfx_prs.c nrfx_uart.c nrfx_uarte.c
在这里插入图片描述
在nRF_Libraries目录中添加slip.c
在这里插入图片描述
在nRF_Log目录中添加nrf_log_backend_uart.c
在这里插入图片描述
四、往MDK添加宏定义
MBR_PRESENT DFU_UART_SUPPORT_EN
在这里插入图片描述
五、打开sdk_config.h文件,在文件尾部添加一下宏定义开关,有相同的部分可以删掉,由于官方做了非定义识别,所以也可以不删除

//
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 增加Serial DFU(UART DFU)刷机功能部分 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//
#if defined (DFU_UART_SUPPORT_EN)

// <q> SLIP_ENABLED  - slip - SLIP encoding and decoding
 

#ifndef SLIP_ENABLED
#define SLIP_ENABLED 1
#endif

// <h> nrf_dfu_serial_uart - UART DFU transport

//==========================================================
// <q> NRF_DFU_SERIAL_UART_USES_HWFC  - HWFC configuration
 

#ifndef NRF_DFU_SERIAL_UART_USES_HWFC
#define NRF_DFU_SERIAL_UART_USES_HWFC 1
#endif

// <o> NRF_DFU_SERIAL_UART_RX_BUFFERS - Number of RX buffers. 
// <i> Number of buffers depends on flash access vs.
// <i> transport throughtput. If value is too low it may lead
// <i> to received packets being dropped.

#ifndef NRF_DFU_SERIAL_UART_RX_BUFFERS
#define NRF_DFU_SERIAL_UART_RX_BUFFERS 3
#endif



// <h> nRF_Drivers 

//==========================================================
// <e> NRFX_PRS_ENABLED - nrfx_prs - Peripheral Resource Sharing module
//==========================================================
#ifndef NRFX_PRS_ENABLED
#define NRFX_PRS_ENABLED 1
#endif
// <q> NRFX_PRS_BOX_0_ENABLED  - Enables box 0 in the module.
 

#ifndef NRFX_PRS_BOX_0_ENABLED
#define NRFX_PRS_BOX_0_ENABLED 0
#endif

// <q> NRFX_PRS_BOX_1_ENABLED  - Enables box 1 in the module.
 

#ifndef NRFX_PRS_BOX_1_ENABLED
#define NRFX_PRS_BOX_1_ENABLED 0
#endif

// <q> NRFX_PRS_BOX_2_ENABLED  - Enables box 2 in the module.
 

#ifndef NRFX_PRS_BOX_2_ENABLED
#define NRFX_PRS_BOX_2_ENABLED 0
#endif

// <q> NRFX_PRS_BOX_3_ENABLED  - Enables box 3 in the module.
 

#ifndef NRFX_PRS_BOX_3_ENABLED
#define NRFX_PRS_BOX_3_ENABLED 0
#endif

// <q> NRFX_PRS_BOX_4_ENABLED  - Enables box 4 in the module.
 

#ifndef NRFX_PRS_BOX_4_ENABLED
#define NRFX_PRS_BOX_4_ENABLED 1
#endif

// <e> NRFX_PRS_CONFIG_LOG_ENABLED - Enables logging in the module.
//==========================================================
#ifndef NRFX_PRS_CONFIG_LOG_ENABLED
#define NRFX_PRS_CONFIG_LOG_ENABLED 0
#endif
// <o> NRFX_PRS_CONFIG_LOG_LEVEL  - Default Severity level
 
// <0=> Off 
// <1=> Error 
// <2=> Warning 
// <3=> Info 
// <4=> Debug 

#ifndef NRFX_PRS_CONFIG_LOG_LEVEL
#define NRFX_PRS_CONFIG_LOG_LEVEL 3
#endif

// <o> NRFX_PRS_CONFIG_INFO_COLOR  - ANSI escape code prefix.
 
// <0=> Default 
// <1=> Black 
// <2=> Red 
// <3=> Green 
// <4=> Yellow 
// <5=> Blue 
// <6=> Magenta 
// <7=> Cyan 
// <8=> White 

#ifndef NRFX_PRS_CONFIG_INFO_COLOR
#define NRFX_PRS_CONFIG_INFO_COLOR 0
#endif

// <o> NRFX_PRS_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
 
// <0=> Default 
// <1=> Black 
// <2=> Red 
// <3=> Green 
// <4=> Yellow 
// <5=> Blue 
// <6=> Magenta 
// <7=> Cyan 
// <8=> White 

#ifndef NRFX_PRS_CONFIG_DEBUG_COLOR
#define NRFX_PRS_CONFIG_DEBUG_COLOR 0
#endif

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值