Erase flash in 512 byte blocks
This is the IAP flash memory block size, and the BSL apparently expects erase to be done aligned to 512 byte.
This commit is contained in:
parent
9fd960f45a
commit
b3230814a8
@ -77,6 +77,10 @@ by accident.
|
||||
"size" specifies the number of flash memory blocks. if blks > size,
|
||||
eeprom will be erased.
|
||||
|
||||
Note that while erase size is specified in 256 byte blocks, the IAP
|
||||
memory actually has 512 bytes physical erase block size, and the BSL
|
||||
expects 512 byte aligned erase commands!
|
||||
|
||||
5. Program flash memory
|
||||
|
||||
Payload: 0x00, 0x00, 0x00, addr0, addr1, size0, size1, D0, ..., Dn
|
||||
|
@ -1260,8 +1260,8 @@ class Stc12Protocol:
|
||||
Erase the flash memory with a block-erase command.
|
||||
"""
|
||||
|
||||
blks = (erase_size + 255) // 256
|
||||
size = (flash_size + 255) // 256
|
||||
blks = ((erase_size + 511) // 512) * 2
|
||||
size = ((flash_size + 511) // 512) * 2
|
||||
print("Erasing %d blocks: " % blks, end="")
|
||||
sys.stdout.flush()
|
||||
packet = bytes([0x84, 0xff, 0x00, blks, 0x00, 0x00, size,
|
||||
|
Loading…
Reference in New Issue
Block a user