Saves a block of memory to file.
GEL_MemorySave(startAddress, page, length, "fileName"[,io_Format][,append][,bitsize][,swap])
startAddress is the first address in the block.
page identifies the type of memory to fill: 0 (Program memory), 1 (Data memory) or 2 (I/O space)
For processors that do not have more than one type of memory, use 0 for this Parameters. For simulated targets, I/O Space Parameters is not supported. GEL does not give warning messages for invalid parameters such as invalid page values.
length defines the number of words to fill.
fileName names the file to store the target data. The fileName must be enclosed in quotation marks.
io_format is an integer that represents the format in which memory words will be written to the specified output file. The default output is 1 (hexadecimal). It accepts the following Parameters:
append represents whether memory to be saved should overwrite the contents of the specified file (0) or append to the end of the file (any nonzero value).
Any nonzero value
Overwrite the contents of the specified file
Append to the end of the file
Appending will neither modify existing nor create file header information. The append feature is not supported for COFF formatted files.
bitsize is option if the file is not raw binary. If we are save to a raw binary file (.bin). it indicates the bit size of the data type to interpret the data as when saving to file. Since, data is saved in a little endian format in the file; this is important when doing automated endiannes conversion while saving the data.
8 - Save data one byte at time. No need to swap
16 - Save data two bytes at a time. Swap bytes when reading from big endian target to convert to little endian
32 - Read data 4 bytes at a time. Swap bytes when reading from big endian target to convert to little endian
64 - Read data 8 bytes at a time. Swap bytes when reading from big endian target to convert to little endian
swap - swap the data before applying the automated endianness conversion. This effectivly disables the automated endiannes conversion. Set swap to true to save data as big endian on the host side
This function can be used to save a block of target memory to a specified file. The block of data is specified by the startAddress, page, and length. If the filename contains a *.out for the file extension, COFF format is used; otherwise, When data is saved in a raw binary (.bin) it is written out in little endian format independant of the target endianness. The bitsize and swap options could be used to further tweak how the binary data is saved and save to big endian format instead. For support for additional formats see GEL_MemorySave2
Synchronous from GEL: Yes
Completely synchronous: Yes
GEL_MemorySave(0x1000, 1, 0x100, "c:\mydir\myfile.dat");
This example appends the block of memory to saved_memory.txt and formats the memory as integers:
GEL_MemorySave(0x100, 0, 0x10, "saved_memory.txt",2, 1);