c++ - 如何在没有 native 文件系统的情况下使用 gcc 检测选项

标签 c++ gcc arm instrumentation cortex-m

许多 instrumentation options for gcc在运行期间/之后将数据保存到文件:

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

但是,我在基于 C++ 的自定义 RTOS 上运行,它没有像 Linux 这样的“本地”文件系统。

问题

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

最佳答案

网络搜索“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 等模拟器也支持它。

关于c++ - 如何在没有 native 文件系统的情况下使用 gcc 检测选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53747484/

相关文章:

c++ - 将库链接到 visual studio 2015 中的 android ndk 应用程序

c++ - 在 C++ 中调用 ASM 函数

c++ - MSVC 相当于 __attribute__ ((warn_unused_result))?

c++ - x86_64 和 ARM 上的原子 CAS 操作是否始终使用 std::memory_order_seq_cst?

android - C++ 隐式参数 : this and the returned object, 的顺序哪个先出现?

memory - 什么是ARM TCM内存

c++ - windows下如何检测文件是否被其他进程打开

c++ - 在 Visual Studio 2008 下出现 long long int 编译器错误的原因是什么?

c - 带有可变长度数组的奇怪输出?

c - 从 C 语言转换为汇编语言时,以 null 结尾的字符串在哪里?