Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions boot/boot_serial/src/boot_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@

BOOT_LOG_MODULE_DECLARE(mcuboot);

#if !(defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \
defined(MCUBOOT_FIRMWARE_LOADER) || \
defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD))
#define BOOT_IMAGE_HAS_STATUS_FIELDS
#endif

#ifndef ARRAY_SIZE
#define ARRAY_SIZE ZCBOR_ARRAY_SIZE
#endif
Expand Down Expand Up @@ -914,8 +920,10 @@ bs_upload(char *buf, int len)
* erase has stopped to let us know whether erase
* is needed to be able to write current chunk.
*/
#ifdef BOOT_IMAGE_HAS_STATUS_FIELDS
static struct flash_sector status_sector;
#endif
#endif /* MCUBOOT_ERASE_PROGRESSIVELY */
#ifdef MCUBOOT_SWAP_USING_OFFSET
static uint32_t start_off = 0;
#endif
Expand Down Expand Up @@ -988,7 +996,7 @@ bs_upload(char *buf, int len)
#endif

curr_off = 0;
#ifdef MCUBOOT_ERASE_PROGRESSIVELY
#if defined(MCUBOOT_ERASE_PROGRESSIVELY) && defined(BOOT_IMAGE_HAS_STATUS_FIELDS)
/* Get trailer sector information; this is done early because inability to get
* that sector information means that upload will not work anyway.
* TODO: This is single occurrence issue, it should get detected during tests
Expand Down Expand Up @@ -1167,7 +1175,7 @@ bs_upload(char *buf, int len)
if (rc == 0) {
curr_off += img_chunk_len + rem_bytes;
if (curr_off == img_size) {
#ifdef MCUBOOT_ERASE_PROGRESSIVELY
#if defined(MCUBOOT_ERASE_PROGRESSIVELY) && defined(BOOT_IMAGE_HAS_STATUS_FIELDS)
/* Assure that sector for image trailer was erased. */
/* Check whether it was erased during previous upload. */
off_t start = flash_sector_get_off(&status_sector);
Expand Down