Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update part cmd #1568

Merged
merged 44 commits into from
Nov 22, 2023
Merged

Update part cmd #1568

merged 44 commits into from
Nov 22, 2023

Conversation

MCUdude
Copy link
Collaborator

@MCUdude MCUdude commented Nov 11, 2023

I'm creating this unfinished PR to start a discussion on how we want the part command in terminal mode, and (and output in verbose mode) to look like. I've removed a bunch of what I'd consider "non-useful information" to the average user.

The memory array width is dependent on the character width of the differetnt entries. However, the code is a bit ugly, so feel free to suggest how it can be further improved.

It would be neat if the memories could be sorted based on their offset, but I couldn't figure out a clean way of doing this. @stefanrueger?

Are there other things we should show/print in the part command?

This is what the output looks like on classic AVRs, modern AVRs, and Xmegas.

$ ./avrdude -cdryrun -patmega64 -PUSB -T 'part' -qq
AVR Part                : ATmega64
Programming modes       : PM_SPM | PM_ISP | PM_HVPP | PM_JTAG | PM_JTAGmkI

| Memory       | Size  | Pg size |
|--------------|-------|---------|
| eeprom       |  2048 |       8 |
| flash        | 65536 |     256 |
| lfuse        |     1 |       1 |
| hfuse        |     1 |       1 |
| efuse        |     1 |       1 |
| lock         |     1 |       1 |
| signature    |     3 |       1 |
| calibration  |     4 |       1 |
| io           |   224 |       1 |


$ ./avrdude -cdryrun -pavr128da48 -PUSB -T 'part' -qq
AVR Part                : AVR128DA48
Programming modes       : PM_SPM | PM_UPDI

| Memory          | Size   | Pg size | Offset    |
|-----------------|--------|---------|-----------|
| fuses           |     16 |       1 |    0x1050 |
| fuse0/wdtcfg    |      1 |       1 |    0x1050 |
| fuse1/bodcfg    |      1 |       1 |    0x1051 |
| fuse2/osccfg    |      1 |       1 |    0x1052 |
| fuse5/syscfg0   |      1 |       1 |    0x1055 |
| fuse6/syscfg1   |      1 |       1 |    0x1056 |
| fuse7/codesize  |      1 |       1 |    0x1057 |
| fuse8/bootsize  |      1 |       1 |    0x1058 |
| lock            |      4 |       1 |    0x1040 |
| prodsig/sigrow  |    128 |     128 |    0x1100 |
| signature       |      3 |       1 |    0x1100 |
| tempsense       |      4 |       1 |    0x1104 |
| sernum          |     16 |       1 |    0x1110 |
| userrow/usersig |     32 |      32 |    0x1080 |
| data            |      0 |       1 | 0x1000000 |
| io              |   4160 |       1 |       0x0 |
| sib             |     32 |       1 |       0x0 |
| eeprom          |    512 |       1 |    0x1400 |
| flash           | 131072 |     512 |  0x800000 |


$ ./avrdude -cdryrun -patxmega128a1u -PUSB -T 'part' -qq
AVR Part                : ATxmega128A1U
Programming modes       : PM_SPM | PM_PDI | PM_XMEGAJTAG

| Memory         | Size   | Pg size | Offset    |
|----------------|--------|---------|-----------|
| fuse1          |      1 |       1 |  0x8f0021 |
| fuse2          |      1 |       1 |  0x8f0022 |
| fuse4          |      1 |       1 |  0x8f0024 |
| fuse5          |      1 |       1 |  0x8f0025 |
| lock           |      1 |       1 |  0x8f0027 |
| prodsig/sigrow |     64 |      64 |  0x8e0200 |
| signature      |      3 |       1 | 0x1000090 |
| data           |      0 |       1 | 0x1000000 |
| io             |   4096 |       1 |       0x0 |
| eeprom         |   2048 |      32 |  0x8c0000 |
| flash          | 139264 |     512 |  0x800000 |
| application    | 131072 |     512 |  0x800000 |
| apptable       |   8192 |     512 |  0x81e000 |
| boot           |   8192 |     512 |  0x820000 |
| usersig        |    512 |     512 |  0x8e0400 |
| fuse0          |      1 |       1 |  0x8f0020 |

@mcuee mcuee added the enhancement New feature or request label Nov 12, 2023
@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 12, 2023

I've now added a "variants" table as well. Again, feedback is welcome!

$ ./avrdude -cdryrun -patmega328p -PUSB -qq -T 'part'
AVR Part                : ATmega328P
Programming modes       : PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE

| Variants        | Package | F max  | T range      | V range      |
|-----------------|---------|--------|--------------|--------------|
| ATmega328P      | N/A     | 20 MHz | -40 C,   N/A | 1.8 V, 5.5 V |
| ATmega328P-15MZ | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-AN   | TQFP32  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
| ATmega328P-ANR  | TQFP32  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
| ATmega328P-AU   | TQFP32  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-AUR  | TQFP32  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-MMH  | MLF28   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-MMHR | MLF28   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-MN   | QFN32   | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
| ATmega328P-MNR  | MLF32   | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
| ATmega328P-MU   | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-MUR  | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
| ATmega328P-PN   | PDIP28  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
| ATmega328P-PU   | PDIP28  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |

| Memory       | Size  | Pg size |
|--------------|-------|---------|
| eeprom       |  1024 |       4 |
| flash        | 32768 |     128 |
| lfuse        |     1 |       1 |
| hfuse        |     1 |       1 |
| efuse        |     1 |       1 |
| lock         |     1 |       1 |
| signature    |     3 |       1 |
| calibration  |     1 |       1 |
| io           |   224 |       1 |

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

@MCUdude

Somehow I can not build this under MSYS2 mingw (without GNU readline installed). Latest git main is okay.

I think this has nothing to do with your changes in this PR though. Maybe you want to merge git main changes. Thanks.

MINGW64 /c/work/avr/avrdude_test/avrdude_hans
$ ./build.sh
-- Building for: Ninja
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.42.0")
-- Found FLEX: C:/msys64/usr/bin/flex.exe (found version "2.6.4")
-- Found BISON: C:/msys64/usr/bin/bison.exe (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - found
-- Looking for usb.h
-- Looking for usb.h - not found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - found
-- Looking for libusb.h
-- Looking for libusb.h - not found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DON'T HAVE libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (5.4s)
-- Generating done (0.0s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_hans/build_mingw64_nt-10.0-22621
[46/72] Building C object src/CMakeFiles/libavrdude.dir/term.c.obj
FAILED: src/CMakeFiles/libavrdude.dir/term.c.obj
C:\msys64\mingw64\bin\cc.exe -DCONFIG_DIR="\"C:/Program Files (x86)/avrdude/etc\"" -IC:/work/avr/avrdude_test/avrdude_hans/build_mingw64_nt-10.0-22621/src -IC:/work/avr/avrdude_test/avrdude_hans -IC:/work/avr/avrdude_test/avrdude_hans/build_mingw64_nt-10.0-22621 -IC:/msys64/mingw64/include/libusb-compat -IC:/work/avr/avrdude_test/avrdude_hans/src -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/term.c.obj -MF src\CMakeFiles\libavrdude.dir\term.c.obj.d -o src/CMakeFiles/libavrdude.dir/term.c.obj -c C:/work/avr/avrdude_test/avrdude_hans/src/term.c
C:/work/avr/avrdude_test/avrdude_hans/src/term.c:41:10: fatal error: readline/readline.h: No such file or directory
   41 | #include <readline/readline.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[55/72] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.obj
ninja: build stopped: subcommand failed.
Build failed.

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

It is the same for MSVC build. No idea why. Git main is okay but not this PR.

On the other hand, github action is fine. So it is kind of strange.

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

Using the github action binary for testing.

@MCUdude
Is it possible for the variants info to present only for -vv and not -v.

In fact, I think the memory info is alreay too verbose for -v and the variants info make even more verbose. I actually will prefer we remove the memory info from -v in future release (major version update like 8.0).

PS C:\work\avr\avrdude_test\avrdude_bin\pr1568\avrdude-msvc-x64> function prompt {$null}
PS>pwd

Path
----
C:\work\avr\avrdude_test\avrdude_bin\pr1568\avrdude-msvc-x64

P> .\avrdude -c dryrun -p m328p -v

avrdude: Version 7.2-20231112 (bd2a7be)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\pr1568\avrdude-msvc-x64\avrdude.conf

         Using Port              : lpt1
         Using Programmer        : dryrun
         AVR Part                : ATmega328P
         Programming modes       : PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE

         | Variants        | Package | F max  | T range      | V range      |
         |-----------------|---------|--------|--------------|--------------|
         | ATmega328P      | N/A     | 20 MHz | -40 C,   N/A | 1.8 V, 5.5 V |
         | ATmega328P-15MZ | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-AN   | TQFP32  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATmega328P-ANR  | TQFP32  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATmega328P-AU   | TQFP32  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-AUR  | TQFP32  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-MMH  | MLF28   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-MMHR | MLF28   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-MN   | QFN32   | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATmega328P-MNR  | MLF32   | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATmega328P-MU   | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-MUR  | MLF32   | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | ATmega328P-PN   | PDIP28  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATmega328P-PU   | PDIP28  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |

         | Memory       | Size  | Pg size |
         |--------------|-------|---------|
         | eeprom       |  1024 |       4 |
         | flash        | 32768 |     128 |
         | lfuse        |     1 |       1 |
         | hfuse        |     1 |       1 |
         | efuse        |     1 |       1 |
         | lock         |     1 |       1 |
         | signature    |     3 |       1 |
         | calibration  |     1 |       1 |
         | io           |   224 |       1 |

         Programmer Type : Dryrun
         Description     : Emulates programming without a programmer
         Dryrun programmer for m328p
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

The output format looks nice though.

PS>.\avrdude -c dryrun -p avr64ea48 -v

avrdude: Version 7.2-20231112 (bd2a7be)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\pr1568\avrdude-msvc-x64\avrdude.conf

         Using Port              : lpt1
         Using Programmer        : dryrun
         AVR Part                : AVR64EA48
         Programming modes       : PM_SPM | PM_UPDI

         | Variants        | Package | F max  | T range      | V range      |
         |-----------------|---------|--------|--------------|--------------|
         | AVR64EA48       | VQFN48  | 20 MHz | -40 C, 125 C | 1.8 V, 5.5 V |
         | AVR64EA48-I/6LX | VQFN48  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |
         | AVR64EA48-I/PT  | TQFP48  | 20 MHz | -40 C,  85 C | 1.8 V, 5.5 V |

         | Memory          | Size  | Pg size | Offset    |
         |-----------------|-------|---------|-----------|
         | fuses           |    16 |       1 |    0x1050 |
         | fuse0/wdtcfg    |     1 |       1 |    0x1050 |
         | fuse1/bodcfg    |     1 |       1 |    0x1051 |
         | fuse2/osccfg    |     1 |       1 |    0x1052 |
         | fuse5/syscfg0   |     1 |       1 |    0x1055 |
         | fuse6/syscfg1   |     1 |       1 |    0x1056 |
         | fuse7/codesize  |     1 |       1 |    0x1057 |
         | fuse8/bootsize  |     1 |       1 |    0x1058 |
         | lock            |     4 |       1 |    0x1040 |
         | prodsig/sigrow  |   128 |     128 |    0x1100 |
         | signature       |     3 |       1 |    0x1100 |
         | tempsense       |     4 |       1 |    0x1104 |
         | sernum          |    16 |       1 |    0x1110 |
         | userrow/usersig |    64 |      64 |    0x1080 |
         | data            |     0 |       1 | 0x1000000 |
         | io              |  4160 |       1 |       0x0 |
         | sib             |    32 |       1 |       0x0 |
         | eeprom          |   512 |       8 |    0x1400 |
         | flash           | 65536 |     128 |  0x800000 |

         Programmer Type : Dryrun
         Description     : Emulates programming without a programmer
         Dryrun programmer for avr64ea48
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e961e (probably avr64ea48)

avrdude done.  Thank you.

PS>.\avrdude -c dryrun -p t3216 -v

avrdude: Version 7.2-20231112 (bd2a7be)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\pr1568\avrdude-msvc-x64\avrdude.conf

         Using Port              : lpt1
         Using Programmer        : dryrun
         AVR Part                : ATtiny3216
         Programming modes       : PM_SPM | PM_UPDI

         | Variants       | Package | F max  | T range      | V range      |
         |----------------|---------|--------|--------------|--------------|
         | ATtiny3216-SF  | SOIC20  | 20 MHz | -40 C, 125 C | 1.8 V, 5.5 V |
         | ATtiny3216-SFR | SOIC20  | 20 MHz | -40 C, 125 C | 1.8 V, 5.5 V |
         | ATtiny3216-SN  | SOIC20  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |
         | ATtiny3216-SNR | SOIC20  | 20 MHz | -40 C, 105 C | 1.8 V, 5.5 V |

         | Memory          | Size  | Pg size | Offset    |
         |-----------------|-------|---------|-----------|
         | fuses           |    10 |       1 |    0x1280 |
         | fuse0/wdtcfg    |     1 |       1 |    0x1280 |
         | fuse1/bodcfg    |     1 |       1 |    0x1281 |
         | fuse2/osccfg    |     1 |       1 |    0x1282 |
         | fuse5/syscfg0   |     1 |       1 |    0x1285 |
         | fuse6/syscfg1   |     1 |       1 |    0x1286 |
         | fuse7/append    |     1 |       1 |    0x1287 |
         | fuse8/bootend   |     1 |       1 |    0x1288 |
         | lock            |     1 |       1 |    0x128a |
         | prodsig/sigrow  |    64 |      64 |    0x1100 |
         | signature       |     3 |       1 |    0x1100 |
         | tempsense       |     2 |       1 |    0x1120 |
         | sernum          |    10 |       1 |    0x1103 |
         | osccal16        |     2 |       1 |    0x1118 |
         | osccal20        |     2 |       1 |    0x111a |
         | osc16err        |     2 |       1 |    0x1122 |
         | osc20err        |     2 |       1 |    0x1124 |
         | data            |     0 |       1 | 0x1000000 |
         | io              |  4352 |       1 |       0x0 |
         | sib             |    32 |       1 |       0x0 |
         | userrow/usersig |    64 |      64 |    0x1300 |
         | eeprom          |   256 |      64 |    0x1400 |
         | flash           | 32768 |     128 |    0x8000 |
         | fuse4/tcd0cfg   |     1 |       1 |    0x1284 |

         Programmer Type : Dryrun
         Description     : Emulates programming without a programmer
         Dryrun programmer for t3216
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9521 (probably t3216)

avrdude done.  Thank you.

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 13, 2023

I've updated the branch, so please try to build again.

Is it possible for the variants info to present only for -vv and not -v.

Everything is possible. I put it in there for demonstration purposes.
However, one downside of doing this is that the part command will result in a different output depending on the verbosity level.

But we can print just the information we want when Avrdude is executed (with -v or -vv), and print everything with the part command.

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

I've updated the branch, so please try to build again.

I think the build issue is not related to your PR. I have installed back GNU Readline and ncurses and now everything is back to normal for my local MinGW build.

Is it possible for the variants info to present only for -vv and not -v.

Everything is possible. I put it in there for demonstration purposes. However, one downside of doing this is that the part command will result in a different output depending on the verbosity level.

But we can print just the information we want when Avrdude is executed (with -v or -vv), and print everything with the part command.

That will be my preference.

But let's hear from @stefanrueger as well.

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

Overall I think this PR is quite nice to have.

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 13, 2023

Another table formatting option is removing the pipes separating the columns:

| Variants         Package  F max   T range         V range        |
|------------------------------------------------------------------|
| ATmega328P       N/A      20 MHz  [-40 C,   N/A]  [1.8 V, 5.5 V] |
| ATmega328P-15MZ  MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-AN    TQFP32   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-ANR   TQFP32   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-AU    TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-AUR   TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MMH   MLF28    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MMHR  MLF28    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MN    QFN32    20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-MNR   MLF32    20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-MU    MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MUR   MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-PN    PDIP28   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-PU    PDIP28   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |

| Memory        Size   Pg size |
|------------------------------|
| eeprom         1024        4 |
| flash         32768      128 |
| lfuse             1        1 |
| hfuse             1        1 |
| efuse             1        1 |
| lock              1        1 |
| signature         3        1 |
| calibration       1        1 |
| io              224        1 |

@mcuee
Copy link
Collaborator

mcuee commented Nov 13, 2023

Another table formatting option is removing the pipes separating the columns:

I am okay either way, with slight prerference towards using the pipes to seperare the columns.

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 13, 2023

I decided I like the table better without the pipes separating the colums, so I removed them. It's easy to add them back in if this choice turns out to be controversial.

Now the parts command looks like this:

$ avrdude -cdryrun -pattiny10 -qq -T 'part'
AVR Part                : ATtiny10
Programming modes       : TPI

| Variants       Package  F max   T range         V range        |
|----------------------------------------------------------------|
| ATtiny10-MAHR  UDFN8    12 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| ATtiny10-TS8R  SOT23-6  10 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| ATtiny10-TSHR  SOT23-6  12 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |

| Memory       Size  Pg size |
|----------------------------|
| fuse            1       16 |
| lockbits        1       16 |
| signature       3       16 |
| calibration     1       16 |
| flash        1024       16 |
| io             64        1 |

$ avrdude -cdryrun -patmega328p -qq -T 'part'
AVR Part                : ATmega328P
Programming modes       : SPM, ISP, HVPP, debugWIRE

| Variants         Package  F max   T range         V range        |
|------------------------------------------------------------------|
| ATmega328P       N/A      20 MHz  [-40 C,   N/A]  [1.8 V, 5.5 V] |
| ATmega328P-15MZ  MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-AN    TQFP32   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-ANR   TQFP32   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-AU    TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-AUR   TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MMH   MLF28    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MMHR  MLF28    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MN    QFN32    20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-MNR   MLF32    20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-MU    MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-MUR   MLF32    20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| ATmega328P-PN    PDIP28   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V] |
| ATmega328P-PU    PDIP28   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |

| Memory       Size   Pg size |
|-----------------------------|
| eeprom        1024        4 |
| flash        32768      128 |
| lfuse            1        1 |
| hfuse            1        1 |
| efuse            1        1 |
| lock             1        1 |
| signature        3        1 |
| calibration      1        1 |
| io             224        1 |

$ avrdude -cdryrun -pavr128db48 -qq -T 'part'
AVR Part                : AVR128DB48
Programming modes       : SPM, UPDI

| Variants           Package  F max   T range         V range        |
|--------------------------------------------------------------------|
| AVR128DB48         QFN48    32 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| AVR128DB48-E/6LX   VQFN48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| AVR128DB48-E/PT    TQFP48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| AVR128DB48-I/6LX   VQFN48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| AVR128DB48-I/PT    TQFP48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| AVR128DB48T-E/6LX  VQFN48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| AVR128DB48T-E/PT   TQFP48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V] |
| AVR128DB48T-I/6LX  VQFN48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |
| AVR128DB48T-I/PT   TQFP48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V] |

| Memory           Size    Pg size     Offset |
|---------------------------------------------|
| fuses                16        1     0x1050 |
| fuse0/wdtcfg          1        1     0x1050 |
| fuse1/bodcfg          1        1     0x1051 |
| fuse2/osccfg          1        1     0x1052 |
| fuse5/syscfg0         1        1     0x1055 |
| fuse6/syscfg1         1        1     0x1056 |
| fuse7/codesize        1        1     0x1057 |
| fuse8/bootsize        1        1     0x1058 |
| lock                  4        1     0x1040 |
| prodsig/sigrow      128      128     0x1100 |
| signature             3        1     0x1100 |
| tempsense             4        1     0x1104 |
| sernum               16        1     0x1110 |
| userrow/usersig      32       32     0x1080 |
| data                  0        1  0x1000000 |
| io                 4160        1        0x0 |
| sib                  32        1        0x0 |
| eeprom              512        1     0x1400 |
| flash            131072      512   0x800000 |

@stefanrueger any thoughts?

@mcuee
Copy link
Collaborator

mcuee commented Nov 14, 2023

I decided I like the table better without the pipes separating the colums, so I removed them. It's easy to add them back in if this choice turns out to be controversial.

Now the parts command looks like this:

This looks okay to me. Let's see if @stefanrueger likes it or not.

@mcuee
Copy link
Collaborator

mcuee commented Nov 14, 2023

BTW, it is interesting that I need to blow the git repo and then I can build under MSVC. Quite strange. Maybe I occasionally use MSYS2 git which disturbs the normal git for Windows.

Just a note to myself.

@stefanrueger
Copy link
Collaborator

I like how the tables look and I like that we do something with the variants. My own preference would be to output the variants on parts -v instead of the memory layout. This to make it easier to parse the output by scripts.

I am at sixes and sevens over using | to structure the columns. This is (slightly) better for scripts that want to evaluate the output of the part command. Visually I like the version without | better as it looks cleaner. In case we adopt the latter, I would also remove the table | as I predict that looks even cleaner.

Here how it would look like:

$ avrdude -cdryrun -pavr128db48 -qq -T "part -?"
Syntax: part
Function: display the current part information with memory layout
Option:
    -v Show variants instead of memory layout
$ avrdude -cdryrun -pavr128db48 -qq -T part
AVR Part                : AVR128DB48
Programming modes       : SPM, UPDI

Memory           Size    Pg size     Offset
-------------------------------------------
fuses                16        1     0x1050
fuse0/wdtcfg          1        1     0x1050
fuse1/bodcfg          1        1     0x1051
fuse2/osccfg          1        1     0x1052
fuse5/syscfg0         1        1     0x1055
fuse6/syscfg1         1        1     0x1056
fuse7/codesize        1        1     0x1057
fuse8/bootsize        1        1     0x1058
lock                  4        1     0x1040
prodsig/sigrow      128      128     0x1100
signature             3        1     0x1100
tempsense             4        1     0x1104
sernum               16        1     0x1110
userrow/usersig      32       32     0x1080
data                  0        1  0x1000000
io                 4160        1        0x0
sib                  32        1        0x0
eeprom              512        1     0x1400
flash            131072      512   0x800000
$ avrdude -cdryrun -pavr128db48 -qq -T "part -v"
AVR Part                : AVR128DB48
Programming modes       : SPM, UPDI

Variants           Package  F max   T range         V range
------------------------------------------------------------------
AVR128DB48         QFN48    32 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
AVR128DB48-E/6LX   VQFN48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
AVR128DB48-E/PT    TQFP48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
AVR128DB48-I/6LX   VQFN48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
AVR128DB48-I/PT    TQFP48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
AVR128DB48T-E/6LX  VQFN48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
AVR128DB48T-E/PT   TQFP48   24 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
AVR128DB48T-I/6LX  VQFN48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
AVR128DB48T-I/PT   TQFP48   24 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]

@stefanrueger
Copy link
Collaborator

sorted based on their offset, but I couldn't figure out a clean way of doing this. @stefanrueger?

I can do that but most likely in a separate PR after this one got merged. Too busy right now.

@stefanrueger
Copy link
Collaborator

Since you asked... I prefer both: trimming the spaces left of the colon from the strings in main.c and adding extra whitespace to the programmer-specific information so everything lines up. The task comes to finding a sweetspot column location that works for both.

There is something else: For scripts it is neater if they can request only the memory info or only the variants. I think you suggested these options earlier, @MCUdude. And it would be cool if the part command wouldn't need fiddling with verbose settings to display all. The following changes make it so:

diff --git a/src/avrpart.c b/src/avrpart.c
index 3be90249..0d29e99f 100644
--- a/src/avrpart.c
+++ b/src/avrpart.c
@@ -866,7 +866,7 @@ void avr_display(FILE *f, const AVRPART *p, const char *prefix, int verbose) {
   fprintf(f, "%sAVR Part                : %s\n", prefix, p->desc);
   fprintf(f, "%sProgramming modes       : %s\n", prefix, prog_modes_str(p->prog_modes));
 
-  if(verbose > 1) {
+  if(strlen(prefix) == 0 || verbose > 1) {
     avr_mem_display(f, p, prefix);
     avr_variants_display(f, p, prefix);
   }
diff --git a/src/term.c b/src/term.c
index 28d1058b..89460ee9 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1560,19 +1560,54 @@ finished:
 
 
 static int cmd_part(const PROGRAMMER *pgm, const AVRPART *p, int argc, char *argv[]) {
-  if(argc > 1) {
+  int help = 0, onlymem = 0, onlyvariants = 0, invalid = 0, itemac = 1;
+
+  for(int ai = 0; --argc > 0; ) { // Simple option parsing
+    const char *q;
+    if(*(q=argv[++ai]) != '-' || !q[1])
+      argv[itemac++] = argv[ai];
+    else {
+      while(*++q) {
+        switch(*q) {
+        case '?':
+        case 'h':
+          help++;
+          break;
+        case 'v':
+          onlyvariants++;
+          break;
+        case 'm':
+          onlymem++;
+          break;
+        default:
+          if(!invalid++)
+            pmsg_error("(part) invalid option %c, see usage:\n", *q);
+          q = "x";
+        }
+      }
+    }
+  }
+  argc = itemac;                // (arg,c argv) still valid but options have been removed
+
+  if(argc > 1 || help || invalid || (onlymem && onlyvariants)) {
+    if(onlymem && onlyvariants)
+      pmsg_error("(part) cannot mix -v and -m\n");
     msg_error(
       "Syntax: part\n"
-      "Function: display the current part information\n"
+      "Function: display the current part information including memory and variants\n"
+      "Options:\n"
+      "    -m only display memory information\n"
+      "    -v only display variants information\n"
     );
     return -1;
   }
 
-  term_out("\v");
-  avr_display(stdout, p, "", 0);
-  avr_mem_display(stdout, p, "");
-  if(verbose)
+  if(onlymem)
+    avr_mem_display(stdout, p, "");
+  else if(onlyvariants)
     avr_variants_display(stdout, p, "");
+  else if(!onlymem && !onlyvariants)
+    avr_display(stdout, p, "", 0);
   term_out("\v");
 
   return 0;

See how you like that

@stefanrueger
Copy link
Collaborator

Maybe it's another idea to not use avr_display() in the terminal part command at all seeing that we only print the part name with its programming types. So the term.c code could look like

  if(onlymem)
    avr_mem_display(stdout, p, "");
  else if(onlyvariants)
    avr_variants_display(stdout, p, "");
  else {
    term_out("%s with programming modes %s\n", p->desc, avr_prog_modes_str(p->prog_modes));
    avr_mem_display(stdout, p, "");
    avr_variants_display(stdout, p, "");
  }

This would require the static char *prog_modes_str() to be made global as const char*avr_prog_modes().

This is the output in the terminal

$ avrdude -pt3216 -cdryrun -tqq
avrdude> part
ATtiny3216 with programming modes UPDI, SPM

Memory            Size  Pg size     Offset
------------------------------------------
fuses               10        1     0x1280 
fuse0/wdtcfg         1        1     0x1280 
fuse1/bodcfg         1        1     0x1281 
fuse2/osccfg         1        1     0x1282 
fuse5/syscfg0        1        1     0x1285 
fuse6/syscfg1        1        1     0x1286 
fuse7/append         1        1     0x1287 
fuse8/bootend        1        1     0x1288 
lock                 1        1     0x128a 
prodsig/sigrow      64       64     0x1100 
signature            3        1     0x1100 
tempsense            2        1     0x1120 
sernum              10        1     0x1103 
osccal16             2        1     0x1118 
osccal20             2        1     0x111a 
osc16err             2        1     0x1122 
osc20err             2        1     0x1124 
data                 0        1  0x1000000 
io                4352        1        0x0 
sib                 32        1        0x0 
userrow/usersig     64       64     0x1300 
eeprom             256       64     0x1400 
flash            32768      128     0x8000 
fuse4/tcd0cfg        1        1     0x1284 

Variants        Package  F max   T range         V range       
---------------------------------------------------------------
ATtiny3216-SF   SOIC20   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATtiny3216-SFR  SOIC20   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATtiny3216-SN   SOIC20   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V]
ATtiny3216-SNR  SOIC20   20 MHz  [-40 C, 105 C]  [1.8 V, 5.5 V]

If we go down this route then the avr_display() function is used exclusively for the CLI (and doesn't need changing except for potential column alignment).

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 19, 2023

Thanks for the suggestions @stefanrueger! I've done some additional tweaks and added -v and -m support.

I've tested this PR using the Power Debugger, STK500 (v1 FW), STK500 (v2 FW), STK600, and AVR Dragon. No colon inconsistencies anymore!

@mcuee
Copy link
Collaborator

mcuee commented Nov 20, 2023

I like the output of this PR.

PS>.\avrdude_pr1568v4 -C .\avrdude_pr1568v4.conf -c dryrun -P usb -p m4808 -qqt
avrdude> part -m

Memory            Size  Pg size     Offset
------------------------------------------
fuses               10        1     0x1280
fuse0/wdtcfg         1        1     0x1280
fuse1/bodcfg         1        1     0x1281
fuse2/osccfg         1        1     0x1282
fuse5/syscfg0        1        1     0x1285
fuse6/syscfg1        1        1     0x1286
fuse7/append         1        1     0x1287
fuse8/bootend        1        1     0x1288
lock                 1        1     0x128a
prodsig/sigrow     128      128     0x1100
signature            3        1     0x1100
tempsense            2        1     0x1120
sernum              10        1     0x1103
osccal16             2        1     0x1118
osccal20             2        1     0x111a
osc16err             2        1     0x1122
osc20err             2        1     0x1124
data                 0        1  0x1000000
io                4352        1        0x0
sib                 32        1        0x0
userrow/usersig     64       64     0x1300
eeprom             256       64     0x1400
flash            49152      128     0x4000
avrdude> part -v

Variants        Package  F max   T range         V range
---------------------------------------------------------------
ATmega4808-AF   TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-AFR  TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-AU   TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-AUR  TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-MF   VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-MFR  VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-MU   VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-MUR  VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-XF   SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-XFR  SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-XU   SSOP28   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-XUR  SSOP28   N/A     [N/A,     N/A]  [N/A,     N/A]
avrdude> part
ATmega4808 with programming modes UPDI, SPM

Memory            Size  Pg size     Offset
------------------------------------------
fuses               10        1     0x1280
fuse0/wdtcfg         1        1     0x1280
fuse1/bodcfg         1        1     0x1281
fuse2/osccfg         1        1     0x1282
fuse5/syscfg0        1        1     0x1285
fuse6/syscfg1        1        1     0x1286
fuse7/append         1        1     0x1287
fuse8/bootend        1        1     0x1288
lock                 1        1     0x128a
prodsig/sigrow     128      128     0x1100
signature            3        1     0x1100
tempsense            2        1     0x1120
sernum              10        1     0x1103
osccal16             2        1     0x1118
osccal20             2        1     0x111a
osc16err             2        1     0x1122
osc20err             2        1     0x1124
data                 0        1  0x1000000
io                4352        1        0x0
sib                 32        1        0x0
userrow/usersig     64       64     0x1300
eeprom             256       64     0x1400
flash            49152      128     0x4000

Variants        Package  F max   T range         V range
---------------------------------------------------------------
ATmega4808-AF   TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-AFR  TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-AU   TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-AUR  TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-MF   VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-MFR  VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-MU   VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-MUR  VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-XF   SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-XFR  SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
ATmega4808-XU   SSOP28   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
ATmega4808-XUR  SSOP28   N/A     [N/A,     N/A]  [N/A,     N/A]
avrdude> quit
PS>.\avrdude_pr1568v4 -C .\avrdude_pr1568v4.conf -c dryrun -P usb -p m4808 -v

avrdude_pr1568v4: Version 7.2-20231119 (b28ba21a)
                  Copyright the AVRDUDE authors;
                  see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

                  System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude_pr1568v4.conf

                  Using port            : usb
                  Using programmer      : dryrun
                  AVR Part              : ATmega4808
                  Programming modes     : UPDI, SPM
                  Programmer Type       : Dryrun
                  Description           : Emulates programming without a programmer
                  Dryrun programmer for m4808
avrdude_pr1568v4: AVR device initialized and ready to accept instructions
avrdude_pr1568v4: device signature = 0x1e9650 (probably m4808)

avrdude_pr1568v4 done.  Thank you.

PS>.\avrdude_pr1568v4 -C .\avrdude_pr1568v4.conf -c dryrun -P usb -p m4808 -vv

avrdude_pr1568v4: Version 7.2-20231119 (b28ba21a)
                  Copyright the AVRDUDE authors;
                  see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

                  System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude_pr1568v4.conf

                  Using port            : usb
                  Using programmer      : dryrun
                  AVR Part              : ATmega4808
                  Programming modes     : UPDI, SPM

                  Memory            Size  Pg size     Offset
                  ------------------------------------------
                  fuses               10        1     0x1280
                  fuse0/wdtcfg         1        1     0x1280
                  fuse1/bodcfg         1        1     0x1281
                  fuse2/osccfg         1        1     0x1282
                  fuse5/syscfg0        1        1     0x1285
                  fuse6/syscfg1        1        1     0x1286
                  fuse7/append         1        1     0x1287
                  fuse8/bootend        1        1     0x1288
                  lock                 1        1     0x128a
                  prodsig/sigrow     128      128     0x1100
                  signature            3        1     0x1100
                  tempsense            2        1     0x1120
                  sernum              10        1     0x1103
                  osccal16             2        1     0x1118
                  osccal20             2        1     0x111a
                  osc16err             2        1     0x1122
                  osc20err             2        1     0x1124
                  data                 0        1  0x1000000
                  io                4352        1        0x0
                  sib                 32        1        0x0
                  userrow/usersig     64       64     0x1300
                  eeprom             256       64     0x1400
                  flash            49152      128     0x4000

                  Variants        Package  F max   T range         V range
                  ---------------------------------------------------------------
                  ATmega4808-AF   TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-AFR  TQFP32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-AU   TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
                  ATmega4808-AUR  TQFP32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
                  ATmega4808-MF   VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-MFR  VQFN32   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-MU   VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
                  ATmega4808-MUR  VQFN32   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
                  ATmega4808-XF   SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-XFR  SSOP28   20 MHz  [-40 C, 125 C]  [1.8 V, 5.5 V]
                  ATmega4808-XU   SSOP28   20 MHz  [-40 C,  85 C]  [1.8 V, 5.5 V]
                  ATmega4808-XUR  SSOP28   N/A     [N/A,     N/A]  [N/A,     N/A]

                  Programmer Type       : Dryrun
                  Description           : Emulates programming without a programmer
                  Dryrun programmer for m4808
avrdude_pr1568v4: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00 s
avrdude_pr1568v4: device signature = 0x1e9650 (probably m4808)

avrdude_pr1568v4 done.  Thank you.

PS>

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 20, 2023

Excellent. Let's hear what @stefanrueger has to say. But I think this PR is ready to be merged in the next mergefest!

src/avrpart.c Outdated Show resolved Hide resolved
src/avrdude.1 Outdated Show resolved Hide resolved
src/avrpart.c Outdated Show resolved Hide resolved
src/avrpart.c Outdated Show resolved Hide resolved
@stefanrueger
Copy link
Collaborator

@MCUdude The output looks great for both CLI and part command; much, much better and much more useful than before. A few small comments above and then this is ready to be merged. The other thing that's needed for the next mergefest is testing PR #1566 (@MCUdude?)

@MCUdude
Copy link
Collaborator Author

MCUdude commented Nov 20, 2023

@stefanrueger I've now implemented your suggested improvements. Please review!

BTW I'm so glad we teamed up and added strutil.c to the code base! It makes my (avrdude)life so much easier!

The other thing that's needed for the next mergefest is testing PR #1566 (@MCUdude?)

I'll see if I can have a look at this again tonight.

leftovers from when I introduced the variants command
@stefanrueger
Copy link
Collaborator

Looks good now, so will merge probably tomorrow (with three other older PRs).

@stefanrueger
Copy link
Collaborator

Small thing: the lines

      if(!m_size[i])
        len = strlen(m->desc) + strlen(a? "/": "") + strlen(a? a->desc: ""); // desc
      else
        len = num_len(str_eq(table_colum[i], "Offset")? "0x%04x": "%d", m_size[i]); // size/pgsize/offset

condition the computation of the length of the memory string on !m_size[i]. That's a bit risky as, eg, the data memory has size 0 possibly leading to a wrong column width. Condition for hex printing of offset is a str_eq() comparison with the title, which is not wrong. Probably it is still better in both cases to compare against column position 0 or 3.

I took the liberty to push a commit onto the PR to do this.

@stefanrueger stefanrueger merged commit 664d36d into avrdudes:main Nov 22, 2023
10 checks passed
MCUdude added a commit to MCUdude/avrdude that referenced this pull request Jan 21, 2024
stefanrueger added a commit that referenced this pull request Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terminal part command could need an update
3 participants