Eclipse GDB“初始化”和“运行”使用 OpenOCD 的 ARM LPC1768 设置?
我终于弄清楚了如何让代码在 这个 LPC1768 迷你板,但是现在我正在尝试进行调试。
我使用的工具链是:Yagarto + Eclipse (Indigo)(带 GDB 硬件调试器)+ OpenOCD。我的 JTAG 接口是:Bus Blaster V2 板。
我找到了一个指南,它介绍了类似的设置,但它适用于不同的 JTAG 接口所以不是很有用。还有这篇文章关于LPC1768 示例,但 gdb 命令不适用于 OpenOCD。
此时,我确定的唯一命令(对于 init)是 target remote localhost:3333
(用于连接到 OpenOCD gdb 服务器)。
我应该在此对话框中使用哪些设置和 gdb 命令?
(忽略“SAM7X256”,只需重新使用上述链接之一的屏幕截图。我使用的是 ARM LPC1768)
另外,我的主板是否使用 辅助引导加载程序(用户代码启动在 0x2000)会影响这些调试设置吗?
更新:采纳 dwelch 的建议,我确实设法让一些基本的 OpenOCD 命令发挥作用(reset init
、mdw
、mww
代码>、<代码>load_image等)。奇怪的“JTAG-DP STICKY”错误与我的 ram 链接器脚本有关,找到了 的项目模板LPC1758 与 RAM链接器脚本,只需修改LPC1768的内存大小和 load_image 效果很好。
我仍然想知道如何正确配置 Eclipse 以进行 GDB 调试。
I finally figured out how to get code running on this LPC1768 mini board, however now I'm trying to get debugging working.
The toolchain I'm using is: Yagarto + Eclipse (Indigo) (w/ GDB Hardware Debugger) + OpenOCD. My JTAG interface is: Bus Blaster V2 board.
I found one guide that walks through a similar setup, but it's for a different JTAG interface so not very useful. There's also this post regarding an LPC1768 example, but the gdb commands aren't for OpenOCD.
At this point the only command I know for sure (for init) is target remote localhost:3333
(for connecting to the OpenOCD gdb server).
What settings and gdb commands should I be using in this dialog?
(Ignore the "SAM7X256", just re-using a screenshot from one of the above links. I'm using an ARM LPC1768)
Also, does the fact my board uses a secondary bootloader (user code starts at 0x2000) affect any of these debug settings?
UPDATE: Taking dwelch's advice, I did manage to get some basic OpenOCD commands to work (reset init
, mdw
, mww
, load_image
, etc). The weird "JTAG-DP STICKY" error was something with my ram linker script, found a project template for the LPC1758 with a RAM linker script, just had to modify the memory sizes for the LPC1768 and load_image worked great.
I'd still like to know how to properly configure eclipse for GDB debugging though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许一次尝试一步。
启动 openocd,可能类似于 -f interface/jlink.cfg -f target/lpc1768.cfg 或其他什么,听起来你已经可以工作了。
第二个 telnet localhost 4444 或任何 Windows 命令行(类似的东西)
在 TELNET 会话中:
以及类似的东西来查看您正在与该部分交谈。
如果你已经编译了一些程序,你可以简单地加载它们并运行它们,例如,如果你制作一个仅 ram 的程序(告诉链接器 .text、.data 等都在 0x10000000),那么
(是的,加 1 使其变得奇数) ,这是一个拇指处理器不会运行ARM指令(lsbit = 0是arm模式lsbit = 1是thumb模式)
重新编译后重新运行:
然后担心闪烁等。 如果基于 RAM 的程序
都不起作用,那么 gdb 只是在此基础上增加了一层复杂性,并且就引导
加载程序而言,答案是这取决于它。你是想从RAM运行还是程序到ROM?如果从RAM运行,你可以接管系统并占用所有RAM,一些芯片(stm32)有一些你可以调用的例程,这些例程需要一些RAM不受影响,但如果你正在接管你可以拥有所有内存的芯片,这是一个告诉链接器和调试器是否从二进制文件中不知道的问题(使用 elf 文件或 ihex 或 srec 或几乎任何不是 .bin 的东西都很好,如果该工具支持它)。
如果您要写入闪存,那么您最好确切地知道闪存的哪个部分可能包含引导加载程序,引导加载程序如何将其传递给您的代码等,并再次告诉链接器和调试器此信息。您可以轻松地擦除/删除引导加载程序,具体取决于它的位置和您正在执行的操作(许多 lpc 和 st 部件都有引导加载程序、串行或 USB,它们在某种程度上可以防止偶然错误,但您通常仍然可以擦除它们,并且如果不小心请更换它们)。
Perhaps try one step at a time.
Start openocd, probably something like -f interface/jlink.cfg -f target/lpc1768.cfg or whatever, sounds like you have that working.
second telnet localhost 4444 or whatever the windows command line is (something similar)
WITHIN THE TELNET SESSION:
and stuff like that to see that you are talking to the part.
if you have already compiled some programs you can simply load them and run them, for example if you make a ram only program (tell the linker .text, .data, etc are all at 0x10000000) then
(yes add 1 to make it odd, this is a thumb processor wont run ARM instructions (lsbit = 0 is arm mode lsbit = 1 is thumb mode).
To re-run after re-compiling:
then worry about flashing, etc after you have ram based programs showing signs of life.
If none of that is working then gdb is just one more level of complexity on top of that and going to make it harder to figure out.
As far as the bootloader goes, the answer is it depends are you trying to run from ram or program to rom. If running from ram you can take over the system and take all the ram, some chips (stm32) have some routines you can call and those require some ram to be untouched, but if you are taking over the chip you can have all the ram, it is a matter of telling the linker and perhaps the debugger if it doesnt know from the binary (using elf files or ihex or srec or pretty much anything that is not a .bin is good, if the tool supports it).
if you are going to write to flash then you had better know exactly what portion of flash might contain a bootloader, what that bootloader does to hand off to your code, etc, and again tell the linker and the debugger this information. you could easily erase/trash the bootloader depending on where it is and what you are doing (a lot of these lpc and st parts have bootloaders, serial or usb, that are somewhat protected from casual mistakes, but you can still usually erase them and replace them if you are not careful).