The -fill
option is used for filling unused memory
locations with a known value. The usage of this option is:
-fill=[const_width:]fill_expr@address[:end_address]
where:
const_width
has the form wn
and signifies the width (n
bytes) of each constant in
fill_expr
. If const_width
is not specified, the
default value is two bytes. For example, -fill=w1:1
with fill every
unused byte with the value 0x01.fill_expr
can use the syntax (where const and
increment are n-byte constants):const
fill memory with a repeating
constant; i.e., -fill=0xBEEF
becomes 0xBEEF, 0xBEEF, 0xBEEF,
0xBEEF.const+=increment
fill memory with
an incrementing constant; i.e., -fill=0xBEEF+=1
becomes 0xBEEF,
0xBEF0, 0xBEF1, 0xBEF2.const-=increment
fill memory with
a decrementing constant; i.e., -fill=0xBEEF-=0x10
becomes 0xBEEF,
0xBEDF, 0xBECF, 0xBEBF.const,const,...,const
fill
memory with a list of repeating constants; i.e.,
-fill=0xDEAD,0xBEEF
becomes 0xDEAD,0xBEEF,0xDEAD,0xBEEF.fill_expr
result in the
following behavior:@address
fill a specific address with
fill_expr
; i.e., -fill=0xBEEF@0x1000
puts
0xBEEF at address 1000h. If the fill value is wider than the addressing value
specified with -addressing
, then only part of the fill value is
placed in the output. For example, if the addressing is set to 1, the option above
will place 0xEF at address 0x1000 and a warning will be issued.@address:end_address
fill a range
of memory with fill_expr
; i.e.,
-fill=0xBEEF@0:0xFF
puts 0xBEEF in unused addresses between 0
and 255. If the address range (multiplied by the -ADDRESSING
value) is not a multiple of the fill value width, the final location will only use
part of the fill value, and a warning will be issued.The fill values are word-aligned so they start on an address that is a multiple of the fill width. Should the fill value be an instruction opcode, this alignment ensures that the instruction can be executed correctly. Similarly, if the total length of the fill sequence is larger than 1 (and even if the specified width is 1), the fill sequence is aligned to that total length. For example the following fill option, which specifies 2 bytes of fill sequence and a starting address that is not a multiple of 2:
-fill=w1:0x11,0x22@0x11001:0x1100c
will result in the following hex record, where the starting address was filled with the second byte of the fill sequence due to this alignment.
:0C100100221122112211221122112211B1
All constants can be expressed in (unsigned) binary, octal, decimal or hexadecimal, as per normal C syntax, for example, 1234 is a decimal value, 0xFF00 is hexadecimal and FF00 is illegal.