Subversion Repositories freemyipod

Rev

Rev 427 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 427 Rev 532
Line 24... Line 24...
24
 
24
 
25
import sys
25
import sys
26
import time
26
import time
27
import libemcoreldr
27
import libemcoreldr
28
 
28
 
-
 
29
from misc import to_int
-
 
30
 
29
 
31
 
30
def usage():
32
def usage():
31
  print ""
33
  print ""
32
  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"
33
  print ""
35
  print ""
Line 48... Line 50...
48
  print ""
50
  print ""
49
  print "  run <file>"
51
  print "  run <file>"
50
  print "    Loads the specified file to 0x08000000 (SDRAM) and executes it."
52
  print "    Loads the specified file to 0x08000000 (SDRAM) and executes it."
51
  print "    This is what you usually want to do."
53
  print "    This is what you usually want to do."
52
  print ""
54
  print ""
53
  print "All numbers are hexadecimal!"
55
  print "All numbers can be provided as either hex (0x prefix), binary (0b prefix) or decimal (no prefix)"
54
  exit(2)
56
  exit(2)
55
 
57
 
56
 
58
 
57
def parsecommand(dev, argv):
59
def parsecommand(dev, argv):
58
  if len(argv) < 2: usage()
60
  if len(argv) < 2: usage()
Line 61... Line 63...
61
    if len(argv) != 4: usage()
63
    if len(argv) != 4: usage()
62
    dev.upload(int(argv[2], 16), argv[3])
64
    dev.upload(int(argv[2], 16), argv[3])
63
 
65
 
64
  elif argv[1] == "download":
66
  elif argv[1] == "download":
65
    if len(argv) != 5: usage()
67
    if len(argv) != 5: usage()
66
    dev.download(int(argv[2], 16), int(argv[3], 16), argv[4])
68
    dev.download(to_int(argv[2]), to_int(argv[3]), argv[4])
67
 
69
 
68
  elif argv[1] == "execute":
70
  elif argv[1] == "execute":
69
    if len(argv) != 4: usage()
71
    if len(argv) != 4: usage()
70
    dev.execute(int(argv[2], 16), int(argv[3], 16))
72
    dev.execute(to_int(argv[2]), to_int(argv[3]))
71
 
73
 
72
  elif argv[1] == "run":
74
  elif argv[1] == "run":
73
    if len(argv) != 3: usage()
75
    if len(argv) != 3: usage()
74
    dev.run(argv[2])
76
    dev.run(argv[2])
75
 
77