Index: embios/trunk/tools/embios.py |
— | — | @@ -172,6 +172,18 @@ |
173 | 173 | print " Executes the emBIOS executable image at <offset>."
|
174 | 174 | print ""
|
175 | 175 | print ""
|
| 176 | + print " readrawbootflash <addr_bootflsh> <addr_mem> <size>"
|
| 177 | + print " Reads <size> bytes from bootflash to memory."
|
| 178 | + print " <addr_bootflsh>: the address in bootflash to read from"
|
| 179 | + print " <addr_mem>: the address in memory to copy the data to"
|
| 180 | + print ""
|
| 181 | + print " writerawbootflash <addr_mem> <addr_bootflsh> <size>"
|
| 182 | + print " Writes <size> bytes from memory to bootflash."
|
| 183 | + print " Don't call this unless you really know what you're doing."
|
| 184 | + print " <addr_mem>: the address in memory to copy the data from"
|
| 185 | + print " <addr_bootflsh>: the address in bootflash to write to"
|
| 186 | + print ""
|
| 187 | + print ""
|
176 | 188 | print " flushcaches"
|
177 | 189 | print " Flushes the CPUs data and instruction caches."
|
178 | 190 | print ""
|
— | — | @@ -342,10 +354,18 @@ |
343 | 355 | dev.createthread(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16), int(argv[6], 16), int(argv[7], 16), int(argv[8], 16))
|
344 | 356 |
|
345 | 357 | elif argv[1] == "execimage":
|
346 | | - if len(argv) != 3: usage
|
| 358 | + if len(argv) != 3: usage()
|
347 | 359 | dev.execimage(int(argv[2], 16))
|
348 | 360 |
|
349 | 361 |
|
| 362 | + elif argv[1] == "readrawbootflash":
|
| 363 | + if len(argv) != 5: usage()
|
| 364 | + dev.readrawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
|
| 365 | +
|
| 366 | + elif argv[1] == "writerawbootflash":
|
| 367 | + if len(argv) != 5: usage()
|
| 368 | + dev.writerawbootflash(int(argv[2]), int(argv[3]), int(argv[4]))
|
| 369 | +
|
350 | 370 | elif argv[1] == "flushcaches":
|
351 | 371 | if len(argv) != 2: usage()
|
352 | 372 | dev.flushcaches()
|
Index: embios/trunk/tools/libembios.py |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | #
|
23 | 23 | #
|
24 | 24 |
|
25 | | -# note: handles commands 1 to 20
|
| 25 | +# note: handles commands 1 to 21
|
26 | 26 |
|
27 | 27 | import sys
|
28 | 28 | import math
|
— | — | @@ -1011,7 +1011,7 @@ |
1012 | 1012 | return out
|
1013 | 1013 |
|
1014 | 1014 |
|
1015 | | - def execimage(self, offset):
|
| 1015 | + def execimage(self, offset, silent = 0):
|
1016 | 1016 | self.__myprint("Executing emBIOS executable image at 0x%08x..." % offset, silent)
|
1017 | 1017 |
|
1018 | 1018 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 18, threadid, 0, 0))
|
— | — | @@ -1025,6 +1025,29 @@ |
1026 | 1026 |
|
1027 | 1027 | #=====================================================================================
|
1028 | 1028 |
|
| 1029 | +
|
| 1030 | + def readrawbootflash(self, addr_bootflsh, addr_mem, size, silent = 0):
|
| 1031 | + self.__myprint("Reading 0x%x bytes from 0x%08x at bootflash to 0x%08x..." % (size, addr_bootflsh, addr_mem), silent)
|
| 1032 | +
|
| 1033 | + self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 22, addr_mem, addr_bootflsh, size))
|
| 1034 | + response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
| 1035 | + self.__checkstatus(response)
|
| 1036 | +
|
| 1037 | + self.__myprint(" done\n", silent)
|
| 1038 | +
|
| 1039 | +
|
| 1040 | + def writerawbootflash(self, addr_mem, addr_bootflsh, size, silent = 0):
|
| 1041 | + self.__myprint("Writing 0x%x bytes from 0x%08x to bootflash at 0x%08x..." % (size, addr_fmem, addr_bootflsh), silent)
|
| 1042 | +
|
| 1043 | + self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 23, addr_mem, addr_bootflsh, size))
|
| 1044 | + response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
| 1045 | + self.__checkstatus(response)
|
| 1046 | +
|
| 1047 | + self.__myprint(" done\n", silent)
|
| 1048 | +
|
| 1049 | +
|
| 1050 | +#=====================================================================================
|
| 1051 | +
|
1029 | 1052 |
|
1030 | 1053 | def flushcaches(self, silent = 0):
|
1031 | 1054 | self.__myprint("Flushing caches...", silent)
|