Skip to content

Commit bc1cb10

Browse files
committed
samples: mcumgr: ble_mcumgr: Move BLE MCUmgr code to separate library
Allows for re-use in applications Signed-off-by: Jamie McCrae <[email protected]>
1 parent 9765926 commit bc1cb10

File tree

11 files changed

+538
-419
lines changed

11 files changed

+538
-419
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/** @file
8+
*
9+
* @defgroup ble_mcumgr BLE MCUmgr Service library
10+
* @{
11+
* @brief Library for handling MCUmgr over BLE.
12+
*/
13+
14+
#ifndef BLE_MCUMGR_H__
15+
#define BLE_MCUMGR_H__
16+
17+
#include <stdint.h>
18+
#include <stdbool.h>
19+
#include <ble.h>
20+
#include <nrf_sdh_ble.h>
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
/**
27+
* @brief Function for initializing the MCUmgr Bluetooth service.
28+
*
29+
* @retval 0 On success.
30+
* @retval -EINVAL Invalid parameters.
31+
*/
32+
int ble_mcumgr_init(void);
33+
34+
#ifdef __cplusplus
35+
}
36+
#endif
37+
38+
#endif /* BLE_MCUMGR_H__ */
39+
40+
/** @} */

samples/mcumgr/ble_mcumgr/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ cmake_minimum_required(VERSION 3.20.0)
99
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1010
project(ble_mcumgr)
1111

12-
zephyr_include_directories(${ZEPHYR_BASE}/subsys/mgmt/mcumgr/util/include)
13-
zephyr_include_directories(${ZEPHYR_BASE}/subsys/mgmt/mcumgr/grp/img_mgmt/include)
14-
zephyr_include_directories(${ZEPHYR_BASE}/subsys/mgmt/mcumgr/transport/include)
1512
target_sources(app PRIVATE
1613
src/main.c
1714
)
18-
zephyr_linker_sources(SECTIONS mcumgr_handler.ld)
19-
zephyr_link_libraries(MCUBOOT_BOOTUTIL)

samples/mcumgr/ble_mcumgr/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
menu "BLE MCUmgr sample"
88

9-
module=BLE_MCUMGR
9+
module=APP
1010
module-dep=LOG
1111
module-str=BLE MCUmgr Sample
1212
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

samples/mcumgr/ble_mcumgr/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
3939
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
4040
CONFIG_NRF_SDH_BLE=y
4141
CONFIG_NRF_SDH=y
42+
CONFIG_BLE_MCUMGR=y
4243

4344
CONFIG_LOG=y
4445
CONFIG_LOG_MODE_MINIMAL=y

0 commit comments

Comments
 (0)