dfu: img_util: Upload to slot0 if not running from slot0
Fixes an issue for MCUboot DFU whereby images would always be uploaded to slot1 instead of slot0 meaning that updates would never take effect, but retains uploading to slot1 if the application is running from slot0 Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
parent
edbce504b0
commit
87b1bb8916
@ -23,14 +23,18 @@ LOG_MODULE_REGISTER(flash_img, CONFIG_IMG_MANAGER_LOG_LEVEL);
|
||||
#include <bootutil/bootutil_public.h>
|
||||
#endif
|
||||
|
||||
#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \
|
||||
(FIXED_PARTITION_OFFSET(label) == CONFIG_FLASH_LOAD_OFFSET)
|
||||
|
||||
#include <zephyr/devicetree.h>
|
||||
#ifdef CONFIG_TRUSTED_EXECUTION_NONSECURE
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot1_ns_partition
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot1_ns_partition
|
||||
#else
|
||||
#if FIXED_PARTITION_EXISTS(slot1_partition)
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot1_partition
|
||||
#if FIXED_PARTITION_EXISTS(slot1_partition) && \
|
||||
FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition)
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot1_partition
|
||||
#else
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot0_partition
|
||||
#define UPLOAD_FLASH_AREA_LABEL slot0_partition
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user