2.3.152. WRITEFILE

The WRITEFILE command writes the contents of memory to a file, performing a format conversion if necessary.

Syntax

WRITEFILE ,{OBJ|raw|rawb|rawhw|ascii[,opts]} filename =addressrange

where:

OBJ

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

There are no opts supported for this file type.

raw

Write the file as raw data, one word per word of memory.

There are no opts supported for this file type.

You must specify an address with this qualifier.

rawb

Write the file as raw data, one byte per byte of memory.

There are no opts supported for this file type.

You must specify an address with this qualifier.

rawhw

Write the file as raw data, one halfword per halfword of memory.

There are no opts supported for this file type.

You must specify an address with this qualifier.

ascii

Write the file as a stream of ASCII digits separated by whitespace. The exact format is specified by other qualifiers (see the opts qualifier). The file has a one line header that is compatible with READFILE and VERIFYFILE. This header has the following format:


[start,end,size]

start and end specifies the address range that is written. 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.

opts

Optional qualifiers available for use with the ascii qualifier:

byte

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

half

The file is a stream of 16-bit hexadecimal values.

long

The file is a stream of 32-bit hexadecimal values.

gui

You are prompted to enter the file type with a dialog.

Note

This qualifier has no effect in the headless debugger.

filename

The name of the file to be written.

You can include one of more environment variables in the filename. For example, if MYPATH defines the location C:\Myfiles, you can specify:


writefile,raw "$MYPATH\\myfile.dat" 0x8000..0x8100

addressrange

The address range in target memory to write to the file. Specify an address range as: start_addr..end_addr, for example 0x8000..0x9000.

Description

The WRITEFILE command writes the contents of memory to a file, performing a format conversion if necessary.

The type of memory assumed depends on the target processor. For example, ARM processors have byte addressable memory and CEVA-Oak processors have word addressable memory.

Examples

The following examples show how to use WRITEFILE:

writefile ,raw "c:\temp\file.dat" =0x8000..0x9000

Write the contents of the 4KB memory page at 0x8000 to the file c:\temp\file.dat, storing the data in raw, uninterpreted, form.

writefile ,ascii,long "c:\temp\file.txt" =0x8000..0x9000

Write the contents of the 4KB memory page at 0x8000 to the file c:\temp\file.dat, storing it as 32-bit values in target memory endianess. For example, the file might look similar to this:


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

Note

By writing a file as longs and reading it back as longs on a different target, you can convert the endianness of the data in the file.

See also

The following commands provide similar or related functionality:

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0175G
Non-Confidential