Mercurial > lcfOS
diff python/st-util.py @ 136:9af544be5d2a
Added hexfile edit
author | Windel Bouwman |
---|---|
date | Wed, 23 Jan 2013 21:54:14 +0100 |
parents | 205578c96a79 |
children | 0a540ce31cd5 |
line wrap: on
line diff
--- a/python/st-util.py Mon Jan 21 21:12:36 2013 +0100 +++ b/python/st-util.py Wed Jan 23 21:54:14 2013 +0100 @@ -5,6 +5,7 @@ from PyQt4.QtGui import * import stlink, devices, stm32 from devices import Interface, Device +from hexedit import HexEdit class InformationDialog(QDialog): def __init__(self, parent): @@ -52,8 +53,36 @@ self.mdl = RegisterModel() self.setModel(self.mdl) -class MemoryViewer(QWidget): - pass +class MemoryView(QWidget): + def __init__(self): + super().__init__() + l = QVBoxLayout(self) + l2 = QHBoxLayout() + l2.addWidget(QLabel('Address')) + self.addressLine = QLineEdit() + self.addressLine.setInputMask('Hhhhhhhh') + self.addressLine.setText('08000000') + l2.addWidget(self.addressLine) + l.addLayout(l2) + self.device = None + self.hexEdit = HexEdit() + self.loadAddress(0x8000000) + l.addWidget(self.hexEdit) + self.addressLine.returnPressed.connect(self.doLoad) + def doLoad(self): + txt = self.addressLine.text() + self.loadAddress(int(txt, 16)) + def loadAddress(self, address): + size = 512 + if self.device: + data = self.device.iface.read_mem32(address, size) + else: + data = bytearray(size) + self.hexEdit.bv.Data = data + self.hexEdit.bv.Offset = address + def setDevice(self, dev): + self.device = dev + self.loadAddress(0x8000000) class FlashTool(QWidget): def __init__(self):