2.3.61. FILL

The FILL command fills a memory block with values.

Syntax

FILL [{/B|/H|/W|/8|/16|/32}] addressrange ={expression | expressionlist}

where:

/B, , /8

Sets the fill size to byte (8 bits).

If the processor naturally addresses bytes (for example, ARM7TDMI) then this is the default setting. However, CEVA and ZSP DSPs address words of 16 bits, so /H is the default for CEVA and ZSP DSPs.

/H, , /16

Sets the fill size to halfword (16 bits).

/W, , /32

Sets the fill size to word (32 bits).

addressrange

Specifies the range of addresses that identify the memory contents to be filled with the pattern. The start and the end of the range is included in the range. For example a byte fill from 0x400..0x500 writes to 0x400 and to 0x500. See Specifying address ranges for more details on address ranges.

expression

Specifies the pattern used to fill memory. The expression can be:

  • a decimal or hexadecimal number

  • a debugger expression, for example a math calculation

  • a string enclosed in quotation marks.

If you use a quoted string:

  • each character of the string is treated as a byte value in an expressionlist

  • no C-style zero terminator byte is written to memory.

expressionlist

Specifies the pattern used to fill memory. An expressionlist is a sequence of values separated by commas, for example:

0x20,0x40,0x20

Note

All expressions in an expression string are padded or truncated to the size specified by the size qualifiers if they do not fit the specified size evenly. This also applies to each character of a string.

Description

The FILL command fills a memory block with values obtained from evaluating an expression or list of expressions. The size qualifier is used to determine the size of each element of expressionlist.

If the number of values in expressionlist is less than the number of bytes in the specified address range, the debugger repeatedly writes the list to memory until all of the designated memory locations are filled.

If more values than can be contained in the specified address range are given, the last repetition is completed before the process stops, so up to (length(expressionlist)-1) bytes, halfwords or words might be written beyond the range end address.

If you specify an address range with equal start and end addresses, the memory at that address is modified. If an expression is not specified, the debugger acts as if =0 had been specified as the expression.

The FILL command runs synchronously unless background access to target memory is supported. Use the WAIT command to force it to run synchronously.

Examples

The following examples show how to use FILL:

fill 0x1000..0x1004="hello"

Writes hello in the locations 0x1000...0x1004.

fill 0x1000..0x1001="hello"

Writes hello in the locations 0x1000...0x1004.

fill 0x1000..0x1013

Writes as bytes the value 0 to locations 0x1000...0x1013.

fill /h 0x1000..0x1014

Writes the 16-bit value 0 to locations 0x1000...0x1014.

fill 0x1000..0x1013="hello"

Writes hellohellohellohello in the locations 0x1000...0x1013.

fill /w 0x2032..0x2053=0xDEADC0DE

For a little-endian memory system, writes 0xDE to 0x2032, 0xC0 to 0x2033, 0xAD to 0x2034, 0xDE to 0x2035 and on to: 0xDE to 0x2052, 0xC0 to 0x2053, 0xAD to 0x2054, and 0xDE to 0x2055.

fill 0x3000..0x4756 =0xEA000000/2

Writes 0x00 to 0x3000..0x4576. The value of 0xEA000000/2 is calculated as 0x75000000. Because fill defaults to a byte expression width, this is then truncated to 0x00 and written.

fill /32 0x3000..0x4756 =0xEA000000

Writes 1373 ARM processor NOP instructions to memory, changing locations 0x3000..0x4578, and so writing 2 bytes more than the specified range.

See also

The following commands provide similar or related functionality:

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0175G
Non-Confidential