@@ -67,17 +67,22 @@ static struct boot_loader_state boot_data;
67
67
static struct image_max_size image_max_sizes [BOOT_IMAGE_NUMBER ] = {0 };
68
68
#endif
69
69
70
+ #if (!defined(MCUBOOT_DIRECT_XIP ) && !defined(MCUBOOT_RAM_LOAD )) || \
71
+ defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO )
70
72
#if !defined(__BOOTSIM__ )
71
73
/* Used for holding static buffers in multiple functions to work around issues
72
74
* in older versions of gcc (e.g. 4.8.4)
73
75
*/
74
76
struct sector_buffer_t {
75
- boot_sector_t * primary ;
76
- boot_sector_t * secondary ;
77
+ boot_sector_t primary [ BOOT_IMAGE_NUMBER ][ BOOT_MAX_IMG_SECTORS ] ;
78
+ boot_sector_t secondary [ BOOT_IMAGE_NUMBER ][ BOOT_MAX_IMG_SECTORS ] ;
77
79
#if MCUBOOT_SWAP_USING_SCRATCH
78
- boot_sector_t * scratch ;
80
+ boot_sector_t scratch [ BOOT_MAX_IMG_SECTORS ] ;
79
81
#endif
80
82
};
83
+
84
+ static struct sector_buffer_t sector_buffers ;
85
+ #endif
81
86
#endif
82
87
83
88
#if (BOOT_IMAGE_NUMBER > 1 )
@@ -303,28 +308,6 @@ boot_version_cmp(const struct image_version *ver1,
303
308
304
309
#if (!defined(MCUBOOT_DIRECT_XIP ) && !defined(MCUBOOT_RAM_LOAD )) || \
305
310
defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO )
306
- #if !defined(__BOOTSIM__ )
307
- static void boot_get_sector_buffers (struct sector_buffer_t * buffers )
308
- {
309
- /* The array of slot sectors are defined here (as opposed to file scope) so
310
- * that they don't get allocated for non-boot-loader apps. This is
311
- * necessary because the gcc option "-fdata-sections" doesn't seem to have
312
- * any effect in older gcc versions (e.g., 4.8.4).
313
- */
314
- static boot_sector_t primary_slot_sectors [BOOT_IMAGE_NUMBER ][BOOT_MAX_IMG_SECTORS ];
315
- static boot_sector_t secondary_slot_sectors [BOOT_IMAGE_NUMBER ][BOOT_MAX_IMG_SECTORS ];
316
- #if MCUBOOT_SWAP_USING_SCRATCH
317
- static boot_sector_t scratch_sectors [BOOT_MAX_IMG_SECTORS ];
318
- #endif
319
-
320
- buffers -> primary = (boot_sector_t * )& primary_slot_sectors ;
321
- buffers -> secondary = (boot_sector_t * )& secondary_slot_sectors ;
322
- #if MCUBOOT_SWAP_USING_SCRATCH
323
- buffers -> scratch = (boot_sector_t * )& scratch_sectors ;
324
- #endif
325
- }
326
- #endif
327
-
328
311
static int
329
312
boot_initialize_area (struct boot_loader_state * state , int flash_area )
330
313
{
@@ -2209,9 +2192,6 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
2209
2192
{
2210
2193
size_t slot ;
2211
2194
struct boot_status bs ;
2212
- #if !defined(__BOOTSIM__ )
2213
- struct sector_buffer_t sector_buffers ;
2214
- #endif
2215
2195
int rc = -1 ;
2216
2196
FIH_DECLARE (fih_rc , FIH_FAILURE );
2217
2197
int fa_id ;
@@ -2238,10 +2218,6 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
2238
2218
(void )has_upgrade ;
2239
2219
#endif
2240
2220
2241
- #if !defined(__BOOTSIM__ )
2242
- boot_get_sector_buffers (& sector_buffers );
2243
- #endif
2244
-
2245
2221
/* Iterate over all the images. By the end of the loop the swap type has
2246
2222
* to be determined for each image and all aborted swaps have to be
2247
2223
* completed.
@@ -2264,9 +2240,9 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
2264
2240
2265
2241
#if !defined(__BOOTSIM__ )
2266
2242
BOOT_IMG (state , BOOT_PRIMARY_SLOT ).sectors =
2267
- & sector_buffers .primary [image_index ];
2243
+ sector_buffers .primary [image_index ];
2268
2244
BOOT_IMG (state , BOOT_SECONDARY_SLOT ).sectors =
2269
- & sector_buffers .secondary [image_index ];
2245
+ sector_buffers .secondary [image_index ];
2270
2246
#if MCUBOOT_SWAP_USING_SCRATCH
2271
2247
state -> scratch .sectors = sector_buffers .scratch ;
2272
2248
#endif
@@ -3463,30 +3439,27 @@ void boot_state_clear(struct boot_loader_state *state)
3463
3439
#if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO )
3464
3440
/**
3465
3441
* Reads image data to find out the maximum application sizes. Only needs to
3466
- * be called in serial recovery mode, as the state informatio is unpopulated
3442
+ * be called in serial recovery mode, as the state information is unpopulated
3467
3443
* at that time
3468
3444
*/
3469
3445
static void boot_fetch_slot_state_sizes (void )
3470
3446
{
3471
- struct sector_buffer_t sector_buffers ;
3472
3447
size_t slot ;
3473
3448
int rc = -1 ;
3474
3449
int fa_id ;
3475
3450
int image_index ;
3476
3451
3477
- boot_get_sector_buffers (& sector_buffers );
3478
-
3479
3452
IMAGES_ITER (BOOT_CURR_IMG (& boot_data )) {
3480
3453
int max_size = 0 ;
3481
3454
3482
3455
image_index = BOOT_CURR_IMG (& boot_data );
3483
3456
3484
3457
BOOT_IMG (& boot_data , BOOT_PRIMARY_SLOT ).sectors =
3485
- & sector_buffers .primary [image_index ];
3458
+ sector_buffers .primary [image_index ];
3486
3459
BOOT_IMG (& boot_data , BOOT_SECONDARY_SLOT ).sectors =
3487
- & sector_buffers .secondary [image_index ];
3460
+ sector_buffers .secondary [image_index ];
3488
3461
#if MCUBOOT_SWAP_USING_SCRATCH
3489
- boot_data .scratch .sectors = sector_buffers .scratch ;;
3462
+ boot_data .scratch .sectors = sector_buffers .scratch ;
3490
3463
#endif
3491
3464
3492
3465
/* Open primary and secondary image areas for the duration
0 commit comments