Mercurial > lcfOS
diff python/stm32.py @ 255:7416c923a02a
Added more logging
author | Windel Bouwman |
---|---|
date | Sun, 04 Aug 2013 15:10:10 +0200 |
parents | f254b87258e6 |
children | 225f444019b1 |
line wrap: on
line diff
--- a/python/stm32.py Wed Jul 31 21:20:58 2013 +0200 +++ b/python/stm32.py Sun Aug 04 15:10:10 2013 +0200 @@ -27,6 +27,7 @@ """ def __init__(self, iface): super().__init__(iface) + self.logger = logging.getLogger('stm32') def __str__(self): return 'STM32F4 device size=0x{1:X} id=0x{0:X}'.format(\ @@ -85,21 +86,21 @@ if address & 1 == 1: raise STLinkException('Unaligned flash') if len(content) & 1 == 1: - print('unaligned length, padding with zero') + self.logger.warning('unaligned length, padding with zero') content += bytes([0]) if address & (pagesize - 1) != 0: raise STLinkException('Address not aligned with pagesize') # erase required space sectors = self.calcSectors(address, len(content)) - print('erasing {0} sectors'.format(len(sectors))) + self.logger.info('erasing {0} sectors'.format(len(sectors))) for sector, secsize in sectors: - print('erasing sector {0} of {1} bytes'.format(sector, secsize)) + self.logger.info('erasing sector {0} of {1} bytes'.format(sector, secsize)) self.eraseFlashSector(sector) # program pages: self.unlockFlashIf() self.writeFlashCrPsiz(2) # writes are 32 bits aligned self.setFlashCrPg() - print('writing {0} bytes'.format(len(content)), end='') + self.logger.info('writing {0} bytes'.format(len(content)), end='') offset = 0 t1 = time.time() while offset < len(content):