From c1f76ec666e9d5a54a795d8e0d51478313ac4d05 Mon Sep 17 00:00:00 2001 From: Pascal Hahn Date: Mon, 2 Jan 2012 19:37:10 +0100 Subject: [PATCH] write to the correct (remapped) ld-rom addresses, SUCCESS --- NUC1XX.py | 14 ++++++++------ test.py | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/NUC1XX.py b/NUC1XX.py index 91ea8a5..bf2f87e 100644 --- a/NUC1XX.py +++ b/NUC1XX.py @@ -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) diff --git a/test.py b/test.py index c669563..3bfa418 100755 --- a/test.py +++ b/test.py @@ -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)