| Line 28... |
Line 28... |
| 28 |
|
28 |
|
| 29 |
from misc import to_int
|
29 |
from misc import to_int
|
| 30 |
|
30 |
|
| 31 |
|
31 |
|
| 32 |
def usage():
|
32 |
def usage():
|
| 33 |
print ""
|
33 |
print("")
|
| 34 |
print "Please provide a command and (if needed) parameters as command line arguments"
|
34 |
print("Please provide a command and (if needed) parameters as command line arguments")
|
| 35 |
print ""
|
35 |
print("")
|
| 36 |
print "Available commands:"
|
36 |
print("Available commands:")
|
| 37 |
print ""
|
37 |
print("")
|
| 38 |
print " upload <address> <file>"
|
38 |
print(" upload <address> <file>")
|
| 39 |
print " Uploads the specified file to the specified memory address on the device."
|
39 |
print(" Uploads the specified file to the specified memory address on the device.")
|
| 40 |
print ""
|
40 |
print("")
|
| 41 |
print " download <address> <size> <file>"
|
41 |
print(" download <address> <size> <file>")
|
| 42 |
print " Downloads <size> bytes of data from the specified address on the device,"
|
42 |
print(" Downloads <size> bytes of data from the specified address on the device,")
|
| 43 |
print " and stores it in the specified file."
|
43 |
print(" and stores it in the specified file.")
|
| 44 |
print ""
|
44 |
print("")
|
| 45 |
print " execute <address> <stack>"
|
45 |
print(" execute <address> <stack>")
|
| 46 |
print " Executes code at the specified address in the device's memory."
|
46 |
print(" Executes code at the specified address in the device's memory.")
|
| 47 |
print " The stack pointer will be set to <stack> before jumping to <address>."
|
47 |
print(" The stack pointer will be set to <stack> before jumping to <address>.")
|
| 48 |
print " iBugger will probably lose control of the device,"
|
48 |
print(" iBugger will probably lose control of the device,")
|
| 49 |
print " if the code isn't explicitly written for it."
|
49 |
print(" if the code isn't explicitly written for it.")
|
| 50 |
print ""
|
50 |
print("")
|
| 51 |
print " run <file>"
|
51 |
print(" run <file>")
|
| 52 |
print " Loads the specified file to 0x08000000 (SDRAM) and executes it."
|
52 |
print(" Loads the specified file to 0x08000000 (SDRAM) and executes it.")
|
| 53 |
print " This is what you usually want to do."
|
53 |
print(" This is what you usually want to do.")
|
| 54 |
print ""
|
54 |
print("")
|
| 55 |
print "All numbers can be provided as either hex (0x prefix), binary (0b prefix) or decimal (no prefix)"
|
55 |
print("All numbers can be provided as either hex (0x prefix), binary (0b prefix) or decimal (no prefix)")
|
| 56 |
exit(2)
|
56 |
exit(2)
|
| 57 |
|
57 |
|
| 58 |
|
58 |
|
| 59 |
def parsecommand(dev, argv):
|
59 |
def parsecommand(dev, argv):
|
| 60 |
if len(argv) < 2: usage()
|
60 |
if len(argv) < 2: usage()
|