cancel
Showing results for 
Search instead for 
Did you mean: 

RTOS proxy does not properly start when trying to debug with hot-attachement

NSAUG.1
Associate III

Hello,

 

In my STM32WBA65 project using FreeRTOS, I tried to create a hot-attach debug configuration.

It works OK except for one problem : the RTOS proxy does not know what it is working on, as it seems to rely on the parameter imageFileName in imagesAndSymbols. Since replacing imageFileName with symbolFileName is necessary to get a hot-attach configuration (along with "serverReset": "None"), this is a problem.

 

The problem seems to be that imageFileName has two roles : 1) providing the binary used by the RTOS Proxy and by the loading mechanism and 2) telling the system that we want to load said binary into the target.

 

Is there a way to hot-attach the debugger with RTOS awareness that I missed ? 

 

Below, my launch configuration in launch.json:

{
      "type": "stlinkgdbtarget",
      "request": "launch",
      "name": "Hot Attach",
      "origin": "snippet",
      "cwd": "${workspaceFolder}",
      "serverReset": "None",
      "imagesAndSymbols": [
        {
          "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
        }
      ],
      "serverRtos": {
        "enabled": true,
        "port": "60000",
        "driver": "freertos",
        "driverPort": "ARM_CM33_NTZ" // if not properly set, will result in "Truncated register 0 in remote 'g' packet" error and no RTOS awareness
      },
      "liveWatch": {
        "enabled": true,
        "samplesPerSecond": "4"
      },
    }

 

And the output when I try to run the hot-attach debug configuration :

From Debug Session: step debug conf validation: No image file loaded, see imagesAndSymbols attribute in the debug configuration.

STMicroelectronics ST-LINK GDB server. Version 7.12.0
Copyright (c) 2025, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Waiting for debugger connection...
RTOS proxy: STMicroelectronics RTOS Proxy. Version 0.17.0
Copyright (c) 2025, STMicroelectronics. All rights reserved.

RTOS Proxy: readelf: Error: RTOS Proxy: 'undefined': No such file
RTOS proxy: Failed generate debug info
RTOS proxy: Loading RTOS driver... RTOS proxy: FreeRTOS
RTOS proxy: Connecting to GDB server 127.0.0.1 on port 61234 ... RTOS proxy: Connected
Listen for GDB connection on port: 60000 ... Debugger connected
Waiting for debugger connection...
GNU gdb (GNU Tools for STM32 14.3.rel1.20251027-0700) 15.2.90.20241229-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=aarch64-apple-darwin --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
add-symbol-file "/Users/nicolassaugnier/repos/firmware/projects/build/Debug/fw_v1.elf"
add symbol table from file "/Users/nicolassaugnier/repos/firmware/projects/build/Debug/fw_v1.elf"
(y or n) [answered Y; input not from terminal]
Reading symbols from /Users/nicolassaugnier/repos/firmware/projects/build/Debug/fw_v1.elf...
RTOS proxy: Connected
prvIdleTask (pvParameters=<optimized out>) at /Users/nicolassaugnier/repos/firmware/projects/Middlewares/Third_Party/FreeRTOS/Source/tasks.c:5850
5850	            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) configNUMBER_OF_CORES )
connected to remote target localhost:60000
set *(int *)0xE000ED14=*(int *)0xE000ED14|0x10
set *(int *)0xE000EDFC=*(int *)0xE000EDFC|0xff0
Debugger connected
Waiting for debugger connection...
connected to remote target localhost:61234
Note: automatically using hardware breakpoints for read-only addresses.
monitor rtos -m state
RTOS proxy: Unknown data structure layoutxLIST
{"label":"","value":[{"label":"Driver","value":"freeRTOS"},{"label":"Kernel state","value":"Started"},{"label":"Software timers","value":""}]}

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Florent V
ST Employee

Hi @NSAUG.1,

Your reasoning is correct. The imageFileName has two roles when using the serverRtos attribute, which can be annoying for hot attach.
While waiting for a better solution, the serverRtos also uses the program attribute if imageFileName is not available (I will create an internal ticket to make this automatic).
So, in your debug configuration, you need the following combination:

            "program": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}",
            "imagesAndSymbols": [
                {
                    "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
                }
            ],

 

Kind Regards,
/Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Florent V
ST Employee

Hi @NSAUG.1,

Your reasoning is correct. The imageFileName has two roles when using the serverRtos attribute, which can be annoying for hot attach.
While waiting for a better solution, the serverRtos also uses the program attribute if imageFileName is not available (I will create an internal ticket to make this automatic).
So, in your debug configuration, you need the following combination:

            "program": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}",
            "imagesAndSymbols": [
                {
                    "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
                }
            ],

 

Kind Regards,
/Flo

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
NSAUG.1
Associate III

Thank you for the fast response, it seems to start the debugging session in a hot-attach way with the proper info available to the RTOS proxy as expected (I can see the tasks, queues, etc when I pause execution, as expected).

However I'm having other very strange behaviour while debugging now, the connection to STLink and the target crashing when I stop the debugging session, but I will investigate and either report here or create another thread depending on if it has something to do with this option or not.
(EDIT: it's not related to this option, but to liveWatch, I'll make another post)

 

In the meantime, here is the minimal consolidated configuration (in .vscode/launch.json ) that allows hot-attaching the RTOS-aware debugger to my STM32WBA65 & FreeRTOS project (without TrustZone) with "STM32cubeIDE for VScode":

{
      "type": "stlinkgdbtarget",
      "request": "launch",
      "name": "Hot Attach",
      "origin": "snippet",
      "cwd": "${workspaceFolder}",
      "serverReset": "None",
      "program": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}",
      "imagesAndSymbols": [
        {
          "symbolFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
        }
      ],
      "serverRtos": {
        "enabled": true,
        "port": "60000",
        "driver": "freertos",
        "driverPort": "ARM_CM33_NTZ" 
      }
    }