summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNélio Laranjeiro2009-06-23 21:09:47 +0200
committerNélio Laranjeiro2009-06-23 21:09:47 +0200
commitccbfefb674166ac5cd95d737a019c88d5a20d3a8 (patch)
tree7df1d72cbdbe621e93402b63419895c3645afdd9 /tools
parent62949cf58f69ccd67fb38bb1aedcfe6a667265c1 (diff)
*tools/trace:
* Updating the python tool to use a host program to dump traces too.
Diffstat (limited to 'tools')
-rw-r--r--tools/trace/tinter/thost.py12
-rw-r--r--tools/trace/tinter/tinter.py9
-rw-r--r--tools/trace/trace.py5
3 files changed, 16 insertions, 10 deletions
diff --git a/tools/trace/tinter/thost.py b/tools/trace/tinter/thost.py
index aabde424..f888a242 100644
--- a/tools/trace/tinter/thost.py
+++ b/tools/trace/tinter/thost.py
@@ -1,7 +1,9 @@
import serial
import time
import sys
-from proto import *
+sys.path.append ('../../host/')
+from proto.proto import *
+from proto.popen_io import *
from utils import *
FLASH_MEMORY_HIGH = 0x1fffff
@@ -18,8 +20,12 @@ def log (x):
class THost:
"""Class to connect to the flash memory."""
- def __init__(self):
- self.__proto = Proto (serial.Serial ('/dev/ttyUSB0'), time.time, 0.1)
+ def __init__(self, prgm):
+ if prgm[0] == '!':
+ self.__proto = Proto (PopenIO (prgm[1:]),
+ time.time, 0.1)
+ else:
+ self.__proto = Proto (serial.Serial (prgm), time.time, 0.1)
self.__memory = list()
self.__traces = []
diff --git a/tools/trace/tinter/tinter.py b/tools/trace/tinter/tinter.py
index c38239ea..4d576ace 100644
--- a/tools/trace/tinter/tinter.py
+++ b/tools/trace/tinter/tinter.py
@@ -10,11 +10,12 @@ except:
class TInter:
- def __init__(self, infile, outfile):
+ def __init__(self, infile, outfile, prgm):
self.__infile = infile
self.__events = None
self.__outfile = outfile
self.__file = None
+ self.__prgm = prgm
def __events_get (self):
infile = open (self.__infile, 'r')
@@ -48,7 +49,7 @@ class TInter:
def __dump (self, val):
print "Dump trace ", val
- host = THost()
+ host = THost(self.__prgm)
host.dump_memory (val)
memory = host.get_trace ()
@@ -64,7 +65,7 @@ class TInter:
self.__file.close ()
def available_traces (self):
- host = THost()
+ host = THost(self.__prgm)
traces = host.trace_list()
print "Traces available "
for i in traces:
@@ -72,7 +73,7 @@ class TInter:
def trace_print (self, trace_num = None):
events = self.__events_get ()
- host = THost()
+ host = THost(self.__prgm)
if trace_num:
traces = host.trace_list()
diff --git a/tools/trace/trace.py b/tools/trace/trace.py
index a6496652..b4c095a5 100644
--- a/tools/trace/trace.py
+++ b/tools/trace/trace.py
@@ -2,14 +2,13 @@
from optparse import OptionParser
import sys
-sys.path.append ('../../host/')
from tcreator.tcreator import *
from tinter.tinter import *
INTER_MODE=" (only available on interpretor mode)."
CREATE_MODE=" (only available on create mode)."
-print "Trace System v1.0 by APBTeam\n"
+print "Trace System v1.1 by APBTeam\n"
parser = OptionParser()
parser.add_option("-e", "--enum-name", dest="enum_name",
@@ -32,7 +31,7 @@ if options.type == 'create':
cre = TCreator (options.infile, options.outfile, options.enum_name)
cre.create ()
elif options.type == "inter":
- inter = TInter (options.infile, options.outfile)
+ inter = TInter (options.infile, options.outfile, args[0])
if options.list_trace:
inter.available_traces ()
elif options.trace: