Search code examples
c++gccarminstrumentationcortex-m

how to use gcc instrumentation options without a native filesystem


Many of the instrumentation options for gcc save data to a file during/after runtime:

When the compiled program exits it saves this data to a file called auxname.gcda for each source file.

However, I'm running on a custom C++-based RTOS which doesn't have a filesystem "natively" like Linux.

QUESTION

How do I use these gcc-instrumentation options that output results to a file?
Do I have to provide a file-writer interface - which in my case would write to a RAM buffer - which would be called whenever the instrumentation code needs to "write to file"?


Solution

  • A web search for "gcc gprof arm-cortex-m" produces: https://mcuoneclipse.com/2015/08/23/tutorial-using-gnu-profiling-gprof-with-arm-cortex-m/

    It appears to use semihosting to write profiling data to host machine.

    Semihosting is a common way for ARM to communicate with debugger on host (through JTAG/SWD). It is also supported on emulators like qemu.