nRF52832 BLE_DFU空中升级OTA(三)准备升级工程(SDK14.2.0)
准备需要加入DFU功能的工程
在工程main文件services_init函数中加入DFU服务
uint32_t err_code; // Initialize the async SVCI interface to bootloader.
err_code = ble_dfu_buttonless_async_svci_init();
//APP_ERROR_CHECK(err_code);
if(NRF_ERROR_NO_MEM != err_code)
{
ble_dfu_buttonless_init_t dfus_init =
{
.evt_handler = ble_dfu_evt_handler
}; err_code = ble_dfu_buttonless_init(&dfus_init);
APP_ERROR_CHECK(err_code);
}
加入DFU事件处理函数
// YOUR_JOB: Update this code if you want to do anything given a DFU event (optional).
/**@brief Function for handling dfu events from the Buttonless Secure DFU service
*
* @param[in] event Event from the Buttonless Secure DFU service.
*/
static void ble_dfu_evt_handler(ble_dfu_buttonless_evt_type_t event)
{
switch (event)
{
case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE:
NRF_LOG_INFO("Device is preparing to enter bootloader mode.");
// YOUR_JOB: Disconnect all bonded devices that currently are connected.
// This is required to receive a service changed indication
// on bootup after a successful (or aborted) Device Firmware Update.
break; case BLE_DFU_EVT_BOOTLOADER_ENTER:
// YOUR_JOB: Write app-specific unwritten data to FLASH, control finalization of this
// by delaying reset by reporting false in app_shutdown_handler
NRF_LOG_INFO("Device will enter bootloader mode.");
break; case BLE_DFU_EVT_BOOTLOADER_ENTER_FAILED:
NRF_LOG_ERROR("Request to enter bootloader mode failed asynchroneously.");
// YOUR_JOB: Take corrective measures to resolve the issue
// like calling APP_ERROR_CHECK to reset the device.
break; case BLE_DFU_EVT_RESPONSE_SEND_ERROR:
NRF_LOG_ERROR("Request to send a response to client failed.");
// YOUR_JOB: Take corrective measures to resolve the issue
// like calling APP_ERROR_CHECK to reset the device.
APP_ERROR_CHECK(false);
break; default:
NRF_LOG_ERROR("Unknown event from ble_dfu_buttonless.");
break;
}
}
加入几个必要的文件到工程
SDK_14.2.0工程\components\ble\ble_services\ble_dfu下的
SDK_14.2.0工程\components\libraries\bootloader\dfu下的
并加入以下头文件路径
SDK_14.2.0工程\components\libraries\bootloader\dfu
SDK_14.2.0工程\components\libraries\svc
Main.c 头文件中加入
#include "ble_dfu.h"
记得修改sdk_config.h中NRF_SDH_BLE_VS_UUID_COUNT
// <o> NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs.
#ifndef NRF_SDH_BLE_VS_UUID_COUNT
#define NRF_SDH_BLE_VS_UUID_COUNT 1 //默认为0
#endif
开启RTT打印LOG
//==========================================================
// <e> NRF_LOG_ENABLED - Logging module for nRF5 SDK
//==========================================================
#ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED 1
#endif
以及
//==========================================================
// <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
//==========================================================
#ifndef NRF_LOG_BACKEND_RTT_ENABLED
#define NRF_LOG_BACKEND_RTT_ENABLED 1
#endif
编译一下,下载观察RTT信息修改RAM地址,再次编译后没有问题,就可以用新生成的hex文件来制作升级zip了。
nRF52832 BLE_DFU空中升级OTA(三)准备升级工程(SDK14.2.0)的更多相关文章
- nRF52832 BLE_DFU空中升级OTA(二)编译下载(SDK14.2.0)
上一篇配置好了开发环境,现在就可以试着跑一下例程了,这里需要两个例程,一个是bootloader的,一个是应用程序的,其路径分别为: bootloader:SDK_14.2.0工程\examples\ ...
- nRF52832 BLE_DFU空中升级OTA(一)安装软件(SDK14.2.0)
准备工作,需要安装好几个软件,详细的过程请参考下面的文章(http://www.cnblogs.com/iini/p/9314246.html)这里说的非常详细,而且也有工具在云盘,对于初学者非常友好 ...
- OTA制作及升级过程笔记【转】
本文转载自:http://www.it610.com/article/5752570.htm 1.概述 1.1 文档概要 前段时间学习了AndroidRecovery模式及OTA升级过程,为加深理 ...
- APMServ升级php 与 Wamp升级PHP版本到5.3
方法一:(我亲测试,没问题)首先下载:php-5.3.1-Win32-VC6-x86.ziphttp://windows.php.net/downloads/releases/archives/ 解压 ...
- 【转】升级还是权谋?从USB PD 2.0到3.0
原文出处 http://www.eetop.cn/blog/html/43/n-433743.html 如同iPhone的出现,才让智能机真正主导手机市场一样,Type-C口发布后,USB PD才正式 ...
- oracle数据库psu升级(本实验是将10.2.0.3.12升级到10.2.0.3.15)
psu升级(本实验是将10.2.0.3.12升级到10.2.0.3.15) 一.解压安装包自定义存放路径为/home/oracle/yjb/psu/10.2.0.3.15cd /home/oracle ...
- Taurus.MVC 微服务框架 入门开发教程:项目部署:3、微服务应用程序版本升级:全站升级和局部模块升级。
系列目录: 本系列分为项目集成.项目部署.架构演进三个方向,后续会根据情况调整文章目录. 本系列第一篇:Taurus.MVC V3.0.3 微服务开源框架发布:让.NET 架构在大并发的演进过程更简单 ...
- 转载: Centos7 升级python3,解决升级后不兼容问题
Centos7配置更新国内yum源 http://blog.csdn.net/qingguiyu/article/details/50721956 Centos7 升级python3,解决升级后不兼容 ...
- Ubuntu升级软件和ubuntu升级系统的命令
sudo apt-get update: 升级安装包相关的命令,刷新可安装的软件列表(但是不做任何实际的安装动作) sudo apt-get upgrade: 进行安装包的更新(软件版本的升级) su ...
随机推荐
- linux Mint 安装网易云音乐
第一天从官网下来了最新版netease-cloud-music_1.1.0_amd64_ubuntu.deb安装,用的挺好的,第二天就打不开了郁闷,查了下很多人都遇到了这样的问题,需要root权限运行 ...
- 安装Xcode主题
安装Xcode主题 下载地址 https://github.com/YouXianMing/Xcode-Themes 安装教程 1. 安装文件夹中的字体 2. 如下图,执行 ./cp_themes.s ...
- RCLighting
RCLighting https://github.com/RidgeCorn/RCLighting 效果: 真机测试的效率: 看了源码,其实原理很简单: ====================== ...
- Redis 集群缓存测试要点--关于 线上 token 失效 BUG 的总结
在测试账户系统过程中遇到了线上大面积用户登录态失效的严重问题,事后对于其原因及测试盲点做了一些总结记录以便以后查阅,总结分为以下7点,其中原理性的解释有些摘自网络. 1.账户系统token失效问题复盘 ...
- webpack笔记三 管理输出
webpack笔记三 管理输出 增加src/print.js: export default function printMe() { console.log('I get called from p ...
- 初探BeEF
1.什么是BeEF? 就是 The Browser Exploitation Framework 的缩写,意在通过一些手段,控制对方的浏览器. 里面集成了很多模块,能够获取很多东西,有cookie,浏 ...
- Requests中文乱码解决方案
分析: r = requests.get(“http://www.baidu.com“) **r.text返回的是Unicode型的数据. 使用r.content返回的是bytes型的数据. 也就是说 ...
- Why Reactive(Cocoa)?-时间线、输入、输出、复杂性、异步、状态、聚合
To put it another way, the output at any one time is the result of combining all inputs. The output ...
- P2986 [USACO10MAR]伟大的奶牛聚集Great Cow Gat…
题目描述 Bessie is planning the annual Great Cow Gathering for cows all across the country and, of cours ...
- 2、Spring Cloud - 入门概述
前言: Spring Cloud是什么: 官网说明 SpringCloud,基于SpringBoot提供了一套微服务解决方案,包括服务注册与发现,配置中心, 全链路监控,服务网关,负载均衡,熔断器等组 ...