Fixed a bug in the TelosB port of the GoodFET client.
[goodfet] / client / goodfet.xscale
1 #!/usr/bin/env python
2 # GoodFET Intel XScale
3
4 # (C) 2009 Travis Goodspeed <travis at radiantmachines.com>
5 # (C) 2010 Dave Huseby <dave at linuxprogrammer.org>
6 #
7 # This code is being rewritten and refactored.  You've been warned!
8
9 import sys;
10 import binascii;
11
12 from GoodFETXSCALE import GoodFETXSCALE
13 from intelhex import IntelHex
14
15 if len(sys.argv) == 1:
16     print "Usage: %s verb [objects]\n" % sys.argv[0]
17     print "%s reset" % sys.argv[0]
18     print "%s chipid <index>" % sys.argv[0]
19     sys.exit();
20
21 #Initailize FET and set baud rate
22 client = GoodFETXSCALE()
23 client.serInit()
24
25 #Connect to target
26 client.setup()
27 client.start()
28
29 if sys.argv[1] == "reset":
30     client.reset_target()
31
32 if sys.argv[1] == "chipid":
33     if len(sys.argv) < 3:
34         print "missing argument"
35         sys.exit()
36     idx = int(sys.argv[2])
37     id = client.get_device_id(idx)
38     print "\tDevice %d ID: 0x%s" % (idx, hex(id)[2:].zfill(8).upper())
39
40 client.stop()