Services - tools - models - for embedded software development
Embecosm divider strip
Prev  Next

4.7.14.  Binary Data Transfer

The X provides for data to be written to the target in binary format. This is the mechanism of choice for program loading (the GDB load command). GDB will first probe the target with an empty X packet (which is 7-bit clean). If an "OK" response is received, subsequent transfers will use the X packet. Otherwise M packets will be used. Thus even 7-bit clean implementations should still support replying to an empty X packet.

The example implementation is found in rsp_write_mem_bin (). Even though the data is binary, it must still be escaped so that '#', '$' and '}' characters are not mistaken for new packets or escaped characters.

Each byte is read, and if escaped, restored to its original value. The data is written using set_program8 (), having first verified the memory location with verify_memoryarea ().

If all bytes are successfully written, a reply packet of "OK" is sent. Otherwise and error packet ("E01") is sent. The error number does not matter—it is ignored by the target.

[Caution]Caution

The use of set_program8 () is not correct, since it ignores any caching or memory management. As a result the current implementation is only correct for configurations with no instruction MMU or instruction cache.

Embecosm divider strip