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

Unable to start debug session #57

Open ViggoAvatar opened 2 years ago

ViggoAvatar commented 2 years ago

Hello all, I'm having issues with starting a debug session on the STM8S003F3

Output from the debug terminal: Compiling .pio/build/stm8s003f3/FrameworkArduino/weak_atexit.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/weak_initVariant.c.rel /home/tom/.platformio/packages/framework-arduinoststm8/cores/sduino/weak_atexit.c:13: warning 85: in function atexit unreferenced function argument : 'func' /home/tom/.platformio/packages/framework-arduinoststm8/cores/sduino/WInterrupts.c:73: warning 85: in function attachInterrupt unreferenced function argument : 'mode' Compiling .pio/build/stm8s003f3/FrameworkArduino/weak_serialEvent.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-alternate-function.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-delay-microseconds.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-delay.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-init.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-micros.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring-millis.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring_analog.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring_digital-tables.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring_digital.c-1.c.rel Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring_digital.c-2.c.rel Segmentation fault (core dumped) Compiling .pio/build/stm8s003f3/FrameworkArduino/wiring_digital.c-3.c.rel *** [.pio/build/stm8s003f3/FrameworkArduino/WInterrupts.c.rel] Error 1 ========================== [FAILED] Took 1.48 seconds ==========================

This is after trying on linux, the same issue arose on winows without the segfault.

platform.ini is basic: [env:stm8s003f3] platform = ststm8 board = stm8s003f3 framework = arduino

and application even more so (main.c):

include

void setup() { // put your setup code here, to run once: pinMode(PA1, OUTPUT); }

void loop() { // put your main code here, to run repeatedly: digitalWrite(PA1, 1); delay(100); digitalWrite(PA1, 0); delay(100); }

any help would be much appreciated

gicking commented 2 years ago

To get STM8 debugging via STLink to work under Ubuntu 22.04, I had to perform the below 2 steps:

  1. install missing libpython2.7.so.1.0 --> sudo apt-get install libpython2.7
  2. create symbolic link for libmpfr.so.4 --> sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4

I found the hints here and here. Good luck!

reimerp commented 1 year ago

Same issue here, but its not related to starting a debug seesion, but to compile in debug mode. To actual start stm8-gdb above two actions are required unless stm8-gdb won't start, but the coredump is when "--debug" is issued. I am currently not sure if this is related to sduino lib / sdcc or some memory issues. I can compile WInterrupts.c manually without --debug. but with debug the core dumps.

[...]
+ /.platformio/packages/toolchain-sdcc/bin/sdasstm8 -plosgffwy ".pio/build/arduino/FrameworkArduino/WInterrupts.c.asm"
Segmentation fault (core dumped)
+ /.platformio/packages/toolchain-sdcc/bin/sdasstm8 -plosgffwy ".pio/build/arduino/FrameworkArduino/WInterrupts.c.asm" returned errorcode 35584