BLE DFU with Zephyr OS

Hello,

I'm tring to get OAD DFU working on an nrf52840 using Zephyr OS. Relevant information:

  • Host OS: Ubuntu 22.04, kernel 6.5.0
  • Zephyr SDK Version: 0.16.3
  • MCUBoot Version: 2.0.0

The problem is when I build my project, which I modified from the peripheral_hr project, I get the following build errors:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ west build -p -b nrf52840dk_nrf52840 dfu-oad/ -d build-dfu-oad -- -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"bootloader/mcuboot/root-rsa-2048.pem\" [56/173]-- west build: making build dir /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/build-dfu-oad pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/dfu-oad
-- CMake version: 3.27.4
-- Found Python3: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/.venv/bin/python3 (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /home/thomasokeeffe/.cache/zephyr
-- Zephyr version: 3.5.99 (/home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf52840dk_nrf52840
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.3 (/opt/zephyr-sdk-0.16.3)
-- Found toolchain: zephyr 0.16.3 (/opt/zephyr-sdk-0.16.3)
-- Found Dtc: /opt/zephyr-sdk-0.16.3/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/build-dfu-oad/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/build-dfu-oad/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/build-dfu-oad/zephyr/dts.cmake
Parsing /home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration '/home/thomasokeeffe/Documents/school/drexel/research/CTS_sensor/zephyrproject/dfu-oad/prj.conf'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am able to build and flash the USB DFU example project, and update the image via DFU, so I know my setup is functioning.

I have attached the relevant code and config files. I was attempting to follow this guide: https://getwavecake.com/blog/adding-ota-dfu-to-a-nordic-zephyr-project/. I ran into some problems with the KConfig options, but I think I found a solution to that here: DFU with nrf connect 2.4. However, with those changes I get the above build error. Please let me know what I can do to fix this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* main.c - Application main entry point */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/usb/usb_device.h>
#include <zephyr/bluetooth/bluetooth.h>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

4670.prj.conf