This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TMS570LC4357:在早期初始化代码中使用调试器

Guru**** 2200880 points
Other Parts Discussed in Thread: HALCOGEN
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1385580/tms570lc4357-using-debugger-in-early-init-code

器件型号:TMS570LC4357
主题中讨论的其他器件:HALCOGEN

工具与软件:

您好!

我将 TMS570LC43 Launchpad 与内置的 XDS110调试器和(使用 CCS 调试.elf)配合使用。 我在早期的初始化代码中无法使用调试器。 它不是由 halcogen 生成的、但它非常相似。

例如、以下是开头部分:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ldr pc, =z_arm_reset /* offset 0 */
ldr pc, =z_arm_undef_instruction /* undef instruction offset 4 */
ldr pc, =z_arm_svc /* svc offset 8 */
ldr pc, =z_arm_prefetch_abort /* prefetch abort offset 0xc */
ldr pc, =z_arm_data_abort /* data abort offset 0x10 */
...
...
...
z_arm_reset:
mov r0, #0
mov r1, #0
mov r2, #0
mov r3, #0
mov r4, #0
mov r5, #0
mov r6, #0
mov r7, #0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

在上面的代码中、我将单步执行汇编、一切看起来都正常、直到我到达"cps #mode_abt"、此时我似乎跳转到了异常向量、偏移量= 0x04、因此看起来像是未定义指令异常、尽管它不是未定义的指令。

如果在此时查看 DFSR 和 IFSR、会看到以下情况:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
IFSR = 0x00000000
IFAR = 0x00000000
DFSR = 0x00000001
DFAR = 0x18F09FE5
It seems like DFSR was already set to 1 even before reaching this address. Also, the value in DFAR seems to be the memory contents of the first few dwords in the code, the vector table:
0000 18f09fe5 18f09fe5 18f09fe5 18f09fe5 ................
0010 18f09fe5 00f020e3 14f09fe5 14f09fe5 ...... .........
0020 00000148 00000098 000002e8 000000dc ...H............
0030 0000010c 00001429 0000007d .......)...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

在调试模式下使用 CSP 指令没有任何限制。 我在尝试单步执行此代码时是否遗漏了一些内容、是否无法在早期初始化期间使用调试器?

(这个同样的问题有更多的变体、但这也许更容易讨论、因为它基本上与 halcogen 生成的汇编指令相同)