nRF5340: Forbid BT-DFU when only app_update.bin is uploaded

Hi there

My costumer was not able to update the cpunet on a nRF5340.

A lot of troubleshooting now led to the insight, that the costumer used only the app_update.bin file and not the complete .zip folder.

Is there a way to forbid the update on the nRF5340 when the net_core_app_update.bin is missing (so when the app is not using the .zip-folder)?

SDK: v2.6.1

Thank you and best regards

Chris

Parents
  • Hi Chris,

    One way to solve this is to always use the same verion for compatible network and application core images, and build with CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y.

  • Is it correct, that CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y is set in the main prj.conf and not in child_image/mcuboot/prj.conf ?

  • Hi,

    Sorry, I should have specirfied that. The config applies to MCUboot, so you can put it in child_image/mcuboot/prj.conf.

  • Hi Einar

    Thank you for your response.

    When I put CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y in child_image/mcuboot/prj.conf, it says that CONFIG_NRF53_UPGRADE_NETWORK_CORE=y is missing:

    But when I put CONFIG_NRF53_UPGRADE_NETWORK_CORE=y also in child_image/mcuboot/prj.conf, it says that further depedencies are missing:

    If I look into the build/mcuboot/zepyhr/.config:

    CONFIG_SOC_NRF5340_CPUAPP=y but CONFIG_BOOTLOADER_MCUBOOT is not present

    And here https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/exercise-3-fota-over-bluetooth-low-energy/ in Step 6.4 it says that CONFIG_NRF53_UPGRADE_NETWORK_CORE=y goes into the main prj.conf

    Can you help?

  • Hi,

    I have not been able to reproduce this on my end. However, I see it if I add CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y to the application configuration, where is should not be used. Can you make sure you only set CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y in the configuration for MCUboot?

  • I have set CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y in  child_image/mcuboot/prj.conf.

    In the main prj.conf it is not set.

    The compiler gives the warning 

    warning: NRF53_ENFORCE_IMAGE_VERSION_EQUALITY (defined at
    C:/_dev/_lib/ncs_2_6_1/nrf\subsys\bootloader/Kconfig:257) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: NRF53_UPGRADE_NETWORK_CORE (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY and/or
    look up NRF53_ENFORCE_IMAGE_VERSION_EQUALITY in the menuconfig/guiconfig interface. The Application
    Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
    the manual might be helpful too.

    And the update still works with only the app_update.bin file (also with an old one)

    These are the .conf files

    main prj.conf:

    #*****************************************************************************/
    #*                                Logging                                    */
    #*****************************************************************************/
    CONFIG_LOG=y
    # TODO: Belongs this to here, or to debug.conf?
    CONFIG_LOG_RUNTIME_FILTERING=y
    
    #*****************************************************************************/
    #*                                Memory                                     */
    #*****************************************************************************/
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    #*****************************************************************************/
    #*                                C Standard library                         */
    #*****************************************************************************/
    # Use the minimal C library to reduce flash usage
    # TODO: Really check if this is the smallest flash usage
    CONFIG_MINIMAL_LIBC=y
    # More infos: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/develop/languages/c/minimal_libc.html
    
    #*****************************************************************************/
    #*            Hardware support only for application needed, not mcuboot      */
    #*****************************************************************************/
    # PWM for buzzer
    CONFIG_PWM=y
    
    # I2C for MS8891 (Cap-Touch)
    CONFIG_I2C=y
    
    # ADC & SENSOR for NTC-Temp-Sensors
    CONFIG_ADC=y
    CONFIG_SENSOR=y
    
    #*****************************************************************************/
    #*                                Bluetooth & NUS                            */
    #*****************************************************************************/
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    # Enable Dynamic name modification
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    # Set fallback anme
    CONFIG_BT_DEVICE_NAME="HYG2_NA"
    # Maximum character of the device name (HYG2K_ + device_name[19])
    CONFIG_BT_DEVICE_NAME_MAX=25
    # Enable extended advertising for longer device name 
    # (don't forget to set this Config also in cpunet)
    CONFIG_BT_EXT_ADV=y
    # Only allow one device to connect
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    #*****************************************************************************/
    #*                                 FOTA                                      */
    #*****************************************************************************/
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    ## Configs from CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU
    # Must
    CONFIG_MCUMGR=y
    CONFIG_NET_BUF=y
    CONFIG_ZCBOR=y
    CONFIG_CRC=y
    CONFIG_MCUMGR_TRANSPORT_BT=y
    # Needed because secondary firmware on external flash
    CONFIG_STREAM_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH=y
    # Impled by CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
    CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
    # Sets MTU-Size to 495bytes, yay!
    # CONFIG_BT_MAX_CONN=1 in \child_image\multiprotocol_rpmsg.conf needed
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_VALIDATION=y
    # More configs, but not set directly by CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    # Found at comparing .conf with enabled and disabled CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
    CONFIG_MCUMGR_GRP_ZBASIC=y
    CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y
    
    CONFIG_MCUMGR_GRP_ZBASIC_LOG_LEVEL_DEFAULT=y
    CONFIG_STREAM_FLASH_ERASE=y
    
    # Enable updates for the network core
    # Revert of application core is not possible anymore, because netcore can't be reverted
    CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    
    #*****************************************************************************/
    #*                                 Thread                                    */
    #*****************************************************************************/
    # Enable CoAP utils and CoAP protocol
    #CONFIG_COAP=y
    #CONFIG_COAP_UTILS=y
    
    # Generic networking options
    #CONFIG_NETWORKING=y
    
    # L2 OpenThread enabling
    #CONFIG_NET_L2_OPENTHREAD=y
    
    # Network shell
    #CONFIG_SHELL=y
    #CONFIG_OPENTHREAD_SHELL=y
    #CONFIG_SHELL_ARGC_MAX=26
    #CONFIG_SHELL_CMD_BUFF_SIZE=416
    
    # Network sockets
    #CONFIG_NET_SOCKETS=y
    #CONFIG_NET_SOCKETS_POSIX_NAMES=y
    #CONFIG_NET_SOCKETS_POLL_MAX=4
    
    # Same network Master Key for client and server
    #CONFIG_OPENTHREAD_NETWORKKEY="00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff"
    
    #CONFIG_MBEDTLS_SHA1_C=n
    #CONFIG_FPU=y
    
    #*****************************************************************************/
    #*                              Persistent settings                          */
    #*****************************************************************************/
    CONFIG_SETTINGS=y
    CONFIG_NVS=y
    CONFIG_SETTINGS_NVS=y
    # Enable usage of CRC over Data (needs 4 more metadata bytes)
    # TODO: At 2.7.0 CONFIG_NVS_DATA_CRC=y
    # Reduce store and load time
    CONFIG_NVS_LOOKUP_CACHE=y
    # Reduces load time of all setting by 600ms and store of all by 500ms compared to default (128)
    CONFIG_NVS_LOOKUP_CACHE_SIZE=256
    # 64kB for settings see in pm_static.yml
    # Settings are on external flash, because external flash has more erease cycles
    CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y
    
    # Only static settings handlers are used 
    CONFIG_SETTINGS_DYNAMIC_HANDLERS=n
    # BT_SETTINGS need to be active, otherwise BT device name is N/A at advertisement until first connection
    # BT_SETTINGS would not be needed in persistent memory, because bt_dev.name is also stored by app
    # TODO: Invistigate why without BT_SETTINGS advertised device name is N/A (could safe some kBs rom)
    CONFIG_BT_SETTINGS=y
    
    CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y

    child_image/mcuboot/prj.conf

    #*****************************************************************************/
    #*                                Source                                     */
    #*****************************************************************************/
    # TODO: Ask devzone nordic, if only delta is possible
    # Some parts of this file were sourced from 
    # ..ncs_2_6_0\bootloader\mcuboot\boot\zephyr\prj.conf
    
    #*****************************************************************************/
    #*                                Logging                                    */
    #*****************************************************************************/
    CONFIG_LOG=y
    CONFIG_LOG_MODE_MINIMAL=y
    ### Ensure Zephyr logging changes don't use more resources
    CONFIG_LOG_DEFAULT_LEVEL=0
    ### Hide boot banner
    CONFIG_BOOT_BANNER=n
    
    #*****************************************************************************/
    #*                                Debugging                                  */
    #*****************************************************************************/
    # FIXME not for release
    ### Use info log level for MCUBOOT
    CONFIG_MCUBOOT_LOG_LEVEL_INF=y
    ### Show errors, warnings and info of all modules in bootloader 
    CONFIG_LOG_DEFAULT_LEVEL=3
    ### Show boot banner
    CONFIG_BOOT_BANNER=y
    
    #*****************************************************************************/
    #*                                NCS-Defaults                               */
    #*****************************************************************************/
    ### Protect mcuboot partition from write operations
    CONFIG_FPROTECT=y
    
    #*****************************************************************************/
    #*                                Minimal footprint                          */
    #*****************************************************************************/
    ### Decrease footprint by ~4 KB in comparison to CBPRINTF_COMPLETE=y
    CONFIG_CBPRINTF_NANO=y
    # Use the minimal C library to reduce flash usage
    CONFIG_MINIMAL_LIBC=y
    
    #*****************************************************************************/
    #*                     Simultaenous multi-core updates                       */
    #*****************************************************************************/
    CONFIG_MAIN_STACK_SIZE=10240
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=2
    CONFIG_BOOT_UPGRADE_ONLY=y
    CONFIG_PCD_APP=y
    
    # Needed so that it gets SPI-Drivers
    CONFIG_MULTITHREADING=y
    
    ### Dependencies for CONFIG_NRF53_MULTI_IMAGE_UPDATE
    CONFIG_FLASH=y
    CONFIG_FLASH_SIMULATOR=y
    CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
    CONFIG_FLASH_SIMULATOR_STATS=n
    
    # Make update more robust, e.g. no update when only app_update.bin is uploaded
    CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y
    
    #*****************************************************************************/
    #*                     Custom-key for boot-signature                         */
    #*****************************************************************************/
    # Key files see in boards folder
    CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y 

  • Could you give an example based on e.g. https://github.com/NordicDeveloperAcademy/ncs-inter/tree/main/lesson8/inter_less8_exer3_solution  with SDK 2.6.1?

    When I add CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y to child_image/mcuboot.conf in the example, I still get this warning

    warning: NRF53_ENFORCE_IMAGE_VERSION_EQUALITY (defined at
    C:/_dev/_lib/ncs_2_6_1/nrf\subsys\bootloader/Kconfig:257) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: NRF53_UPGRADE_NETWORK_CORE (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY and/or
    look up NRF53_ENFORCE_IMAGE_VERSION_EQUALITY in the menuconfig/guiconfig interface. The Application
    Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
    the manual might be helpful too.

Reply
  • Could you give an example based on e.g. https://github.com/NordicDeveloperAcademy/ncs-inter/tree/main/lesson8/inter_less8_exer3_solution  with SDK 2.6.1?

    When I add CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y to child_image/mcuboot.conf in the example, I still get this warning

    warning: NRF53_ENFORCE_IMAGE_VERSION_EQUALITY (defined at
    C:/_dev/_lib/ncs_2_6_1/nrf\subsys\bootloader/Kconfig:257) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: NRF53_UPGRADE_NETWORK_CORE (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY and/or
    look up NRF53_ENFORCE_IMAGE_VERSION_EQUALITY in the menuconfig/guiconfig interface. The Application
    Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
    the manual might be helpful too.

Children
Related