Commit Graph

3583 Commits

Author SHA1 Message Date
Joerg Wunsch
471ce04604 Fix BOL detection for internal logging
Internal log messages are generated without setting "no_nl",
so the log is always at BOL next time.
2024-03-28 09:53:42 +01:00
Joerg Wunsch
dff00a39ba Improve logging and \v and newline handling
Not yet fully where I'd like to have it, but already getting
closer. Internal logging always gets a \n appended unless
self.log() is called with "no_nl" - which is used when being
called from the avrdude_message2() callback.
2024-03-28 09:19:50 +01:00
Joerg Wunsch
1e78b8c2e2 Add option to save log file
Do not emit trace messages to log window - they are too verbose, and
cause the GUI to become very unresponsive.

Still needs improvements.
2024-03-27 14:37:36 +01:00
Joerg Wunsch
457c21aff5 Handle abnormal termination in progress_callback 2024-03-27 12:57:00 +01:00
Joerg Wunsch
8349f8860c Replace PM_* constants enum by #define
This makes it consistent with src/libavrdude.h again.
2024-03-27 11:39:30 +01:00
Joerg Wunsch
65226cdd9e Revert "Turn PM_* #defines into an enum"
This reverts commit 377d3f353c.

It's actually also possible to wrap the #defines in SWIG, so use that
subsequently.
2024-03-27 11:32:31 +01:00
Joerg Wunsch
6d1f413a69 Implement flash reading. 2024-03-27 06:38:07 +01:00
Joerg Wunsch
7b9acec467 Fix progress reporting
Turn time calculations into int.
"Finish" indication is percent == 100.
When reading signature, manually clear progress lest it would
stick at 66 %.
Enforce processing of GUI events in progress_callback()
2024-03-27 06:36:31 +01:00
Joerg Wunsch
1f227636df Implement progress indication 2024-03-26 22:29:24 +01:00
Joerg Wunsch
cc371f07cf Only start programmer if not already started
This allows to re-select a different device (e.g. after reading the
signature).
2024-03-26 14:49:16 +01:00
Joerg Wunsch
2b4058887e Add field with possible device after reading signature 2024-03-26 14:48:16 +01:00
Joerg Wunsch
09ece3753e 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.
2024-03-25 22:56:23 +01:00
Joerg Wunsch
c7ab10e9be Enlarge the button boxes for programmer and device selection.
Should we ever want to translate the UI into other languages,
the English wording might become too small.
2024-03-25 21:40:02 +01:00
Joerg Wunsch
ce3b9f0a0c Turn device family selection into a QGroupBox
This is similar to programmer selection, and replaces a rather
hacky design consisting of a vertical layout with a label on top.
2024-03-25 21:37:45 +01:00
Joerg Wunsch
72da4a9ee7 Rename View -> Device
There will be more related items below "Info".
2024-03-25 21:29:34 +01:00
Joerg Wunsch
a3d482dddf Stop programmer when exiting
Some programmers behave erratical when not being told "Goodbye"
correctly.
2024-03-25 21:22:36 +01:00
Joerg Wunsch
c81f6d7031 Add programmer port selection, and starting programmer
Port names are automatically filled in for USB and linuxgpio programmers.

When all of programmer type, port name, and device are selected, try
to connect to the programmer.
2024-03-25 17:56:33 +01:00
Joerg Wunsch
28e05c6840 Implement programmer selection dialog
This tries to categorize the programmers by programming methods, to
allow reducing the size of the combo box to select from.
2024-03-25 16:57:26 +01:00
Joerg Wunsch
5022a36d95 Turn the log viewer into HTML and color-coded message levels
This demonstrates the possible features with implementing an
application-specific avrdude_message2() callback handler.
2024-03-25 14:34:16 +01:00
Joerg Wunsch
b7d6111d1b Change the GUI from using uic -g python to directly loading the .ui files
uic support for Python has not always been present. There used to be a
pyside2-uic in the past, but at least on Ubuntu, it disappeared.  As
the way how to integrate the uic calls into CMake is also not clear,
it appears to be best to just load the .ui files at run-time.

Most noticable side-effect is that the .ui property is no longer needed
to access the UI elements from the various widget objects.
2024-03-25 13:23:42 +01:00
Joerg Wunsch
c2bfc9fc91 Add tooltips to the radio buttons
They are easily accessible from inside the callback, so they can be
directly translated to ad.cvar.verbose.
2024-03-25 13:22:40 +01:00
Joerg Wunsch
d15672df66 Add dialog to change log level
This sets the global AVRDUDE verbosity level, based on a
radio button group.

quell_progress right now not supported
2024-03-25 11:22:48 +01:00
Joerg Wunsch
fbea1a7556 Fine-tune resizing the device info a bit 2024-03-24 22:58:36 +01:00
Joerg Wunsch
9b6fb3cf03 Implement the Device Info popup
This essentially displays the same information as the simple
test script does with its "getavr()" function:

* device names (long and short)
* location of definition in config file
* device memories
* device variants
2024-03-24 21:59:23 +01:00
Joerg Wunsch
77bcf8693b Rename "Device Memories" to "Device Info" 2024-03-24 13:02:54 +01:00
Joerg Wunsch
e6d2d3f40d Implement device selection
Unify logging into a single log() method.
2024-03-24 00:13:43 +01:00
Joerg Wunsch
fef43111e3 First skeleton of a very basic GUI
This adds a few .ui files (created with Qt designer), and a
skeleton to create a basic GUI out of them. Only functionality
so far is the selection of a device.
2024-03-23 23:49:58 +01:00
Joerg Wunsch
9c0623bf1c Start a src/python subdir 2024-03-21 21:46:32 +01:00
Joerg Wunsch
ed8e4edaa9 Add a comment about fileio usage 2024-03-21 13:38:14 +01:00
Joerg Wunsch
571c7429c7 Add various fileio_* functions
Omitted by now: functions that take or yield a FILE*.
2024-03-21 13:26:09 +01:00
Joerg Wunsch
3420772785 Add a m.clear() method
This allows to clear the contents as well as the "ALLOCATED" tag from
a respective memory buffer.

Also fix some docstrings.
2024-03-21 13:06:59 +01:00
Joerg Wunsch
c6c9aaee1c Fix offset check in m.get and m.put helpers 2024-03-21 11:55:24 +01:00
Joerg Wunsch
1ae394f1ed Assign TAG_ALLOCATED in m->put() 2024-03-21 11:00:39 +01:00
Joerg Wunsch
708403bbda Initialize progress reporting for avr_{read,write}_mem
Both these functions deliberately do not initiate progress reporting,
but rather leave it up to their callers to do so.  For the Python
wrapper, there is no explicit caller, so abuse the "check" typemap to
inject the respective code.
2024-03-20 23:05:24 +01:00
Joerg Wunsch
b65e9d8f4d Revert "Initialize progress reporting in avr_{read,write}_mem"
This reverts commit 296883cf1a.
2024-03-20 23:05:03 +01:00
Joerg Wunsch
73c8a7854b Populate many more methods of struct programmer_t
For optional methods, place checks that prevent dereferencing NULL
pointers, resulting in a SWIG exception instead.

For methods that return values in pointers, provide "argout" typemaps.
2024-03-20 13:52:48 +01:00
Joerg Wunsch
a02994dd12 Always populate setup and teardown methods of struct programmer_t
Many programmer implementations require "cookies" to store internal
data. It helps to be able to always call setup and teardown methods.
2024-03-20 13:46:26 +01:00
Joerg Wunsch
0e7a76f837 Fix typo: False -> false
This is C code, not Python. ;-)
2024-03-20 10:07:33 +01:00
Joerg Wunsch
1de634ffa1 Make the reporting functions a bit more robust
Sometimes, non-ASCII characters might appear in message strings,
causing a UTF-8 decoding error. Catch it, so the remainder can
proceed.
2024-03-19 23:13:15 +01:00
Joerg Wunsch
cbfaa9f718 Add an argout typemap for read_sib
This allows to convert the read_sib result into a Python
bytes() object.
2024-03-19 23:08:17 +01:00
Joerg Wunsch
fa78ea3a34 Set the progress and message callbacks by default
Also bump verbosity to 2 as a starting point - this is
development right now.
2024-03-19 23:07:23 +01:00
Joerg Wunsch
5fd5cffdda Use correct index into tuple in message_type() 2024-03-19 23:06:47 +01:00
Joerg Wunsch
984eb922b2 Remove MSVC build for arm64 by now
It attempts to link against the wrong (x86) Python libs.
2024-03-18 22:09:27 +01:00
Joerg Wunsch
858c3f696c Add an update_progress implementation
This allows for Python code providing a callback function that
is used to indicate progress.

Also fix a few minor things in message callback (reference
counting of Python objects).
2024-03-18 20:57:17 +01:00
Joerg Wunsch
296883cf1a Initialize progress reporting in avr_{read,write}_mem
Progress reporting needs to be initialized by passing it a "header"
string, in order to re-adjust internal static variables.
avr_{read,write}_mem did not do this, so they only reported progress
upon the very first invocation.
2024-03-18 20:55:19 +01:00
Joerg Wunsch
68d44ea1e6 Implement Python callback for avrdude_message2()
Doing so requires quite a bit of C preprocessing, since a va_list from
C cannot be passed to a Python function directly.

Also, using stdout or stderr is not necessarily going to be the
correct target for a Python program, so instead, convert the FILE*
arguments to names to pass them to Python.

By now, the '\v' feature of the message system (conditional newline)
is ignored here.
2024-03-18 17:45:55 +01:00
Joerg Wunsch
5782c182c1 Update swigtest.py
Reflect current status: helper to start and stop a programmer in the
correct sequence. Read signature memory space, and compare signature
against config file definition.
2024-03-15 22:52:59 +01:00
Joerg Wunsch
1e3dc29d81 Add more docstrings, clean-up warnings 2024-03-15 21:12:10 +01:00
Joerg Wunsch
a3475a6629 Implement the heart of struct programmer_t
This also implements the main methods that need to be accessible
from outside, as kind-of an OO approach to struct programmer_t.
2024-03-15 17:57:56 +01:00
Joerg Wunsch
c9cee81281 Add a typemap to represent the AVRPART signature as Python bytes. 2024-03-15 17:27:17 +01:00