platformio / platform-ststm32

ST STM32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm32
Apache License 2.0
402 stars 312 forks source link

Program received signal SIGSEGV, Segmentation fault in spi_irq_disable #374

Open bcdiaconu opened 4 years ago

bcdiaconu commented 4 years ago

I am using a Windows 10 x64 machine with Black Magic Probe as uplaoder and debugger. When I try to start debuggin it stops with this error.

0x0800371c in throb () at C:\users\bcdia\.platformio\packages\framework-arduinoststm32-maple\STM32F1\cores\maple\libmaple\util.c:133 133 if (i == TOP_CNT) { Loading section .ARM.exidx, size 0x8 lma 0x8007d38 Loading section .data, size 0xe08 lma 0x8007d40 Loading section .rodata, size 0xc80 lma 0x8008b48 Start address 0x8000398, load size 38852 Transfer rate: 17 KB/sec, 903 bytes/write. Temporary breakpoint 1 at 0x8003d8c: file src\MyProgram.cpp, line 39. Warning: the current language does not match this frame. PlatformIO: Initialization completed PlatformIO: Resume the execution to debug_init_break = tbreak setup PlatformIO: More configuration options -> http://bit.ly/pio-debug Note: automatically using hardware breakpoints for read-only addresses.

Program received signal SIGSEGV, Segmentation fault. 0x080016b6 in spi_irq_disable (interrupt_flags=224, dev=0x8000e29 <__exc_memmanage>) at C:\users\bcdia\.platformio\packages\framework-arduinoststm32-maple\STM32F1\system\libmaple\include/libmaple/spi.h:382 382 dev->regs->CR2 &= ~interrupt_flags; Can't send signals to this remote system. SIGSEGV not sent. Cannot execute this command while the target is running. Use the "interrupt" command to stop the target and then try again.

I have attached also the platformio.ini file and launch.json: platformio.ini.txt launch.json.txt

result of pio update image

result of pio upgrade image

bcdiaconu commented 4 years ago

I have also tried entering debug mode with several programs written just for testing the toolchain (PC, OS, platformIO, settings, BMP, stm32f103 etc.) and everything I have tried worked except for when using sd card which uses spi library.

I even tested with a program that I have wrote to test interrupts. I have used attachinterrupt() function and it works without a isssue. It goes to debug and breaks everywhere I put the breakpoint; even into the interrupt handler function without issue.

So the problem seems to comes from SPI library.