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

To adopt PR #1264 approach of using Readline replacement for MinGW build (WIP, DNM) #1553

Closed
wants to merge 8 commits into from

Conversation

mcuee
Copy link
Collaborator

@mcuee mcuee commented Nov 2, 2023

PR #1264 has been merged and it performs much better than using GNU Readline under Windows. It is good to adopt the same approach for MinGW.

This PR will fix Issue #1271.

This PR was initially developed by Xiaofan Chen based on PR #1264 but it does not work.
@Youw (Ihor Dutchak) helps to sort out the remaining issues.

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

mcuee commented Nov 3, 2023

This PR needs review and testing. Please do not merge yet.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 3, 2023

One potential side effect of using readline.cpp is that this may bring more dependancies to MinGW build. It is not a real problem for MSVC build but it may be not so desired with MinGW.

Reference discussion:

@Youw
Copy link
Contributor

Youw commented Nov 3, 2023

may bring

I guarantee it will as it uses staff from C++ Standard Library (notably thread and mutex).
One potential way of fixing it is to use -static-libstdc++ linker flag. Since none of C++ standard classes are using in any public API, it is safe to do so.

@Youw
Copy link
Contributor

Youw commented Nov 3, 2023

One potential side effect of using tje C++ readline.cpp is that this may bring more dependancies (GCC C++ related run time files) to MinGW build. It is not a real problem for MSVC build but it may be not so desired with MinGW.

Just wondering how difficult it is to rewrite readline.cpp to readline.c. I am for sure not up to the task but I think maybe you can sort it out fast.

More analysys:
Wih readline.cpp we get 3 new dependencies:

  • libgcc_s_seh-1.dll - C++ exceptions handling library;
  • libwinpthread-1.dll - pthread implementation;
  • libstdc++-6.dll - libstdc++;

With -static-libstdc++ we only get rid of libstdc++-6.dll. To get rid of libgcc_s_seh-1.dll we would need to disable C++ exceptions (just another compiler/linker flag.
But even if we rewrite to from C++ to C - I don't believe libwinpthread-1.dll would go away, as we would have to use some kind threading library (probably pthread directly) anyway.

So instead I've tried -static linker flag and it seem to be working even with C++ implementation.
But I'm not sure what other side-effect it may have (other than making it 5.9MB in size instead of 3.6MB w/o -static).

@Youw
Copy link
Contributor

Youw commented Nov 3, 2023

And I can no longer push to your branch :)

This is the patch:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index db1c85d..ef07127 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -319,6 +319,10 @@ add_executable(avrdude

 target_link_libraries(avrdude PUBLIC libavrdude)

+if(MINGW)
+    target_link_options(avrdude PRIVATE -static)
+endif()
+
 # =====================================
 # Install
 # =====================================

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 3, 2023

And I can no longer push to your branch :)

Strange, you should be able to do that. I just checked and you are still listed as collaborator.

Anyway, I just push the patch.

Without this extra dependancies will be brought in.

libgcc_s_seh-1.dll - C++ exceptions handling library;
libwinpthread-1.dll - pthread implementation;
libstdc++-6.dll - libstdc++;
@Youw
Copy link
Contributor

Youw commented Nov 3, 2023

Ah, right, I used the wrong key.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 3, 2023

So instead I've tried -static linker flag and it seem to be working even with C++ implementation.
But I'm not sure what other side-effect it may have (other than making it 5.9MB in size instead of 3.6MB w/o -static).

Static build is okay for MinGW build.

For avrdude project, the default for MSVC/MinGW build is static build. Then the default for Linux/macOS/FreeBSD is dynamic build. But people actually want static build for Linux/macOS as well.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 3, 2023

Now it is good in terms of dependancies.

MINGW64 /c/work/avr/avrdude_test/avrdude_bin/github_bin/pr1553/avrdude-mingw-x86_64
$ ldd ./avrdude.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ff8f8590000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ff8f62f0000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ff8f5ec0000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ff8f68e0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ff8f69b0000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ff8f7f60000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ff8f8430000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7ff8f4120000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7ff8f77f0000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ff8f6850000)
        cfgmgr32.DLL => /c/WINDOWS/SYSTEM32/cfgmgr32.DLL (0x7ff8f5580000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ff8f5da0000)

For my local build.

MINGW64 /c/work/avr/avrdude_test/avrdude_issue1271/build_mingw64_nt-10.0-22621/src
$ ls -la avrdude.exe
-rwxr-xr-x 1 xiaof xiaof 7695183 Nov  3 19:34 avrdude.exe

$ ./avrdude.exe
Usage: avrdude [options]
Options:
  -p <partno>            Specify AVR device; -p ? lists all known parts
  -p <wildcard>/<flags>  Run developer options for matched AVR devices,
                         e.g., -p ATmega328P/s or /S for part definition
  -b <baudrate>          Override RS-232 baud rate
  -B <bitclock>          Specify bit clock period (us)
  -C <config-file>       Specify location of configuration file
  -c <programmer>        Specify programmer; -c ? and -c ?type list all
  -c <wildcard>/<flags>  Run developer options for matched programmers,
                         e.g., -c 'ur*'/s for programmer info/definition
  -A                     Disable trailing-0xff removal for file/AVR read
  -D                     Disable auto erase for flash memory; implies -A
  -i <delay>             ISP Clock Delay [in microseconds]
  -P <port>              Connection; -P ?s or -P ?sa lists serial ones
  -r                     Reconnect to -P port after "touching" it; wait
                         400 ms for each -r; needed for some USB boards
  -F                     Override invalid signature or initial checks
  -e                     Perform a chip erase
  -O                     Perform RC oscillator calibration (see AVR053)
  -t                     Run an interactive terminal when it is its turn
  -T <terminal cmd line> Run terminal line when it is its turn
  -U <memtype>:r|w|v:<filename>[:format]
                         Carry out memory operation when it is its turn
                         Multiple -t, -T and -U options can be specified
  -n                     Do not write to the device whilst processing -U
  -V                     Do not automatically verify during -U
  -E <exitsp>[,<exitsp>] List programmer exit specifications
  -x <extended_param>    Pass <extended_param> to programmer, see -xhelp
  -v                     Verbose output; -v -v for more
  -q                     Quell progress output; -q -q for less
  -l logfile             Use logfile rather than stderr for diagnostics
  -?                     Display this usage

avrdude version 7.2-20231103 (6f3172b0), https://github.com/avrdudes/avrdude

$ ldd avrdude.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ff8f8590000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ff8f62f0000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ff8f5ec0000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ff8f68e0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ff8f69b0000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ff8f7f60000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ff8f8430000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7ff8f77f0000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ff8f6850000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7ff8f4120000)
        cfgmgr32.DLL => /c/WINDOWS/SYSTEM32/cfgmgr32.DLL (0x7ff8f5580000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ff8f5da0000)

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 4, 2023

This PR is not working yet. I encountered the previous issue that I need extra return to excute the command.

PS>.\avrdude_pr1553v1 -C .\avrdude_pr1553v1.conf -c urclock -P ch340 -p m168p -qqt
avrdude> dump signature (need two returns here)
0000  1e 94 0b                                          |..              |
avrdude>
avrdude>
avrdude> quit (need two returns here)
PS>

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 4, 2023

The good thing is that it does not get time out so easily compared to git main MinGW build, which is a known issue.

Example from git main MSYS2 mingw64 build.

PS>.\avrdude_git -c urclock -P ch340 -p m168p -qqt
avrdude> dump signature
0000  1e 94 0b                                          |..              |
avrdude> dump calibration
avrdude_git error: bootloader cannot read from calibration
avrdude_git error: (dump) error reading calibration address 0x00000 of part ATmega168P
                   read operation not supported on memory calibration
avrdude> write signature 0 0x11
avrdude_git error: bootloader does not implement bytewise write to signature
avrdude_git error: (write) error writing 0x11 at 0x00000, rc=-1
                    write operation not supported on memory signature
avrdude> quit
avrdude_git warning: programmer is not responding

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 4, 2023

This PR is not working yet. I encountered the previous issue that I need extra return to excute the command.

Previous issue reported by @MCUdude under macOS when using libedit.

Similar issues when I was testing PR #1132.

@dl8dtl sorted out the issue with libedit with a clever PR. I need to see if it helps in this case or not.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 5, 2023

@Youw
FYI only.

In case you want to see the issue under Windows, you do not need a real setup, just use the -c dryrun programmer emulator.

avrdude -c dryrun -p m328p -qqt

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 6, 2023

The following work-around does not work (similar to PR #1207).

$ git diff
diff --git a/src/mingw/readline.cpp b/src/mingw/readline.cpp
index 4fed1b1e..35f70b6c 100644
--- a/src/mingw/readline.cpp
+++ b/src/mingw/readline.cpp
@@ -13,7 +13,7 @@
 #include "readline/readline.h"
 #include "readline/history.h"

-int rl_readline_version = 0x0502;
+int rl_readline_version = 0x0402;

 static rl_vcpfunc_t* rl_handler;
 static std::unique_ptr<std::thread> rl_thread;

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 6, 2023

Other problems: wrong first line

PS>echo 'read eeprom' | .\avrdude_pr1553 -C .\avrdude_pr1553.conf -c urclock -p m328p -P ch340 -qq -t
avrdude> 0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude>

PS>echo 'read eeprom' | .\avrdude_git -c urclock -p m328p -P ch340 -qq -t
avrdude> read eeprom
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude>

@mcuee mcuee changed the title To adopt PR #1264 approach of using Readline replacement for MinGW build To adopt PR #1264 approach of using Readline replacement for MinGW build (WIP, DNM) Nov 6, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Nov 7, 2023

Looks like I can not sorted out the issue without help from others. I will still keep this PR open for a while, at least until when @stefanrueger is back.

And there are good changes to CMake by @Youw. Even if we close this PR, I may raise another to adopt CMake improvements from this PR into git main.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 8, 2023

The following changes reverted the addition of embedded MinGW Readline and use GNU Readline (if GNU Readline is installed). And it works properly (except existing issues that it may time out in terminal mode sometimes).

So the issue is really related to the embedded readline implementation, which works under MSVC but not MinGW. Strange.

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e69844b1..6bae9f88 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,8 +221,8 @@ endif()

 if(MSVC)
     set(HAVE_LIBREADLINE "Embedded MSVC")
-elseif(MINGW)
-    set(HAVE_LIBREADLINE "Embedded MINGW")
+#elseif(MINGW)
+#    set(HAVE_LIBREADLINE "Embedded MINGW")
 else()
     find_library(HAVE_LIBREADLINE NAMES ${PREFERRED_LIBREADLINE})
     if(HAVE_LIBREADLINE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ef071274..70e5e262 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -80,12 +80,12 @@ if(MSVC)
         )
     list(APPEND EXTRA_WINDOWS_INCLUDES "msvc")
 elseif(MINGW)
-    enable_language(CXX)
+#    enable_language(CXX)

     set(LIB_MATH m)
     add_compile_options(-Wall -Wextra -Wno-unused-parameter)
-    list(APPEND EXTRA_WINDOWS_SOURCES "mingw/readline.cpp")
-    list(APPEND EXTRA_WINDOWS_INCLUDES "mingw")
+#    list(APPEND EXTRA_WINDOWS_SOURCES "mingw/readline.cpp")
+#    list(APPEND EXTRA_WINDOWS_INCLUDES "mingw")
 else()
     set(LIB_MATH m)
     add_compile_options(-Wall -Wextra -Wno-unused-parameter)

PS>echo 'read eeprom' | .\avrdude_pr1553_readline -C .\avrdude_pr1553.conf -c urclock -p m328p -P ch340 -qq -t
avrdude> read eeprom
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude>

PS>.\avrdude_pr1553_readline -C .\avrdude_pr1553.conf -c urclock -p m328p -P ch340 -qq -t
avrdude> read eeprom
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude> quit

Problems with current PR.

PS>.\avrdude_pr1553 -C .\avrdude_pr1553.conf -c urclock -p m328p -P ch340 -qq -t
avrdude> read eeprom (extra return needed)
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude>
avrdude> quit (extra return needed).
PS>

PS>echo 'read eeprom' | .\avrdude_pr1553 -C .\avrdude_pr1553.conf -c urclock -p m328p -P ch340 -qq -t
avrdude> 0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |               (extra 0000 in the beginning)
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
avrdude>

@Youw
Copy link
Contributor

Youw commented Nov 8, 2023

So the issue is really related to the embedded readline implementation, which works under MSVC but not MinGW. Strange.

Could be a difference between GNU/MSVC standard on line endings (\n vs \r\n on Windows) and different terminals used.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 8, 2023

So the issue is really related to the embedded readline implementation, which works under MSVC but not MinGW. Strange.

Could be a difference between GNU/MSVC standard on line endings (\n vs \r\n on Windows)

Ineed I also suspect this reason. By the way, I have also tried MSYS2 clang64 and it has the same problem as MinGW.

and different terminals used.

I have tried Windows Command prompt, WIndows Terminal and MSYS2 terminal, the results are the same.

@Youw
Copy link
Contributor

Youw commented Nov 8, 2023

I have tried Windows Command prompt, WIndows Terminal and MSYS2 terminal, the results are the same.

I find that a good thing - less workarounds in the code would be required.

@stefanrueger
Copy link
Collaborator

I have lost track of this PR. Should it be merged? Afraid I cannot help with Windows issues.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 11, 2023

I have lost track of this PR. Should it be merged?

This PR is not working and it should not be merged.

Afraid I cannot help with Windows issues.

Fair enough.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 11, 2023

I have tried Windows Command prompt, WIndows Terminal and MSYS2 terminal, the results are the same.

I find that a good thing - less workarounds in the code would be required.

As I can not fix the issue myself, I will close this PR for now.

Thanks a lot for the help. I will still keep the following branch open.
https://github.com/mcuee/avrdude/tree/issue1271

@mcuee mcuee closed this Nov 11, 2023
mcuee added a commit to mcuee/avrdude that referenced this pull request Nov 14, 2023
This is to adopt the CMake improvements in PR avrdudes#1553 even though the PR itself was abondoned.

The author of the change is @Youw.
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.

None yet

3 participants