STM32duino / FreeRTOS problems

I got this error too which I found strange. I’m looking into whether PlatformIO’s GCC 12 version differs from from the GCC 12 version or configuration that STM32Duino is using. PlatformIO’s toolchain version is using NewLib 5. STM32FreeRTOS throws this warning beyond 3.3.

I’ll update the issue I created earlier

as needed then too.

Very brave of you to try an RTOS on 8K of RAM. It should be close to its memory limit.

With 8K RAM, I would try to avoid multi threading and use state machines instead. State machines can be written to be simple and highly readable, with a setup() and loop() per module.

Just saying. :wink:

1 Like

@maxgerhardt , any idea why the debugger might be failing after compiler upgrade ?

@zapta , agreed. 20k chips are on the way, out of interest do you have a link to an example of simple/readable state machine ? I’ve got 3 sensors, 2 buttons, 3 LEDs, two serial ports to coordinate.

Thanks both !

The debugger failing is definitely not a good thing – could not reproduce that yet. Can you do:

CLI

pio debug --interface=gdb -- -x .pioinit

and post the output?

It could be that something fails with VSCode and the GDB 12 version that is now being used thanks to the toolchain upgrade… In which case the old arm-none-eabi-gdb.exe would have to be used or the root problem be fixed… but let’s just look at the output first.

Irregardless of how challenging is run FreeRTOS on 8K of RAM and a full application firmware, this is still an important that we find these toolchain issues, as they effect the other targets also, and not insignifcantly so.

$ Projects/CAG2 $ pio debug --interface=gdb -- -x .pioinit
Reading symbols from /Users/cagri/Documents/PlatformIO/Projects/CAG2/.pio/build/genericSTM32L052K6/firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:
Remote connection closed
$ Projects/CAG2 $

When you press the upload debug button regularly, does it show anything more in the “DEBUG CONSOLE” tab in VSCode?

Upload button no, start debugging button tries to debug and gives the same error. Maybe I got you wrong.

1 Like

@cagz, I forked that discussion here Multi tasking with no RTOS and multi threading . Please let me know if you have any questions.

@maxgerhardt , confirmed that the debug issue only occurs when I use the more recent compiler, if I go back it gets fixed (but the crazy memory allocations).

Tried to click debug button repeatedly, it starts debug process and ends up giving following output on the debug console.


Reading symbols from /Users/cagri/Documents/PlatformIO/Projects/CAG2/.pio/build/genericSTM32L052K6/firmware.elf...
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:
Remote connection closed
1 Like

Hi @cagz,

There is indeed problem with toolchain packages v12, but it seems that only Windows is affected. Besides your error message is quite different:

Remote connection closed

It seems OpenOCD simply failed to start. Could you please try to launch it in a separate window? I believe you can use the following command:

"/Users/cagri/.platformio/packages/tool-openocd/bin/openocd.exe" -f "/Users/cagri/.platformio/packages/tool-openocd/openocd/scripts/interface/stlink.cfg" -f "/Users/cagri/.platformio/packages/tool-openocd/openocd/scripts/target/stm32l0.cfg"

Thank you @valeros , I am on Mac if this helps.

When I run it separately I get the following. I am guessing you asked me to run this to check, otherwise I cannot deploy from platformio while OCD is running in the terminal.

xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-17:05)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 300 kHz
Info : STLINK V2J42S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.097764
Info : [stm32l0.cpu] Cortex-M0+ r0p1 processor detected
Info : [stm32l0.cpu] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32l0.cpu on 3333
Info : Listening on port 3333 for gdb connections

OK, so OpenOCD started without errors. Just to make sure everything is compatible, please keep OpenOCD in background, add a new the line debug_tool = custom to your platformio.ini and start a new debug session in the IDE.

Hi @valeros , it works with custom debug_tool and I can debug my code.