简体   繁体   English

为什么将cortex-m3重置为gdb中的地址0?

[英]Why would cortex-m3 reset to address 0 in gdb?

I am building a cross-compile toolchain for the Stellaris LM3S8962 cortex-m3 chip. 我正在为Stellaris LM3S8962 cortex-m3芯片构建交叉编译工具链。 The test c++ application I have written will execute for some time then fault. 我编写的测试c ++应用程序将执行一段时间,然后出错。 The fault will occur when I try to access a memory-mapped hardware device. 当我尝试访问内存映射的硬件设备时,将发生错误。 At the moment my working hypothesis is that I am missing some essential chip initialization in my startup sequence. 目前,我的工作假设是我在启动序列中缺少一些必要的芯片初始化。

What I would like to understand is why would the execution in gdb get halted and the program counter be set to 0? 我想了解的是,为什么gdb中的执行将被暂停并且程序计数器设置为0? I have the vector table at 0x0, but the first value is the stack pointer. 我的向量表位于0x0,但第一个值是堆栈指针。 Shouldn't I end up in one of the fault handlers I specify in the vector table? 我不应该最终进入向量表中指定的故障处理程序之一吗?

(gdb) 
187     UARTSend((unsigned char *)secret, 2);
(gdb) cont

Continuing.

lm3s.cpu -- clearing lockup after double fault


Program received signal SIGINT, Interrupt.
0x00000000 in g_pfnVectors ()

(gdb) info registers 
r0             0x1      1
r1             0x32     50
r2             0xffffffff       4294967295
r3             0x0      0
r4             0x74518808       1951500296
r5             0xc24c0551       3259762001
r6             0x42052dac       1107635628
r7             0x20007230       536900144
r8             0xf85444a9       4166272169
r9             0xc450591b       3293600027
r10            0xd8812546       3632342342
r11            0xb8420815       3091335189
r12            0x3      3
sp             0x200071f0       0x200071f0
lr             0xfffffff1       4294967281
pc             0x1      0x1 <g_pfnVectors+1>
fps            0x0      0
cpsr           0x60000023       1610612771

The toolchain is based on gcc, gdb, openocd. 该工具链基于gcc,gdb,openocd。

GDB happily gave you some clue: GDB很高兴为您提供了一些线索:

clearing lockup after double fault 双重故障后清除锁定

Your CPU was in locked state. 您的CPU处于锁定状态。 That means it could not run its "Hard Fault" Interrupt Handler (maybe there is a 0 in its Vector). 这意味着它无法运行其“硬故障”中断处理程序(其向量中可能为0)。

I usually get these when I forgot to "power" the periperial, the resulting Bus Error escalates first to "Hard Fault" and then to locked state. 当我忘记为外围设备“供电”时,通常会得到这些信息,导致的总线错误首先升级为“硬故障”,然后升级为锁定状态。 Should be mentioned in the manual of your MCU, btw. 应当在您的MCU手册中提及,顺便说一句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM