NCS 3.4.0, nRF91, DFU without external flash and without SECURE_BOOT is broken

NCS 3.4.0, nRF91, no SECURE_BOOT, no nordic,pm-ext-flash.

There is a bug in selecting the UPLOAD_FLASH_AREA_LABEL, see my ticket in the zepyhr project.

That was unfortunately closed with the remark, that it must be handled here in the DevZone.

In short:

subsys/dfu/img_util/flash_img.c uses

#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && (CONFIG_TFM_MCUBOOT_IMAGE_NUMBER == 2)
#define UPLOAD_FLASH_AREA_LABEL slot1_ns_partition
#else
#if PARTITION_EXISTS(slot1_partition) && \
    PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition)
#define UPLOAD_FLASH_AREA_LABEL slot1_partition
#else
#define UPLOAD_FLASH_AREA_LABEL slot0_partition
#endif
#endif

but the app runs from slot0_ns_partition, therefore not slot1_partition is used for uploading, it uses slot0_partition.

Using slot0_partition will then break DFU, because the running app will overwrite itself. 

 

Parents
  • Hi Achim, 

    I have looked into the problem, and it seems like the code snippet below is triggered to be false, since the app is not running in slot0_partition, but in slot0_ns_partition. 

    #if PARTITION_EXISTS(slot1_partition) && \
        PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition)

    Can you change the if sentence to this instead or something similar to see if it works? 

    #if PARTITION_EXISTS(slot1_partition) && \
    
    	(PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition) ||  PARTITION_IS_RUNNING_APP_PARTITION(slot0_ns_partition))
     

    Regards,

    Nissanth Karunanithy

  • I already did that. It solves the issue.

    Though this is somehow the "continue" of an other ticket some months ago, I recommend to add also a:

    "chosen zephyr,dfu-upload-partition"

    to have the possiblity to overwrite the "automatic selection".

Reply Children
Related