vdudouyt / stm8flash

program your stm8 devices with SWIM/stlinkv(1,2)
GNU General Public License v2.0
403 stars 183 forks source link

Fail to build under Windows with mingw64 #94

Open eeyrw opened 6 years ago

eeyrw commented 6 years ago
PS C:\Users\admin\Desktop\stm8flash> make -j5
GCC -g -O0 --std=gnu99 --pedantic     -c -o stlink.o stlink.c
GCC -g -O0 --std=gnu99 --pedantic     -c -o stlinkv2.o stlinkv2.c
GCC -g -O0 --std=gnu99 --pedantic     -c -o espstlink.o espstlink.c
GCC -g -O0 --std=gnu99 --pedantic     -c -o main.o main.c
espstlink.c:27:10: fatal error: termios.h: No such file or directory
#include <termios.h>
          ^~~~~~~~~~~
GCC -g -O0 --std=gnu99 --pedantic     -c -o byte_utils.o byte_utils.cco
mpilation terminated.
make.exe": *** [espstlink.o] Error 1
make.exe": *** Waiting for unfinished jobs....
PS C:\Users\admin\Desktop\stm8flash>

It seems that the header termios.h is required and not presented by mingw64. By the way, what is espstink ? A wifi stlink made by ESP8266 ? I use common usb stlink for STM8s. So can I remove this part code directly or how to make it works under Windows?

helmo2004 commented 6 years ago

When a project uses termios.h it seems that the only way to build it under windows is cygwin. I would suggest to use a wrapper for serial port to stay platform-independent. My solution a the moment was to remove espstlink locally, because I don't need it.

Btw: I like the idea of using an esp8266 for flashing STM8-devices. So it would be great if it was available under windows.

Details about espstlink can be found here: https://github.com/rumpeltux/esp-stlink

Greetings Oliver

eeyrw commented 6 years ago

I have truncated the espstlink part and got it work and feel surprise that esp8266 stm8 flasher actually exists : https://github.com/lujji/esp-stm8-flasher.

tenbaht commented 5 years ago

Same problem here. For the Sduino project I need to compile binaries for different systems, including Windows. My solution is to cut out the espstlink code, but using unmodified code would be a far better solution.

I suggest using a simple intermediate cross-platform layer like libserialport or to borrow some code from the stm8gal project.