platformio / platform-ststm8

ST STM8: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm8
Apache License 2.0
41 stars 26 forks source link

ststm8 1.0.3: stm8gal fails to init port stlinkv2 #30

Closed paulo-fernando-silva closed 3 years ago

paulo-fernando-silva commented 3 years ago

Hi, After the update of platformio core to 5.1.0 I ran into this issue: https://github.com/platformio/platformio-core/issues/3829 Which was a duplicated of this issue: https://github.com/platformio/platform-ststm8/issues/27 I also tried the update and it seems to fix the build, but now it won't flash the device properly anymore. Here's the offending command (pio load command):

> stm8gal -p stlinkv2 -R 1 -u 2 -V 2 -v -B -w .pio/build/stm8sblue/firmware.ihx

stm8gal (v1.2.0 beta)
  load Intel hex file 'firmware.ihx' ... ok (576B)
  reset STM8 now
  open serial port 'stlinkv2' with 115.2kBaud ... 

error in 'init_port(stlinkv2)': open port failed, exit!

I'm not sure how it was working before core 5.1.0, but it was working. I tried the following command which does work:

> stm8flash -c stlinkv2 -p stm8s003f3 -w .pio/build/stm8sblue/firmware.ihx
Determine FLASH area
Due to its file extension (or lack thereof), ".pio/build/stm8sblue/firmware.ihx" is considered as INTEL HEX format!
576 bytes at 0x8000... OK
Bytes written: 576

Is pio using the wrong command? Am I doing something wrong? Right now I can use that command directly on the command line. But it would be nice if I could configure pio to use that instead or use whatever it was doing before.

Thanks

paulo-fernando-silva commented 3 years ago

Ah, ok. It seems I had upload_port = stlinkv2 and the correct is upload_protocol = stlinkv2. Not sure how that was working before. I might have broken it myself. 😅