Commit 2c88e69b authored by Christopher Collins's avatar Christopher Collins Committed by ccollins476ad
Browse files

Add some more debug logging

parent 2adef70e
Loading
Loading
Loading
Loading
+9
Changes for boot/bootutil/src/bootutil_misc.c: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -394,6 +394,8 @@ boot_write_magic(const struct flash_area *fap)

    off = boot_magic_off(fap);

    BOOT_LOG_DBG("writing magic; fa_id=%d off=0x%x (0x%x)",
                 fap->fa_id, off, fap->fa_off + off);
    rc = flash_area_write(fap, off, boot_img_magic, BOOT_MAGIC_SZ);
    if (rc != 0) {
        return BOOT_EFLASH;
@@ -414,9 +416,13 @@ boot_write_flag(int flag, const struct flash_area *fap)
    switch (flag) {
    case BOOT_FLAG_COPY_DONE:
        off = boot_copy_done_off(fap);
        BOOT_LOG_DBG("writing copy_done; fa_id=%d off=0x%x (0x%x)",
                     fap->fa_id, off, fap->fa_off + off);
        break;
    case BOOT_FLAG_IMAGE_OK:
        off = boot_image_ok_off(fap);
        BOOT_LOG_DBG("writing image_ok; fa_id=%d off=0x%x (0x%x)",
                     fap->fa_id, off, fap->fa_off + off);
        break;
    default:
        return BOOT_EBADARGS;
@@ -467,6 +473,9 @@ boot_write_swap_size(const struct flash_area *fap, uint32_t swap_size)
    memset(buf, erased_val, BOOT_MAX_ALIGN);
    memcpy(buf, (uint8_t *)&swap_size, sizeof swap_size);

    BOOT_LOG_DBG("writing swap_size; fa_id=%d off=0x%x (0x%x)",
                 fap->fa_id, off, fap->fa_off + off);

    rc = flash_area_write(fap, off, buf, align);
    if (rc != 0) {
        return BOOT_EFLASH;
+9 −1
Changes for boot/bootutil/src/loader.c: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -975,6 +975,8 @@ boot_status_init(const struct flash_area *fap, const struct boot_status *bs)
    struct boot_swap_state swap_state;
    int rc;

    BOOT_LOG_DBG("initializing status; fa_id=%d", fap->fa_id);

    rc = boot_read_swap_state_by_id(FLASH_AREA_IMAGE_SECONDARY, &swap_state);
    assert(rc == 0);

@@ -1013,6 +1015,8 @@ boot_erase_trailer_sectors(const struct flash_area *fap)
    uint32_t sz;
    int rc;

    BOOT_LOG_DBG("erasing trailer; fa_id=%d", fap->fa_id);

    switch (fap->fa_id) {
    case FLASH_AREA_IMAGE_PRIMARY:
        slot = BOOT_PRIMARY_SLOT;
@@ -1101,6 +1105,7 @@ boot_swap_sectors(int idx, uint32_t sz, struct boot_status *bs)
    assert (rc == 0);

    if (bs->state == BOOT_STATUS_STATE_0) {
        BOOT_LOG_DBG("erasing scratch area");
        rc = boot_erase_sector(fap_scratch, 0, sz);
        assert(rc == 0);

@@ -1289,6 +1294,7 @@ boot_copy_image(struct boot_status *bs)
     * image is written without a trailer as is the case when using newt, the
     * trailer that was left might trigger a new upgrade.
     */
    BOOT_LOG_DBG("erasing secondary header");
    rc = boot_erase_sector(fap_secondary_slot,
                           boot_img_sector_off(&boot_data,
                                   BOOT_SECONDARY_SLOT, 0),
@@ -1296,6 +1302,7 @@ boot_copy_image(struct boot_status *bs)
                                   BOOT_SECONDARY_SLOT, 0));
    assert(rc == 0);
    last_sector = boot_img_num_sectors(&boot_data, BOOT_SECONDARY_SLOT) - 1;
    BOOT_LOG_DBG("erasing secondary trailer");
    rc = boot_erase_sector(fap_secondary_slot,
                           boot_img_sector_off(&boot_data,
                                   BOOT_SECONDARY_SLOT, last_sector),
@@ -1481,7 +1488,8 @@ boot_swap_image(struct boot_status *bs)

#ifdef MCUBOOT_VALIDATE_PRIMARY_SLOT
    if (boot_status_fails > 0) {
        BOOT_LOG_WRN("%d status write fails performing the swap", boot_status_fails);
        BOOT_LOG_WRN("%d status write fails performing the swap",
                     boot_status_fails);
    }
#endif