Commit e8e6d9c0 authored by Qiang Du's avatar Qiang Du

Flash write/readback verified.

parent 2dc1f007
......@@ -41,7 +41,6 @@ class FlashM25P:
self.ebone = comm_params[1]
self.mb_base = comm_params[2]
# Low-level SPI transfer using communication type defined in the constructor
#
# This method handles the OR-ing together of the data bytes and the control
......@@ -77,7 +76,9 @@ class FlashM25P:
else:
for i in xrange(len(dat)):
wval.append((ctrl << 24) | dat[i])
self.ebone.writemregs(self.mb_base+0x10, wval)
#self.ebone.writemregs(self.mb_base+0x10, wval)
for v in wval:
self.ebone.write(self.mb_base+0x10, v)
# Read the data and prepare the return value
while (retval & (1 << 28) == 0):
......
......@@ -16,22 +16,22 @@ def main():
target = EB(ip)
target.open()
baseaddr = 0x20800
flash_address = 0x10
flash_length = 0x1f
flash_address = 0x0
flash_length = 0x0ff
file_name = 'foo_bit'
mb = XilMultiboot(ETHERBONE, target, baseaddr, file_name)
# read id
id = mb.flash.read_id()
logging.info('Flash ID: 0x' + id.encode('hex'))
#logging.info('Programming file %s'% file_name)
#mb.write(flash_address)
#mb.read(0,0xff)
# id = mb.flash.read_id()
# logging.info('Flash ID: 0x' + id.encode('hex'))
# mb.flash.serase(flash_address)
mb.flash.write(flash_address,range(0x15, 0x15 + flash_length))
logging.info('Programming file %s'% file_name)
mb.write(flash_address)
mb.read(0,0xff)
mb.flash.write(flash_address,range(0x0, 0x0 + flash_length))
status = mb.flash.rsr()
logging.info('Status: 0x%x', status)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment