Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change eraseFlash to eraseFlashWords, so it's the same as all flash-r…

…elated methods
  • Loading branch information...
commit 56f922f6c0a730bf02c68e7ad2244ee344e44490 1 parent 56b8cd2
@pascalhahn authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 NUC1XX.py
View
14 NUC1XX.py
@@ -129,7 +129,7 @@ def changeCBS(self, cbs=False):
else:
config0[0] &= ~NUC1XX.CONFIG0_CBS
- self.eraseFlash(NUC1XX.CONFIG0_ADDR)
+ self.eraseFlashWords(NUC1XX.CONFIG0_ADDR, 1)
self.writeFlashWords(NUC1XX.CONFIG0_ADDR, config0)
def issueISPCommand(self, adr, cmd, data):
@@ -165,8 +165,10 @@ def readFlashWords(self, start_addr, word_count):
data.append(self.ahb.readWord(NUC1XX.ISPDAT_ADDR))
return data
- def eraseFlash(self, addr):
- self.issueISPCommand(addr, NUC1XX.ISPCMD_PAGE_ERASE, 0x00)
+ def eraseFlashWords(self, start_addr, word_count):
+ for counter in range(word_count):
+ addr = start_addr + (counter * 4)
+ self.issueISPCommand(addr, NUC1XX.ISPCMD_PAGE_ERASE, 0x00)
def readRegister(self, register):
self.ahb.writeWord(NUC1XX.DCRSR_ADDR, register)
@@ -176,10 +178,6 @@ def writeRegister(self, register, data):
self.ahb.writeWord(NUC1XX.DCRDR_ADDR, data)
self.ahb.writeWord(NUC1XX.DCRSR_ADDR, register)
- def readAllRom(self):
- for addr in range(0xfffffffC, 0xffffffff, 0x04):
- print hex(self.ahb.readWord(addr))
-
def writeToRam(self):
for addr in range(0x20000000, 0x200000d0, 0x04):
print 'writing %s' % hex(addr)
@@ -211,7 +209,7 @@ def writeBinToFlash(self, binstr, start_addr = LDROM_START_ADDR):
for offset in range(0, len(binstr), 4):
addr = start_addr + offset
if addr % NUC1XX.FLASH_PAGESIZE == 0: # reached new page
- self.eraseFlash(addr)
+ self.eraseFlashWords(addr, 1)
packed_data = binstr[offset:offset + 4]
data.append(struct.unpack("<I", packed_data)[0])
Please sign in to comment.
Something went wrong with that request. Please try again.