@@ -975,6 +975,8 @@ boot_status_init(const struct flash_area *fap, const struct boot_status *bs)
975975 struct boot_swap_state swap_state ;
976976 int rc ;
977977
978+ BOOT_LOG_DBG ("initializing status; fa_id=%d" , fap -> fa_id );
979+
978980 rc = boot_read_swap_state_by_id (FLASH_AREA_IMAGE_SECONDARY , & swap_state );
979981 assert (rc == 0 );
980982
@@ -1013,6 +1015,8 @@ boot_erase_trailer_sectors(const struct flash_area *fap)
10131015 uint32_t sz ;
10141016 int rc ;
10151017
1018+ BOOT_LOG_DBG ("erasing trailer; fa_id=%d" , fap -> fa_id );
1019+
10161020 switch (fap -> fa_id ) {
10171021 case FLASH_AREA_IMAGE_PRIMARY :
10181022 slot = BOOT_PRIMARY_SLOT ;
@@ -1101,6 +1105,7 @@ boot_swap_sectors(int idx, uint32_t sz, struct boot_status *bs)
11011105 assert (rc == 0 );
11021106
11031107 if (bs -> state == BOOT_STATUS_STATE_0 ) {
1108+ BOOT_LOG_DBG ("erasing scratch area" );
11041109 rc = boot_erase_sector (fap_scratch , 0 , sz );
11051110 assert (rc == 0 );
11061111
@@ -1289,13 +1294,15 @@ boot_copy_image(struct boot_status *bs)
12891294 * image is written without a trailer as is the case when using newt, the
12901295 * trailer that was left might trigger a new upgrade.
12911296 */
1297+ BOOT_LOG_DBG ("erasing secondary header" );
12921298 rc = boot_erase_sector (fap_secondary_slot ,
12931299 boot_img_sector_off (& boot_data ,
12941300 BOOT_SECONDARY_SLOT , 0 ),
12951301 boot_img_sector_size (& boot_data ,
12961302 BOOT_SECONDARY_SLOT , 0 ));
12971303 assert (rc == 0 );
12981304 last_sector = boot_img_num_sectors (& boot_data , BOOT_SECONDARY_SLOT ) - 1 ;
1305+ BOOT_LOG_DBG ("erasing secondary trailer" );
12991306 rc = boot_erase_sector (fap_secondary_slot ,
13001307 boot_img_sector_off (& boot_data ,
13011308 BOOT_SECONDARY_SLOT , last_sector ),
@@ -1481,7 +1488,8 @@ boot_swap_image(struct boot_status *bs)
14811488
14821489#ifdef MCUBOOT_VALIDATE_PRIMARY_SLOT
14831490 if (boot_status_fails > 0 ) {
1484- BOOT_LOG_WRN ("%d status write fails performing the swap" , boot_status_fails );
1491+ BOOT_LOG_WRN ("%d status write fails performing the swap" ,
1492+ boot_status_fails );
14851493 }
14861494#endif
14871495
0 commit comments