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

MSYS2 MinGW GNU Readline support (Do Not Merge) #1270

Closed
wants to merge 4 commits into from

Conversation

mcuee
Copy link
Collaborator

@mcuee mcuee commented Jan 6, 2023

This PR adds the support of GNU Readline for MSYS2 MinGW build.
Close #1155.

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 6, 2023

@mariusgreuel

Please help to review. Thanks.

This PR needs to be squashed before being merged if the review if okay.

@mcuee mcuee added the enhancement New feature or request label Jan 6, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Jan 6, 2023

I think this does not need to be included in 7.1 release as the official Windows binary will be using MSVC build, so this is not urgent.

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 6, 2023

@mariusgreuel

The other option to enable readline support is to port PR #1264 (readline replacement for MSVC) to MinGW. How do you like that idea?

@mcuee mcuee changed the title MSYS2 MinGW GNU Readline support MSYS2 MinGW GNU Readline support (DNM) Jan 6, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Jan 6, 2023

There is an issue -- libtermcap is dynamically linked, that is why github action does not fail. So this PR is not ready anyway.

MINGW64 /c/work/avr/avrdude_test/avrdude_bin/pr1270
$ ldd ./avrdude.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7fff8ba60000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7fff89e40000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7fff89110000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7fff898e0000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7fff89f00000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7fff8a7c0000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7fff896d0000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7fff8b7e0000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7fff89700000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7fff89630000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7fff89510000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7fff89d70000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7fff8b810000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7fff878a0000)
        libtermcap-0.dll => /mingw64/bin/libtermcap-0.dll (0x6ac40000)

Behavior of the MinGW GNU Readline binary is not as good as PR #1264 for MSVC.

  1. Keep alive will work. -c urclock -t will work.
  2. Pipe works as well
  3. Timeout may happen if we have a long sleep (not a major problem).
  4. CTRL/SHIFT/ALT and CAPSLOCK will cause time out. This seems to be one of the main issue.
PS C:\work\avr\avrdude_test\avrdude_bin\pr1270> .\avrdude -c urclock -P COM3 -p m168p -qqt
avrdude>
PS C:\work\avr\avrdude_test\avrdude_bin\pr1270> ls

    Directory: C:\work\avr\avrdude_test\avrdude_bin\pr1270

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-----            6/1/2023  7:28 am         551067 avrdude.conf
-----            6/1/2023  7:28 am        4092360 avrdude.exe
-a---            4/8/2020  4:15 pm          45347 libtermcap-0.dll

PS C:\work\avr\avrdude_test\avrdude_bin\pr1270> echo "dump flash 0 0x40"  | 
.\avrdude -c urclock -P COM3 -p m168p -qqt
avrdude> dump flash 0 0x40
0000  0c 94 61 00 0c 94 73 00  0c 94 73 00 0c 94 73 00  | .a. .s. .s. .s.|
0010  0c 94 73 00 0c 94 73 00  0c 94 73 00 0c 94 73 00  | .s. .s. .s. .s.|
0020  0c 94 73 00 0c 94 73 00  0c 94 73 00 0c 94 73 00  | .s. .s. .s. .s.|
0030  0c 94 73 00 0c 94 73 00  0c 94 73 00 0c 94 73 00  | .s. .s. .s. .s.|

avrdude>


$  (echo r fl 0x3e00 0x30; sleep 10; echo r fl 0x3f00 0x30; echo quit) | 
./avrdude -c urclock -P COM3 -p m168p -qqt
avrdude> r fl 0x3e00 0x30
3e00  01 c0 b7 c0 11 24 84 b7  90 e8 90 93 61 00 10 92  |.....$......a...|
3e10  61 00 88 23 61 f0 98 2f  9a 70 92 30 41 f0 81 ff  |a..#a../.p.0A...|
3e20  02 c0 97 ef 94 bf 28 2e  80 e0 c6 d0 e9 c0 85 e0  |......(.........|

avrdude> r fl 0x3f00 0xavrdude warning: programmer is not responding
30
avrdude warning: programmer is not responding
avrdude warning: programmer is not responding
avrdude error: unable to read flash page at addr 0x3f00
avrdude error: (dump) error reading flash address 0x03f00 of part ATmega168P
               read operation not supported on memory type flash
avrdude> quit
avrdude warning: programmer is not responding

@mcuee mcuee changed the title MSYS2 MinGW GNU Readline support (DNM) MSYS2 MinGW GNU Readline support (Do Not Merge) Jan 6, 2023
@mariusgreuel
Copy link
Contributor

@mcuee Your changes look good, however, the question to me is whether MinGWs readline is any good.

CTRL/SHIFT/ALT and CAPSLOCK will cause time out. This seems to be one of the main issue.

This suggest that the MinGW readline code has similar deficiencies as GNU Readline for Windows, if not being based the same code.

I tried your MinGW CI build, and at least the x64 build does not crash on Ctrl-R, so they seems to have fixed some x64 related bugs.

Looking at GNU Readline for Windows, I must say its in bad shape. Having worked with it, I think we are better off not using it. Perhaps its easiest to use #1264 for MinGW as well.

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 6, 2023

Looking at GNU Readline for Windows, I must say its in bad shape. Having worked with it, I think we are better off not using it. Perhaps its easiest to use #1264 for MinGW as well.

I agree. I will close thie PR and #1155. Then I will create a new issue to adopt #1264 for MinGW.

@mcuee mcuee closed this Jan 6, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Jan 7, 2023

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.

Readline support for mingw
2 participants