summaryrefslogtreecommitdiff
path: root/Host/nxt-gdb-server.py
diff options
context:
space:
mode:
authorTC Wan2011-01-04 14:54:50 +0800
committerTC Wan2011-01-04 14:54:50 +0800
commitdcdbc6d3f18fa1c255bc03ce573fed74b754b19c (patch)
tree191b58bc580d33bc18e1d9facef35ddef7675259 /Host/nxt-gdb-server.py
parente9cdc8055191a6dea1a471b1b3fe6e2fe0f7070f (diff)
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.
Diffstat (limited to 'Host/nxt-gdb-server.py')
-rwxr-xr-xHost/nxt-gdb-server.py8
1 files changed, 5 insertions, 3 deletions
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