comparison 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
comparison
equal deleted inserted replaced
135:01d88140dc03 136:9af544be5d2a
3 import sys 3 import sys
4 from PyQt4.QtCore import * 4 from PyQt4.QtCore import *
5 from PyQt4.QtGui import * 5 from PyQt4.QtGui import *
6 import stlink, devices, stm32 6 import stlink, devices, stm32
7 from devices import Interface, Device 7 from devices import Interface, Device
8 from hexedit import HexEdit
8 9
9 class InformationDialog(QDialog): 10 class InformationDialog(QDialog):
10 def __init__(self, parent): 11 def __init__(self, parent):
11 super().__init__(parent) 12 super().__init__(parent)
12 self.setWindowTitle('Info') 13 self.setWindowTitle('Info')
50 def __init__(self): 51 def __init__(self):
51 super().__init__() 52 super().__init__()
52 self.mdl = RegisterModel() 53 self.mdl = RegisterModel()
53 self.setModel(self.mdl) 54 self.setModel(self.mdl)
54 55
55 class MemoryViewer(QWidget): 56 class MemoryView(QWidget):
56 pass 57 def __init__(self):
58 super().__init__()
59 l = QVBoxLayout(self)
60 l2 = QHBoxLayout()
61 l2.addWidget(QLabel('Address'))
62 self.addressLine = QLineEdit()
63 self.addressLine.setInputMask('Hhhhhhhh')
64 self.addressLine.setText('08000000')
65 l2.addWidget(self.addressLine)
66 l.addLayout(l2)
67 self.device = None
68 self.hexEdit = HexEdit()
69 self.loadAddress(0x8000000)
70 l.addWidget(self.hexEdit)
71 self.addressLine.returnPressed.connect(self.doLoad)
72 def doLoad(self):
73 txt = self.addressLine.text()
74 self.loadAddress(int(txt, 16))
75 def loadAddress(self, address):
76 size = 512
77 if self.device:
78 data = self.device.iface.read_mem32(address, size)
79 else:
80 data = bytearray(size)
81 self.hexEdit.bv.Data = data
82 self.hexEdit.bv.Offset = address
83 def setDevice(self, dev):
84 self.device = dev
85 self.loadAddress(0x8000000)
57 86
58 class FlashTool(QWidget): 87 class FlashTool(QWidget):
59 def __init__(self): 88 def __init__(self):
60 super().__init__() 89 super().__init__()
61 90