skip to Main Content

I’m working on a single threaded IOT application in C. Ultimately for an ARM microcontroller, but I have a desktop port. It’s based on LWIP (Based on npcap) for the TCP/IP layer, then on top of that MbedTLS and HTTP.

I’m currently analyzing "hiccups" i.e. the communication is a bit jerky and there seems to be several 100-200ms waiting periods between the server and client communication. A more "traditional" network stacks would handle the entire request within 100ms, but my current implementation takes around a second.

I invested time for a desktop port to 1. prove the hiccups are due to the software stack and 2. have an easier time debugging. The behavior is consistent on ARM hardware and desktop port: both show the same waiting behavior at the exact same points in time.

Because it’s single threaded the communication between the layers is tricky and because networking is involved debugging is tricky as well. As stepping through the functions results in timeouts, and pausing at the right moment didn’t yield any useful findings.

Long story short, I’m looking for a way to analyze what is going on by tracing what function is getting called at what precise time. In other words I’d like to log or visualize stack-trace progression over time. Currently I’m on Windows using Visual Studio. But the project is CMake based and the code is portable C and I could switch to MinGW or Linux GCC.

My google searches all lead to very expensive hardware tracers like J-Trace. Are there any software tools or IDE features to do that on a desktop? Is there a term for that kind of debugging (beside tracing)?

2

Answers


  1. J-Trace is an overkill – it is used to trace more complicated issues ms are eternity for the uC.

    If you have the SDO pin available and your debug probe supports SWO you can simply send short messages via debug port which will show you what function is called.

    There is a tool called tracelyzer which is the tool you need.

    Login or Signup to reply.
  2. You are probably looking for a Flame Graph. One open source project that I’ve used in the past is FlameGraph but there are many others as well.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search