stlink: Windows MinGW64 executables have problems

Using:

  • toolchain mingw-w64\x86_64-5.3.0-win32-sjlj-rt_v4-rev0
  • libusb 1.0.20
  • cmake 3.2

Problems:

  • Printf formatting is broken for (e.g %zu)
  • Libusb prints errors on nucleo-64 (stm32l476), “mbed-enabled”
  • Hex encoded ascii serial (Already in issue #417)

Log:

C:\Users\Jerry\Downloads\stlink-deprecate_autotools\build>st-info.exe --serial
libusb: error [init_device] device '\\.\USB#VID_0483&PID_374B&MI_02#6&2E55A1F8&0&0002' is no longer connected!
303636454646343835353530373535

C:\Users\Jerry\Downloads\stlink-deprecate_autotools\build>st-info.exe --descr
libusb: error [init_device] device '\\.\USB#VID_0483&PID_374B&MI_02#6&2E55A1F8&0&0002' is no longer connected!
L4 device

C:\Users\Jerry\Downloads\stlink-deprecate_autotools\build>st-info.exe --flash
libusb: error [init_device] device '\\.\USB#VID_0483&PID_374B&MI_02#6&2E55A1F8&0&0002' is no longer connected!
0xzx

C:\Users\Jerry\Downloads\stlink-deprecate_autotools\build>st-info.exe --sram
libusb: error [init_device] device '\\.\USB#VID_0483&PID_374B&MI_02#6&2E55A1F8&0&0002' is no longer connected!
0xzx

C:\Users\Jerry\Downloads\stlink-deprecate_autotools\build>st-info.exe --probe
Found zu stlink programmers

This is a followup of issues found in PR #434 when updating MingGW/MSYS build for windows.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (13 by maintainers)

Most upvoted comments

On my PC I receive appropriate output for v1.5.1-patch. Libusb was updated to 1.0.22 in this version. Before v1.5.1-patch libusb warnings appear in the output.

  • I did never really “install” toolchains. Always just download archive and simply extract it in the destination folder.
  • A folder path should contain only ASCII without spaces.

For compile with a certain toolchain, I usually write a simple *.bat script. Like this:

set STLINKVER=git
set CMAKE=e:\test-st\cmake-3.4.0-win32-x86\bin\cmake.exe

set "CUR_DIR=%CD%"
cd %~dp0

PATH=e:\test-st\mingw64\bin;e:\test-st\cmake-3.4.0-win32-x86\bin\;%PATH%

cd %~dp0\stlink-%STLINKVER%

mkdir build-mingw64

cd .\build-mingw64

%CMAKE% -G "Ninja" -DCMAKE_BUILD_TYPE=Release ..

%CMAKE% --build .

This is output for stlink-v1.5.1

e:\test-st\stlink-1.5.1\build-mingw64>st-info.exe --serial
303637324646343835353530373535

e:\test-st\stlink-1.5.1\build-mingw64>st-info.exe --descr
F7 device

e:\test-st\stlink-1.5.1\build-mingw64>st-info.exe --flash
0x100000

e:\test-st\stlink-1.5.1\build-mingw64>st-info.exe --sram
0x50000

e:\test-st\stlink-1.5.1\build-mingw64>st-info.exe --probe
Found 1 stlink programmers
 serial: 303637324646343835353530373535
openocd: "\x30\x36\x37\x32\x46\x46\x34\x38\x35\x35\x35\x30\x37\x35\x35"
  flash: 1048576 (pagesize: 2048)
   sram: 327680
 chipid: 0x0449
  descr: F7 device

Before v1.5.1, I observe issues in output of st-info.