2 # GoodFET ARM9 Client Library
4 # Contributions and bug reports welcome.
7 # * full cycle debugging.. halt to resume
8 # * ensure correct PC handling
9 # * flash manipulation (probably need to get the specific chip for this one)
10 # * set security (chip-specific)
12 import sys, binascii, struct, time
13 import atlasutils.smartprint as asp
14 from GoodFET import GoodFET
15 from GoodFETARM7 import *
16 from intelhex import IntelHex
39 class GoodFETARM9(GoodFETARM7):
41 GoodFETARM7.start(self)
42 self.ARMsetSCANsize(5)
44 def ARMreadMem(self, adr, wordcount=0):
45 """ Only works in ARM mode currently
46 WARNING: Addresses must be word-aligned!
48 regs = self.ARMget_registers()
49 self.ARMset_registers([0xdeadbeef for x in xrange(14)], 0xe)
52 while (wordcount > 0):
53 count = (wordcount, 0xe)[wordcount>0xd]
54 bitmask = LDM_BITMASKS[count]
55 self.ARMset_register(14,adr)
56 self.ARMdebuginstr(ARM_INSTR_LDMIA_R14_r0_rx | bitmask ,0)
58 #FIXME: do we need the extra nop here?
61 output.extend([self.ARMget_register(x) for x in xrange(count)])
65 # FIXME: handle the rest of the wordcount here.
66 self.ARMset_registers(regs,0xe)