espressif / idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Eclipse Public License 2.0
295 stars 115 forks source link

ESP32-S3 Espressif IDE FreeRTOS task debugging using Eclipse FreeRTOS plugin (IEP-897) #712

Open zikalino opened 1 year ago

zikalino commented 1 year ago

This issue is moved from: https://github.com/espressif/esp-idf/issues/10101

Answers checklist.

General issue report

Hello. I am trying to setup FreeRTOS debugging (monitoring each task stack, priority and etc) via the Eclipse IDE plugin.

I use ESP32-S3 Devkit and I am debugging using built in USB JTAG. I setup the debug configuration as following (selected the right cfg): image

and I can debug the ESP32-S3 without any issues (placing breakpoints and etc...)

I have read about FreeRTOS debuging plugin from the NXP: https://mcuoneclipse.com/2016/07/06/freertos-kernel-awareness-for-eclipse-from-nxp/

I have downloaded this plugin and added it into my view. I have run the debugging session and placed a breakpoint in one of my FreeRTOS tasks. The FreeRTOS task view seemed to work as it loaded some usefull information about currently running tasks.

image

In order to use full potential of this plugin, I should enable GENERATE_RUN_TIME_STATS for my project in the sdkconfig. After doing so, I would expect the FreeRTOS task view to automatically refresh and show live statistics. After enabling this and building project again, It does not seem to work as expected:

When there are no breakpoints placed, the FreeRTOS task view shows nothing. As soon as I place a breakpoint, it fetches data and displays freertos task information. When I remove the breakpoint and run the code again, the data dissapears. I cant seem to understand how can I debug freertos task in real time. For some reason enabling the GENERATE_RUN_TIME_STATS did not work and it still warns me that I need to enable:

image

But you can see from my sdkconfig that it is enabled: image

Did anyone else have similar issues with ESP32 FreeRTOS task debugging? I really hope to get some help regarding this as I feel this is a cool debugging feature and could help me out.

FireDeveloper commented 1 year ago

You can view Runtime stats by applying a patch in task.c as I described in espressif forum While I was trying to figure out how it works I concluded that:

  1. The plugin performs variable reads on pause. That's why you don't have live update, only on pause/bp.
  2. The variable that was responsible for runtime was optimized, so I figured out how to remove optimization from it. As you can see in picture it worked!

Unfortunately, I recently update to 2.9.1 and IDF 5 and now the plugin doesn't work at all (in the same project)... Maybe I missed a setting in sdkconfig or it isn't compatible with newer eclipse, OCD or something (it is from 2016 after all)

Ps. I am very excited that it is considered in Q2 update. I daily use the STM32 variant in CubeIDE