Skip to content

Commit 41c6586

Browse files
committed
Revert "boot/bootutil: Split RAM load code to its own file"
This reverts commit 9f1e573. Signed-off-by: Jamie McCrae <[email protected]>
1 parent 45991fe commit 41c6586

File tree

11 files changed

+471
-546
lines changed

11 files changed

+471
-546
lines changed

boot/bootutil/CMakeLists.txt

-6
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,3 @@ target_sources(bootutil
3333
src/swap_scratch.c
3434
src/tlv.c
3535
)
36-
if(CONFIG_BOOT_RAM_LOAD)
37-
target_sources(bootutil
38-
PRIVATE
39-
src/ram_load.c
40-
)
41-
endif()

boot/bootutil/pkg.yml

-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ pkg.ign_files.BOOTUTIL_SINGLE_APPLICATION_SLOT:
4545
- "loader.c"
4646
- "swap_scratch.c"
4747

48-
pkg.ign_files:
49-
- "ram_load.c"
50-
5148
pkg.deps.BOOTUTIL_USE_MBED_TLS:
5249
- "@apache-mynewt-core/crypto/mbedtls"
5350

boot/bootutil/src/bootutil_misc.c

-65
Original file line numberDiff line numberDiff line change
@@ -355,68 +355,3 @@ uint32_t bootutil_max_image_size(const struct flash_area *fap)
355355
return boot_swap_info_off(fap);
356356
#endif
357357
}
358-
359-
/*
360-
* Compute the total size of the given image. Includes the size of
361-
* the TLVs.
362-
*/
363-
#if !defined(MCUBOOT_DIRECT_XIP) && \
364-
(!defined(MCUBOOT_OVERWRITE_ONLY) || \
365-
defined(MCUBOOT_OVERWRITE_ONLY_FAST))
366-
int
367-
boot_read_image_size(struct boot_loader_state *state, int slot, uint32_t *size)
368-
{
369-
const struct flash_area *fap;
370-
struct image_tlv_info info;
371-
uint32_t off;
372-
uint32_t protect_tlv_size;
373-
int area_id;
374-
int rc;
375-
376-
#if (BOOT_IMAGE_NUMBER == 1)
377-
(void)state;
378-
#endif
379-
380-
area_id = flash_area_id_from_multi_image_slot(BOOT_CURR_IMG(state), slot);
381-
rc = flash_area_open(area_id, &fap);
382-
if (rc != 0) {
383-
rc = BOOT_EFLASH;
384-
goto done;
385-
}
386-
387-
off = BOOT_TLV_OFF(boot_img_hdr(state, slot));
388-
389-
if (flash_area_read(fap, off, &info, sizeof(info))) {
390-
rc = BOOT_EFLASH;
391-
goto done;
392-
}
393-
394-
protect_tlv_size = boot_img_hdr(state, slot)->ih_protect_tlv_size;
395-
if (info.it_magic == IMAGE_TLV_PROT_INFO_MAGIC) {
396-
if (protect_tlv_size != info.it_tlv_tot) {
397-
rc = BOOT_EBADIMAGE;
398-
goto done;
399-
}
400-
401-
if (flash_area_read(fap, off + info.it_tlv_tot, &info, sizeof(info))) {
402-
rc = BOOT_EFLASH;
403-
goto done;
404-
}
405-
} else if (protect_tlv_size != 0) {
406-
rc = BOOT_EBADIMAGE;
407-
goto done;
408-
}
409-
410-
if (info.it_magic != IMAGE_TLV_INFO_MAGIC) {
411-
rc = BOOT_EBADIMAGE;
412-
goto done;
413-
}
414-
415-
*size = off + protect_tlv_size + info.it_tlv_tot;
416-
rc = 0;
417-
418-
done:
419-
flash_area_close(fap);
420-
return rc;
421-
}
422-
#endif /* !MCUBOOT_OVERWRITE_ONLY */

boot/bootutil/src/bootutil_priv.h

-11
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ struct flash_area;
5151

5252
#define BOOT_TMPBUF_SZ 256
5353

54-
#define NO_ACTIVE_SLOT UINT32_MAX
55-
5654
/** Number of image slots in flash; currently limited to two. */
5755
#define BOOT_NUM_SLOTS 2
5856

@@ -469,24 +467,15 @@ struct bootsim_ram_info *bootsim_get_ram_info(void);
469467
#define LOAD_IMAGE_DATA(hdr, fap, start, output, size) \
470468
(memcpy((output),(void*)(IMAGE_RAM_BASE + (hdr)->ih_load_addr + (start)), \
471469
(size)), 0)
472-
473-
int boot_load_image_to_sram(struct boot_loader_state *state);
474-
int boot_remove_image_from_sram(struct boot_loader_state *state);
475-
int boot_remove_image_from_flash(struct boot_loader_state *state,
476-
uint32_t slot);
477470
#else
478471
#define IMAGE_RAM_BASE ((uintptr_t)0)
479472

480473
#define LOAD_IMAGE_DATA(hdr, fap, start, output, size) \
481474
(flash_area_read((fap), (start), (output), (size)))
482-
483475
#endif /* MCUBOOT_RAM_LOAD */
484476

485477
uint32_t bootutil_max_image_size(const struct flash_area *fap);
486478

487-
int boot_read_image_size(struct boot_loader_state *state, int slot,
488-
uint32_t *size);
489-
490479
#ifdef __cplusplus
491480
}
492481
#endif

0 commit comments

Comments
 (0)