Skip to content

Commit

Permalink
write to the correct (remapped) ld-rom addresses, SUCCESS
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalhahn committed Jan 2, 2012
1 parent d3779dd commit c1f76ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions NUC1XX.py
Expand Up @@ -84,15 +84,17 @@ def issueISPCommand(self, adr, cmd, data):
if ispcon & 0x40:
print 'issueISPCOMMAND: ISP command failed: %08X' % ispcon

def writeFlash(self):
self.issueISPCommand(0x0001F000, 0x21, 0xDEADBEEF)
def writeFlash(self, addr, data):
print 'writing %s to %s' % (hex(addr), hex(data))
self.issueISPCommand(addr, 0x21, data)

def readFlash(self):
#self.issueISPCommand(0x0001F000, 0x00, 0x00)
print 'read: %s' % hex(self.ahb.readWord(0x0001F000))
def readFlash(self, addr):
self.issueISPCommand(addr, 0x00, 0x00)
print 'reading %s: %s' % (
hex(addr), hex(self.ahb.readWord(NUC1XX.ISPDAT_ADDR)))

def eraseFlash(self):
self.issueISPCommand(0x0001f000, 0x22, 0x00)
self.issueISPCommand(0x00100000, 0x22, 0x00)

def readRegister(self, register):
self.ahb.writeWord(NUC1XX.DCRSR_ADDR, register)
Expand Down
8 changes: 4 additions & 4 deletions test.py
Expand Up @@ -13,7 +13,7 @@
nuc1xx.halt()
#nuc1xx.readAllRom()
#nuc1xx.readConfig()
#nuc1xx.flashUnlock()
#nuc1xx.eraseFlash()
#nuc1xx.writeFlash()
nuc1xx.readFlash()
nuc1xx.flashUnlock()
nuc1xx.eraseFlash()
nuc1xx.writeFlash(0x00100000, 0xdeadbeef)
nuc1xx.readFlash(0x00100000)

0 comments on commit c1f76ec

Please sign in to comment.