| |||
| Home > Reading and Writing Memory, Registers, and Flash > Examples of interactive operations > Filling memory with a pattern | |||
To fill a specified area of memory with a predefined pattern:
Select Target ? Reload Image to Target to reload
the image dhrystone.axf.
Click on the Src tab to view
the source file dhry_1.c.
Set a default breakpoint by double-clicking on line 301.
Click Run to start execution.
Enter 5000 when asked for the
number of runs.
The program starts and then stops when execution reaches the breakpoint at line 301. The red box marks the location of the PC when execution stops.
Select View ? Memory to display the Memory pane.
Double-click in the address column of the Memory
pane, and enter 0x88A0 to view the memory contents
at that location.
Select Debug ? Memory/Register Operations ? Fill Memory with Pattern... from the Code window main menu to display the Fill Memory with Pattern dialog box, shown in Figure 7.4.
Set up the required memory settings:
Enter
the start address for the memory range to be filled, for example 0x88A0.
If required, use the drop-down arrow to select a previously used start address from the stored list.
By
default, the memory area that is filled is defined by a start address and
a length. Enter the length of the memory block to be filled in this data
field, for example 14 (decimal).
The specified length must be given relative to the data type given in the Size data field.
If the Use Length (Count) check box is unselected, you can specify the address that marks the end of the memory block.
Enter the data type to be used in the file where:
natural indicates
the format specified as native for the debug target
byte indicates support for 8-bit
signed and unsigned byte form
half-word indicates support for
16-bit signed and unsigned halfwords
long-word indicates support for
32-bit signed and unsigned words.
By default, the memory block to be filled is defined by a start address and the length. If this check box is unselected you can specify an address to mark the end of the filled block.
Enter the pattern to be used as the fill, for example:
“AB”
0,1,0,1,0
Strings must be enclosed in quotes.
Click OK to confirm your settings and close the Fill Memory with Pattern dialog box. Memory contents are rewritten and the Memory pane is automatically updated with changed values displayed in blue.
Double-click on the red marker disc to clear the breakpoint at line 301.
When filling memory blocks, you must be aware of the following:
All expressions in an expression string are padded or truncated to the size specified by the Size value if they do not fit the specified size evenly.
If the number of values in an expression string is less than the number of bytes in the specified address range, RealView Debugger repeats the pattern and so might fill an area in excess of the specified block, for example specify a pattern of 10 bytes and a fill area of 16 bytes. RealView Debugger repeats the pattern twice and so fills a block of 20 bytes.
If more values are given than can be contained in the specified address range, excess values are ignored.
If a pattern is not specified, RealView Debugger displays an error message.