Skip to content

Commit 1e0c544

Browse files
davidvinczed3zd3z
authored andcommitted
imgtool: Set RAM_LOAD flag in header when needed
Set the RAM_LOAD flag in the image header when a load address was passed to the imgtool script, indicating that the image should be loaded into RAM and run from there. Change-Id: Id9d2c179d7fa1ff7d15cf671c09c61b5b78c88a8 Signed-off-by: David Vincze <[email protected]>
1 parent 7973f57 commit 1e0c544

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

scripts/imgtool/image.py

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
IMAGE_F = {
5151
'PIC': 0x0000001,
5252
'NON_BOOTABLE': 0x0000010,
53+
'RAM_LOAD': 0x0000020,
5354
'ENCRYPTED': 0x0000004,
5455
}
5556

@@ -432,6 +433,10 @@ def add_header(self, enckey, protected_tlv_size):
432433
flags = 0
433434
if enckey is not None:
434435
flags |= IMAGE_F['ENCRYPTED']
436+
if self.load_addr != 0:
437+
# Indicates that this image should be loaded into RAM
438+
# instead of run directly from flash.
439+
flags |= IMAGE_F['RAM_LOAD']
435440

436441
e = STRUCT_ENDIAN_DICT[self.endian]
437442
fmt = (e +

scripts/imgtool/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def convert(self, value, param, ctx):
231231
@click.option('-x', '--hex-addr', type=BasedIntParamType(), required=False,
232232
help='Adjust address in hex output file.')
233233
@click.option('-L', '--load-addr', type=BasedIntParamType(), required=False,
234-
help='Load address for image when it is in its primary slot.')
234+
help='Load address for image when it should run from RAM.')
235235
@click.option('--save-enctlv', default=False, is_flag=True,
236236
help='When upgrading, save encrypted key TLVs instead of plain '
237237
'keys. Enable when BOOT_SWAP_SAVE_ENCTLV config option '

0 commit comments

Comments
 (0)