【发布时间】:2025-12-13 21:05:01
【问题描述】:
目前,我正在调试 STM32F4 MCU(Nucleo 板),现在我的任务是了解在执行流程中以一种或另一种方式调用的所有函数。当然,使用 OpenOCD 和 GDB,我已经可以在目标暂停时看到回溯,但实际上,它不能反映固件运行的完整历史记录。此外,就 C 调用堆栈而言,我认为有些硬件 ISR 没有“父级”。
简化示例。假设我们有这样的来源:
#include "math.h"
ISR tick_10ms() {
asm("nope");
}
void foo(double x) {
double y = sin(x);
}
int bar(int a, int b, int c) {
foo((double)(a-b+c));
return 0;
}
void main() {
foo(3.14);
int z = bar(1, 2, 3);
while (1) {}
}
当我们用它对 MCU 进行编程时,我希望看到类似的东西(实时或暂停 - 没关系):
main()
foo(3.14)
sin(3.14)
bar(1, 2, 3)
foo(2.0)
sin(2.0)
tick_10ms()
tick_10ms()
tick_10ms()
...
那么有没有可能以任何方式(或至少类似)?
【问题讨论】:
标签: debugging gdb stm32f4 openocd