| |||
| Home > Altering the Target Execution Environment > Changing memory contents > Changing the value in a memory location | |||
To change memory contents:
Open the Memory view, if it is not visible, and set the start address of the memory area you want to view. Figure 14.13 shows and example.
Double-click on the value at the required memory location.
If the ASCII view is displayed, select the character corresponding to the location to enter an ASCII character in that location.
Enter the new value for the location. If you press Esc instead of Enter, then any changes you made in the highlighted field are ignored.
You can enter data values in a format that is different from the display format.
The Memory view is updated, shown in Figure 14.14.
The following procedure shows how you can change memory locations in the Memory view:
Load the debug version
of the dhrystone.axf image.
Click
the Locate PC button on the Debug toolbar
to view the source file dhry_1.c.
Double-click in the gray margin at line 301 of dhry_1.c.
This sets a simple breakpoint.
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.
Use the toolbar in the Memory
view, to set the start address to 0x886A.
Right-click on a memory cell and select Show ASCII to display the ASCII values, shown in Figure 14.15.
The memory locations 0000889F-000088A2 contain
the four hexadecimal values 0x33, 0x27, 0x52,
and 0x44 corresponding to the string 3’RD.
Change the contents of location 0000889F as
follows:
Double-click on the value at 0000889F,
that is 0x33.
Enter 'N (or the equivalent hexadecimal value 0x4E). If you enter the value as a character, you must include the initial quote.
The new value is displayed in blue and the ASCII value changes
from 3 to N.
Change the value at the location 000088A0,
as follows:
Click on the ASCII character ' corresponding
to the location 000088A0.
Type lowercase o. The character is inserted, and cursor moves to the character at the next location:
the new value is displayed in blue
the value at location 0000889F is
colored light blue to show that it was changed on the a previous
update. Figure 14.16 shows
an example:
Type a space followed by 2:
the new value at location 000088A2 is
displayed in blue
the value at location 000088A1 is
colored light blue to show that it was changed on the previous update
the value at location 000088A0 is
colored black.
The string 3'RD has been replaced by No
2. Figure 14.17 shows
an example:
Double-click on the red marker disc at line 301
of dhry_1.c. This clears the breakpoint.