【发布时间】:2012-03-26 16:50:17
【问题描述】:
我在 SCB 论坛上问过这个问题,但没有得到答案 我正在尝试将一些项目从 uVision ide 移植到 SCB。 问题始于向量表的实现。例如,我有简单的 C++ 代码
#define STACK_TOP 0x20000800
typedef void (*handler_ptr)();
void ResetHandler() { while (1); }
void NMIHandler() { while (1); }
void HardFaultHandler() { while (1); }
__attribute__ ((section("vectors"))) handler_ptr const vector_table[] = {
(handler_ptr) STACK_TOP,
ResetHandler,
NMIHandler,
HardFaultHandler,
};
此代码无法编译,因为 SCB 库正在寻找“int main(void)”声明。 好的,我可以添加这个函数,但是 SCB 会忽略我的向量表实现并使用自己的(如果我调用 VT 中的地址的函数,我会看到 SCB 虚拟处理程序)。
我如何重写我的 SCB VT 实现? 请不要使用特殊的 SC3 函数名称(用 2 个 IDE 支持不好)或将向量表移动到另一个内存位置。
__attribute__ ((section(".isr_vector"))) void (* const g_pfnVectors[])(void)
来自 Luminary Micro 的“startup_gcc.c - 与 GNU 工具一起使用的启动代码”也没有效果
谢谢。
【问题讨论】: