13.21. Comparing target memory with the contents of a file

You can compare an area of target memory with the contents of a file. For example, you might have a reference file that contains known values for an area of memory, and you want to make sure that the target memory is not corrupted.

Before you can compare target memory with a file, you must have downloaded a memory range into a file as described in Saving memory contents to a file. The file must contain at least the memory range you want to compare against.

To verify target memory with the contents of a file:

  1. Select Debug → Memory/Register Operations → Upload/Download Memory file... from the Code window main menu to display the Upload/Download file from/to Memory dialog box. Figure 13.57 shows an example.

  2. Select Verify Memory and File.

  3. Specify the file to be compared.

  4. In the Type of File section of the dialog box, select the data type to be used in the specified file where:

    • obj specifies an object file in the standard executable target format, for example ARM-ELF for ARM architecture-based targets.

    • raw specifies raw data using the most efficient access size for the target.

    • raw32 specifies a data file as a stream of 32-bit values.

    • raw16 specifies a data file as a stream of 16-bit values.

    • raw8 specifies a data file as a stream of 8-bit values.

    • ascii specifies a space-separated file of hexadecimal values. A header line at the start of the file describes the file format:



      • start and end specifies the address range

      • size is a character that indicates the size of each value, where b is 8 bits, h is 16 bits and l is 32 bits.

  5. Do one of the following:

    • If you selected either the obj or ascii file type, you can optionally enter a signed offset (in bytes) value. This enables you to skip the specified number of bytes from the start of the file.

    • If you selected any other type of file, specify the start address or range of addresses to be compared.

    The resulting addresses must be within the range specified in the memory file.

  6. Click Apply to compare the file contents with the specified memory block.

  7. Click the Cmd tab in the Output view to see the results.

    If there is a mismatch, the first mismatch is identified and the location reported. Any mismatches after this location are not reported, for example:

    verifyfile,raw8,gui "C:\Test_files\memory_file_3.mem"=0x8000..0x9000
    Mismatch at Address 0x000088B6: 0x8E vs 0x8F
  8. Click Close to close the Upload/Download file from/to Memory dialog box.

See also:

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0153K