14.3.1. Changing the value in a memory location

To change memory contents:

  1. 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.

    Figure 14.13. Memory view showing address contents

    Memory view showing address contents

  2. 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.

  3. 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.

    Note

    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.

    Figure 14.14. Memory view showing changed value

    Memory view showing changed value

Example of changing memory values with the Memory view

The following procedure shows how you can change memory locations in the Memory view:

  1. Load the debug version of the dhrystone.axf image.

  2. Click the Locate PC button on the Debug toolbar to view the source file dhry_1.c.

  3. Double-click in the gray margin at line 301 of dhry_1.c. This sets a simple breakpoint.

  4. Click Run to start execution.

  5. 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.

  6. Use the toolbar in the Memory view, to set the start address to 0x886A.

  7. Right-click on a memory cell and select Show ASCII to display the ASCII values, shown in Figure 14.15.

    Figure 14.15. Example memory display

    Example memory display

    The memory locations 0000889F-000088A2 contain the four hexadecimal values 0x33, 0x27, 0x52, and 0x44 corresponding to the string 3’RD.

  8. Change the contents of location 0000889F as follows:

    1. Double-click on the value at 0000889F, that is 0x33.

    2. 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.

  9. Change the value at the location 000088A0, as follows:

    1. Click on the ASCII character ' corresponding to the location 000088A0.

    2. 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:

        Figure 14.16. Memory updated

        Memory updated

  10. 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:

    Figure 14.17. Memory updated

    Memory updated

  11. Double-click on the red marker disc at line 301 of dhry_1.c. This clears the breakpoint.

See also

Copyright © 2002-2011 ARM. All rights reserved.ARM DUI 0153N
Non-ConfidentialID052111