From dcdbc6d3f18fa1c255bc03ce573fed74b754b19c Mon Sep 17 00:00:00 2001 From: TC Wan Date: Tue, 4 Jan 2011 14:54:50 +0800 Subject: adjusted nxt message to 3 byte header format Adjusted NXT Message Header to use 3 byte header format to support future expansion of multi-segmented GDB messages. This is not used at this moment. --- Host/nxt-gdb-server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Host/nxt-gdb-server.py') diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py index fba6073..27cb4a3 100755 --- a/Host/nxt-gdb-server.py +++ b/Host/nxt-gdb-server.py @@ -3,6 +3,7 @@ # Copyright (C) 2011 the NxOS developers # # Module Developed by: Nicolas Schodet +# TC Wan # # See AUTHORS for a full list of the developers. # @@ -32,6 +33,7 @@ class NXTGDBServer: # Debug command header, no reply. debug_command = 0x8d + segment_no = 0 def __init__ (self, port): """Initialise server.""" @@ -41,15 +43,15 @@ class NXTGDBServer: """Return packed data to send to NXT.""" # Insert command and length. assert len (data) <= self.pack_size - return struct.pack ('BB', self.debug_command, len (data)) + data + return struct.pack ('BBB', self.debug_command, self.segment_no, len (data)) + data def unpack (self, data): """Return unpacked data from NXT.""" # May be improved, for now, check command and announced length. if len (data) < 2: return '' - header, body = data[0:2], data[2:] - command, length = struct.unpack ('BB', header) + header, body = data[0:3], data[3:] + command, self.segment_no, length = struct.unpack ('BBB', header) if command != self.debug_command or length != len (body): return '' return body -- cgit v1.2.3