如何在没有本机文件系统的情况下使用 gcc 检测选项

how to use gcc instrumentation options without a native filesystem

很多instrumentation options for gcc保存数据到文件during/after运行时:

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

但是,我 运行 使用基于 C++ 的自定义 RTOS,它没有像 Linux.

这样的文件系统 "natively"

问题

如何使用这些 gcc-instrumentation 选项将结果输出到文件?
我是否必须提供一个文件编写器接口——在我的例子中,它会写入一个 RAM 缓冲区——只要检测代码需要 "write to file"?

,它就会被调用

网络搜索 "gcc gprof arm-cortex-m" 产生:https://mcuoneclipse.com/2015/08/23/tutorial-using-gnu-profiling-gprof-with-arm-cortex-m/

似乎使用 semihosting 将分析数据写入主机。

半主机是 ARM 与主机上的调试器通信的常用方式(通过 JTAG/SWD)。 qemu 等模拟器也支持它。