5.7.10.2 Fill Option

The -fill option is used for filling unused (unspecified) memory locations in the output with a known value. The usage of this option is:
--fill=[wwidth:]fill_expr@address:end_address

where the arguments have the following meaning:

wwidth
signifies the decimal width of each constant in the fill_expr and can range from 1 thru 9. If this width is not specified, the default value is two bytes. For example, --fill=w1:0x55@0:0xF with fill every unused byte between address 0 and 0xF with the byte value 0x55, whereas --fill=w2:0x55@0:0xF with fill every unused byte between the same addresses with the value 0x0055.
fill_expr
defines the values to fill and consists of const, which is a base value to place in the first memory location and optionally with increment, which indicates how this base value should change after each use. If the base value specifies more than one byte, these are stored in little-endian byte order. These following show the possible fill expressions:
  • const fill memory with a repeating constant; i.e., --fill=0xBEEF@0-0x1FF fills unused locations starting at address 0 with the values 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, etc.
  • const+=increment fill memory with an incrementing constant; i.e., --fill=0xBEEF+=1@0:0x1FF attempts to fills with the values 0xBEEF, 0xBEF0, 0xBEF1, 0xBEF2, etc. Note that const increments with each location scanned, regardless of whether that location is populated or unused.
  • const-=increment fill memory with a decrementing constant; i.e.,--fill=0xBEEF-=0x10@0:0x1FF attempts to fills with the values 0xBEEF, 0xBEDF, 0xBECF, 0xBEBF, etc. Note that const decrements with each location scanned, regardless of whether that location is populated or unused.
  • const,const,...,const fill memory with a list of repeating constants; i.e., --fill=0xDEAD,0xBEEF@0:0x1FF fills with 0xDEAD, 0xBEEF, 0xDEAD, 0xBEEF, etc.
@address:end_address
fills a specific address range with fill_expr; for example, --fill=0xBEEF@0x1000:0x1001 puts the byte value 0xEF at addresses 0x1000; and --fill=0xBEEF@0xF0:0xFF puts 0xBEEF in unused addresses between 0 and 0xFF, inclusive.