Troubleshooting the Generation of dfu_application.zip in Zephyr Bluetooth Peripheral Sample

Hi
I am working on a peripheral sample located at zephyr/samples/bluetooth, which I modified according to my needs.

I am having trouble generating dfu_appliaction.zip for my application. I have added the thingy53_nrf5340_cpuapp.conf from another sample "peripheral_uart", which I believe is having the config for generating zip. Below is what I have added as a .conf

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
################################################################################
# Application overlay - Thingy:53 DFU

CONFIG_MCUMGR=y
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_MCUMGR_SMP_BT_CONN_PARAM_CONTROL=y

CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Enable custom SMP request to erase settings partition.
CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y

# Increase system workqueue stack size to prevent stack overflows while handling
# SMP requests.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800

CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=502

# Use connection parameters that ensure quick data transfer
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=6
CONFIG_BT_PERIPHERAL_PREF_LATENCY=99
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400

################################################################################
# Bootloader configuration

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION="1.0.0+0"
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

################################################################################
# Enable USB CDC ACM

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n
CONFIG_USB_DEVICE_PRODUCT="Thingy:53 Nordic UART Service sample"
CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x530E
CONFIG_USB_COMPOSITE_DEVICE=y
CONFIG_USB_CDC_ACM=y
CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=4000
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y

After building, this is the error that I am facing 

d:\firmware\zephyr\include\toolchain\gcc.h:77:36: error: static assertion failed: "Missing partitions?"
   77 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
   

d:\firmware\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:45:12: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
   45 |            PM_MCUBOOT_PRIMARY_1_ID :         \

Help me, I need to generate dfu_application.zip for the OTA firmware update.

ncs v1.9.1

  • Hi, 

    Are you using Thingy53, nRF5340DK, or the custom board?

    It seems you remove the external flash setting form thingy53_nrf5340_cpuapp.conf comparing to https://github.com/nrfconnect/sdk-nrf/blob/v1.9.1/samples/bluetooth/peripheral_uart/boards/thingy53_nrf5340_cpuapp.conf#L50-L59 

    If you are going to do simultaneous multi-image dfu, you would need ext. flash. 

    For using thingy53, it would also need the related file under https://github.com/nrfconnect/sdk-nrf/tree/v1.9.1/samples/bluetooth/peripheral_uart/boards like pm_static_thingy53_nrf5340_cpuapp.yml and thingy53_nrf5340_cpuapp.overlay. 

    Regards,
    Amanda H.

  • Are you using Thingy53, nRF5340DK, or the custom board?

    I am using thingy53

    It seems you remove the external flash setting

    Ohh yeah, Now I have added it again in the code and have a look at mine .conf

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    ################################################################################
    # Application overlay - Thingy:53 DFU
    
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    CONFIG_MCUMGR_SMP_BT_CONN_PARAM_CONTROL=y
    
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    
    # Enable custom SMP request to erase settings partition.
    CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
    CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y
    
    # Increase system workqueue stack size to prevent stack overflows while handling
    # SMP requests.
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800
    
    CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    
    # Use connection parameters that ensure quick data transfer
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
    CONFIG_BT_PERIPHERAL_PREF_MAX_INT=6
    CONFIG_BT_PERIPHERAL_PREF_LATENCY=99
    CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
    
    # LEDs are not inverted on Thingy:53
    # CONFIG_DK_LIBRARY_INVERT_LEDS=n
    
    ################################################################################
    # Bootloader configuration
    
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUBOOT_IMAGE_VERSION="1.0.0+0"
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    ################################################################################
    # External flash configuration
    
    CONFIG_NORDIC_QSPI_NOR=y
    CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
    
    # FLASH nop device is enabled to prevent bus faults when mcumgr tries to access
    # simulated partition with network core image data.
    CONFIG_FLASH_NOP_DEVICE=y
    
    ################################################################################
    # # Enable USB CDC ACM
    
    # CONFIG_USB_DEVICE_STACK=y
    # CONFIG_USB_DEVICE_PRODUCT="Thingy:53 Nordic UART Service sample"
    # CONFIG_USB_DEVICE_VID=0x1915
    # CONFIG_USB_DEVICE_PID=0x530E
    # CONFIG_USB_COMPOSITE_DEVICE=y
    # CONFIG_USB_CDC_ACM=y
    # CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y
    # CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024
    CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=4000
    CONFIG_USE_SEGGER_RTT=n
    CONFIG_LOG_BACKEND_RTT=n
    
    # CONFIG_BT_NUS_UART_ASYNC_ADAPTER=y
    # CONFIG_BT_NUS_UART_DEV="CDC_ACM_1"
    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    # # Disable the UARTE0 enabled in default project configuration
    # CONFIG_NRFX_UARTE0=n
    # CONFIG_UART_NRFX=n
    

    Thanks, I have added the required file and now my directory looks like this

    All other errors are resolved except 

  • Hi, 

    Seems you get a "FLASH overflowed" error from mcuboot, you can try to increase the size of the MCUBoot partition to 0x10000 (or more) by setting the CONFIG_PM_PARTITION_SIZE_MCUBOOT in the child_image/mcuboot.conf. Check the file <application>/<build>/mcuboot/zephyr/.config and confirm that CONFIG_PM_PARTITION_SIZE_MCUBOOT got the correct value.

    -Amanda H.

  • You are awesome,

    thanks for the quick help.

    I wish other nordic experts were as helpful as you.

  • I am stuck on another thing.

    Firstly I build the peripheral_lbs from samples and upload that hex to thingy53.<---This is done so that the Bluetooth will be enabled to get connect to the mobile app.

    After that I use the nrf connect mobile app to connect to the board, there I got an option for DFU using the OTA. I select the zip( which is my original code based on the peripheral sample from the zephyr directory) and update the firmware.

    Till the time it is working, but when I again connect it using nrf app, the DFU option disappears.

    I want that the DFU option will be always there so that I can update the firmware again and again for always.

    Help me in achieving that.

Related