Commit Graph

3568 Commits

Author SHA1 Message Date
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
Joerg Wunsch
920b964af9 Add AVRMEM* buffer handling methods
m->buf is not directly accessible from within Python. Add two methods
that allow to place and retrieve data there, as Python bytes() objects.
2024-03-15 14:35:07 +01:00
Joerg Wunsch
356693dab4 Add device variants to example printout 2024-03-13 13:56:40 +01:00
Joerg Wunsch
1968a11754 Combine the various cast_* functions with ldata()
All these typecast helpers are supposed to operate on LNODEID elements,
in order to convert them to the desired target type. As such, it makes
sense to include the ldata() LNODEID access itself.

Add docstrings for them as well, also for the entire module.
2024-03-13 12:53:30 +01:00
Joerg Wunsch
d34324ceed Add a -v option to build.sh
This allows for a verbose build, where the commands being called
are displayed.
2024-03-12 20:54:21 +01:00
Joerg Wunsch
f9b959343e Replace hand-crafted dicts for AVRMEM and AVRPART by SWIG structs
This requires a bit of Python helpers for pretty-printing, but
otherwise simplifies many things later on.
2024-03-12 18:12:28 +01:00
Joerg Wunsch
fd8704d982 Implement avrdude_message2() from main.c
This is eventually to be replaced by a Python callback.
Right now, use what main.c is using.
2024-03-10 22:55:50 +01:00
Joerg Wunsch
65bf6393da Declare avrdude_message*() in library header file
While these functions are *not* implemented by the library itself,
they are supposed to be provided by whatever application is using the
library. As such, they need to be declared in the public library
header file, including the various constants for msglvl and msgmode.
2024-03-10 22:50:24 +01:00
mcuee
e986f167db Add PYTHON_LIBRARY to swig_libavrdude linking 2024-03-09 20:55:25 +08:00
Joerg Wunsch
e063bf16db Make path to os.add_dll_directory() absolute 2024-03-09 08:15:38 +01:00
Joerg Wunsch
3f5c32b6d4 Fix include directories for SWIG build 2024-03-08 16:16:35 +01:00
Joerg Wunsch
8c4f3b0632 Tweak Windows DLL search paths 2024-03-08 16:10:46 +01:00
mcuee
cfe608a63f Update build.yml to use CMAKE_VERBOSE_MAKEFILE to debug Windows build
This is to debug Windows MSVC and MSYS2 build.
Previous change already use the same option to debug macOS build.
2024-03-08 17:23:07 +08:00
Joerg Wunsch
9be5164b5b Add prog_modes to AVRPART* wrapper
Can be then passed to ad.avr_prog_modes_str() to decode nicely.
2024-03-08 08:58:29 +01:00
Joerg Wunsch
e10730ef40 Add some heuristics to find out the Windows build directory
Adding the build directory to the module search path eases development
by now.
2024-03-08 08:39:07 +01:00
Joerg Wunsch
3f944559b6 Add PM_* names, and signature search functions 2024-03-07 22:49:13 +01:00