Mercurial > lcfOS
diff python/stm32.py @ 246:f254b87258e6
Added hexfile to zcc
author | Windel Bouwman |
---|---|
date | Thu, 25 Jul 2013 08:11:30 +0200 |
parents | 14e739ed03ab |
children | 7416c923a02a |
line wrap: on
line diff
--- a/python/stm32.py Wed Jul 24 22:40:29 2013 +0200 +++ b/python/stm32.py Thu Jul 25 08:11:30 2013 +0200 @@ -27,9 +27,11 @@ """ def __init__(self, iface): super().__init__(iface) + def __str__(self): return 'STM32F4 device size=0x{1:X} id=0x{0:X}'.format(\ self.UID, self.FlashSize) + def calculate_F4_sector(self, address): sectorstarts = [] a = STM32_FLASH_BASE @@ -59,14 +61,17 @@ uid2 = self.iface.read_debug32(uid_base + 0x4) uid3 = self.iface.read_debug32(uid_base + 0x8) return (uid3 << 64) | (uid2 << 32) | uid1 + @property def FlashSize(self): f_id = self.iface.read_debug32(0x1FFF7A22) f_id = f_id >> 16 return f_id * 1024 + @property def Running(self): return self.iface.Status == stlink.CORE_RUNNING + # flashing commands: def writeFlash(self, address, content): flashsize = self.FlashSize @@ -164,9 +169,9 @@ return image def waitFlashBusy(self): - """ block until flash operation completes. """ - while self.isFlashBusy(): - pass + """ block until flash operation completes. """ + while self.isFlashBusy(): + time.sleep(0.01) def isFlashLocked(self): cr = self.readFlashCr() mask = 1 << FLASH_F4_CR_LOCK