|
77 | 77 |
|
78 | 78 | BOOT_LOG_MODULE_DECLARE(mcuboot);
|
79 | 79 |
|
| 80 | +#if !(defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \ |
| 81 | + defined(MCUBOOT_FIRMWARE_LOADER) || \ |
| 82 | + defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD)) |
| 83 | +#define BOOT_IMAGE_HAS_STATUS_FIELDS |
| 84 | +#endif |
| 85 | + |
80 | 86 | #ifndef ARRAY_SIZE
|
81 | 87 | #define ARRAY_SIZE ZCBOR_ARRAY_SIZE
|
82 | 88 | #endif
|
@@ -914,8 +920,10 @@ bs_upload(char *buf, int len)
|
914 | 920 | * erase has stopped to let us know whether erase
|
915 | 921 | * is needed to be able to write current chunk.
|
916 | 922 | */
|
| 923 | +#ifdef BOOT_IMAGE_HAS_STATUS_FIELDS |
917 | 924 | static struct flash_sector status_sector;
|
918 | 925 | #endif
|
| 926 | +#endif /* MCUBOOT_ERASE_PROGRESSIVELY */ |
919 | 927 | #ifdef MCUBOOT_SWAP_USING_OFFSET
|
920 | 928 | static uint32_t start_off = 0;
|
921 | 929 | #endif
|
@@ -988,7 +996,7 @@ bs_upload(char *buf, int len)
|
988 | 996 | #endif
|
989 | 997 |
|
990 | 998 | curr_off = 0;
|
991 |
| -#ifdef MCUBOOT_ERASE_PROGRESSIVELY |
| 999 | +#if defined(MCUBOOT_ERASE_PROGRESSIVELY) && defined(BOOT_IMAGE_HAS_STATUS_FIELDS) |
992 | 1000 | /* Get trailer sector information; this is done early because inability to get
|
993 | 1001 | * that sector information means that upload will not work anyway.
|
994 | 1002 | * TODO: This is single occurrence issue, it should get detected during tests
|
@@ -1167,7 +1175,7 @@ bs_upload(char *buf, int len)
|
1167 | 1175 | if (rc == 0) {
|
1168 | 1176 | curr_off += img_chunk_len + rem_bytes;
|
1169 | 1177 | if (curr_off == img_size) {
|
1170 |
| -#ifdef MCUBOOT_ERASE_PROGRESSIVELY |
| 1178 | +#if defined(MCUBOOT_ERASE_PROGRESSIVELY) && defined(BOOT_IMAGE_HAS_STATUS_FIELDS) |
1171 | 1179 | /* Assure that sector for image trailer was erased. */
|
1172 | 1180 | /* Check whether it was erased during previous upload. */
|
1173 | 1181 | off_t start = flash_sector_get_off(&status_sector);
|
|
0 commit comments