From Texas Instruments Wiki
Jump to: navigation, search

This binary save/load memory feature is used to save memory from the target and load memory to the target from a binary file (.bin). This feature could be accessed via the GEL funtions GEL_MemoryLoad and GEL_MemorySave or the memory browser context menu (details here). The memory browser implements this feature using the the same GEL functions internally. To indicate that the user will like to save the data to a binary file from dialog provided by code composer studio the .bin file extension must be used; when the GEL_MemorySave function is used directly the user must set the optional io_format parameter to 8. The bitsize and swap parameters could be used to further tweak how the data is saved or loaded.

Since, this feature supports automatic endianness conversion when loading/saving data it is crucial to understand some of the assumptions and related parameters.

By default the data is always saved to a file in a little endian format and when loading data it is assumed that the data is provided in a little endian format.

When loading and saving the binary data it could be interpreted as a particular data type. The bit size field is used to indicate the size of this data type; which could be set to 8, 16, 32 when loading and 8,16,32,64 when saving. The bitsize field generally affects how the endianness rules are applied when saving/loading the data. For example when loading data to a big endian target and we set the bit size to 32; since the assumption is that the data is stored in a little endian format in the file; data will be read in 4 bytes at a time and the 4 bytes will be swapped to convert to big endian format before loading to target. If the bit size is set to 16; then data will be read in 2 bytes at a time and the bytes swapped to convert to big endian. Same rules are applied when saving to binary file from the target.

The swap parameter could be used to effectively undo the affects of the automated endiness conversion. When saving if the swap option is true the data will be swapped before being saved; thus saving it in big endian format. When loading if the swap parameter is set the data will be swapped before loading. When data is loaded it is assumed that the data in the file is in little endian format; thus bytes are swapped when loading to big endian targets; Therefore setting this option will undo that operation. In summary, setting the swap option while saving has the effect of saving the file to a big endian format; when loading it has the effect of indicating the data is stored in big endian format (rather than the assumed default little endian) so appropriate conversions could applied when loading to target.