mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 20:09:12 +03:00
First device memory operations: read signature
Start a "Memories" popup for the device. In the "Signature" tab, show the expected signature from the config file, versus the signature read from the device.
This commit is contained in:
@@ -162,7 +162,8 @@ class adgui(QObject):
|
||||
p = pathlib.Path(argv[0])
|
||||
srcdir = str(p.parent)
|
||||
for f in [ "adgui.ui", "about.ui", "device.ui",
|
||||
"devinfo.ui", "loglevel.ui", "programmer.ui" ]:
|
||||
"devinfo.ui", "loglevel.ui", "programmer.ui",
|
||||
"memories.ui" ]:
|
||||
ui = QFile(srcdir + '/' + f)
|
||||
if not ui.open(QFile.ReadOnly):
|
||||
print(f"Cannot open {f}: {ui.errorString()}", file = sys.stderr)
|
||||
@@ -220,6 +221,8 @@ class adgui(QObject):
|
||||
self.programmer.buttonBox.accepted.connect(self.programmer_selected)
|
||||
self.programmer.programmers.currentTextChanged.connect(self.programmer_update_port)
|
||||
self.adgui.actionDevice_Info.triggered.connect(self.devinfo.show)
|
||||
self.adgui.actionProgramming.triggered.connect(self.memories.show)
|
||||
self.memories.readSig.pressed.connect(self.read_signature)
|
||||
|
||||
def log(self, s: str, level: int = ad.MSG_INFO):
|
||||
# level to color mapping
|
||||
@@ -305,6 +308,7 @@ class adgui(QObject):
|
||||
if not p:
|
||||
log(f"Could not find {self.dev_selected} again, confused\n")
|
||||
return
|
||||
ad.avr_initmem(p)
|
||||
self.devinfo.label_2.setText(p.desc)
|
||||
self.devinfo.label_4.setText(p.id)
|
||||
self.devinfo.label_6.setText(p.config_file)
|
||||
@@ -338,6 +342,10 @@ class adgui(QObject):
|
||||
vv = ad.ldata_string(v)
|
||||
self.devinfo.listVariants.addItem(vv)
|
||||
v = ad.lnext(v)
|
||||
# update signature TAB in memories popup
|
||||
sig = p.signature
|
||||
sigstr = sig.hex(' ').upper()
|
||||
self.memories.configSig.setText(sigstr)
|
||||
|
||||
def device_selected(self):
|
||||
self.dev_selected = self.device.devices.currentText()
|
||||
@@ -386,6 +394,7 @@ class adgui(QObject):
|
||||
self.pgm.enable(self.dev)
|
||||
self.pgm.initialize(self.dev)
|
||||
self.log('Programmer successfully started')
|
||||
self.adgui.actionProgramming.setEnabled(True)
|
||||
self.connected = True
|
||||
|
||||
def stop_programmer(self):
|
||||
@@ -394,6 +403,16 @@ class adgui(QObject):
|
||||
self.pgm.close()
|
||||
self.pgm.teardown()
|
||||
|
||||
def read_signature(self):
|
||||
if self.connected:
|
||||
m = ad.avr_locate_mem(self.dev, 'signature')
|
||||
if m:
|
||||
ad.avr_read_mem(self.pgm, self.dev, m)
|
||||
read_sig = m.get(3)
|
||||
sigstr = read_sig.hex(' ').upper()
|
||||
self.memories.deviceSig.setText(sigstr)
|
||||
else:
|
||||
print("Could not find signature memory", file = sys.stderr)
|
||||
|
||||
def main():
|
||||
gui = adgui(sys.argv)
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
<string>Device</string>
|
||||
</property>
|
||||
<addaction name="actionDevice_Info"/>
|
||||
<addaction name="actionProgramming"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
<property name="title">
|
||||
@@ -213,6 +214,14 @@
|
||||
<string>Log level …</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProgramming">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Programming …</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
245
src/python/memories.ui
Normal file
245
src/python/memories.ui
Normal file
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Memories</class>
|
||||
<widget class="QDialog" name="Memories">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>786</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Memories</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>670</x>
|
||||
<y>480</y>
|
||||
<width>91</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>20</y>
|
||||
<width>731</width>
|
||||
<height>441</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="signature">
|
||||
<attribute name="title">
|
||||
<string>Signature</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>681</width>
|
||||
<height>112</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="5">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>From device:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="deviceSig">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1E XX XX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>From config file:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="configSig">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1E XX XX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="readSig">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Read</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="flash">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Flash</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="eeprom">
|
||||
<attribute name="title">
|
||||
<string>EEPROM</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Memories</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Memories</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user