2.3.106. READFILE

Reads a file into target memory.

Syntax

READFILE ,obj [,nowarn] filename [[=]address]

READFILE ,{raw|raw8|raw16|raw32} [,nowarn] filename [=]address

READFILE ,ascii[,opts] [,nowarn] filename [[=]address|address-range]

where:

obj

The file is an executable file in the standard target format. For ARM targets, this is ARM-ELF.

raw

Read the file as raw data, using the most efficient access size for the target.

Note

Use this option in situations where the length of data is not a multiple of the specified access size.

raw8

Read the file as raw data, one byte for each byte of memory.

raw16

Read the file as raw data, 16 bits for each 16 bits of memory.

raw32

Read the file as raw data, 32 bits for each 32 bits of memory.

Note

You must specify an address with all raw qualifiers.

ascii

The file is a stream of ASCII digits separated by whitespace. The interpretation of the digits is specified by other qualifiers (see the opts qualifier). The starting address of the file must be specified in a one line header in one of the following ways:

[start]

The start address.

[start,end]

The start address, a comma, and the end address.

[start,+len]

The start address, a comma, and the length.

[start,end,size]

The start address, a comma, the end address, a comma, and the size of each value (8, 16, or 32 bits). This is the format used by the WRITEFILE command.

If the size of the items in the file is not specified, the debugger determines the size by examining the number of white-space separated significant digits in the first data value. For example, if the first data value is 00A0, the size is set to 16-bits.

opts

Optional qualifiers available for use with the ascii qualifier:

byte

The file is a stream of 8-bit values that are written to target memory without extra interpretation.

half_word | word

The file is a stream of 16-bit values.

long

The file is a stream of 32-bit values.

nowarn

Suppress the display of the large file warning messages, such as:

Downloading n bytes can take a long time. (Hint: Choosing a larger access size may reduce this time) Do it anyway?

filename

The name of the file to be read. The file can be one that you have written with the WRITEFILE command.

The filename must be enclosed in either single or double quotation marks if a pathname is specified, and the pathname must already exist on your system. You can include one or more environment variables in the filename. For example, if MYPATH defines the location C:\Myfiles, you can specify:

readfile,raw '$MYPATH\myfile.dat' 0x8000
address

The starting address in target memory for the load.

address-range

For an ascii file type, the address range to be loaded. The load terminates when the end of the address range is reached.

Note

For targets that support the TrustZone technology, you can prefix the address or address range with S: or N: to indicate Secure World or Normal World addresses.

Description

The READFILE command reads a file, performs a format conversion on its contents if required, and loads the resulting information into target memory.

The types of file and file formats supported depend on the target processor and any loaded DLLs. The type of memory assumed depends on the target processor. For example, ARM architecture-based processors have byte addressable memory.

Examples

The following examples show how to use READFILE:

readfile ,obj 'c:\temp\file.exe'

Reads the contents of the named executable file into memory at its specified start address.

readfile ,ascii,long "c:\temp\file.txt" =0xA000

Reads the contents of the named text file to address 0xA000 in memory. Values are written as words using the target endianness to translate values in the file into bytes in target memory. The file contents can look, for example, like this:

[0x8000,0x8FFF,32]
E28F8090 E898000F E0800008 E0811008 
E0822008 E0833008 E240B001 E242C001 
E1500001 0A00000E E8B00070 E1540005
...

See also

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