您的位置:首页 > 其它

windows下如何通过jlink调试eCos

2011-10-25 09:47 211 查看
接续上一篇关于cygwin下用串口连接redboot调试eCos的方法,这里介绍一下如何用jlink gdb server调试ecos。

(本文原创,转载请注明出处http://blog.csdn.net/rickleaf

1、首先我们需要稍微浏览一下jlink的gdb server的英文手册



通过上图,我们可以看到J-Link的GDB server是兼容标准的GDB Server的,它通过对gdb调试器的启动脚本.gdbinit的配置

实现JTAG对硬件的初始化。还是针对STM32平台,参考手册我们可以

2、简单的写如下脚本

# connect to the J-Link gdb server
target remote localhost:2331

# Enable flash download and flash breakpoints.
# Flash download and flash breakpoints are features of
# the J-Link software which require separate licenses
# from SEGGER.

# Select flash device
monitor flash device = STM32F103ZG

# Enable FlashDL and FlashBPs
monitor flash download = 1
monitor flash breakpoints = 1

# Clear all pendig breakpoints
monitor clrbp

# Set gdb server to little endian
monitor endian little

# Set JTAG speed to 5 kHz
monitor speed 5

# Reset the target
monitor reset
monitor sleep 100

# Set JTAG speed in khz
monitor speed auto

# Vector table placed in Flash
monitor writeu32 0xE000ED08 = 0x00000000


这个脚本指明了cpu内部flash的类型,以及如何放置vector table等信息

另外Jlink的调试端口虚拟成本地网络的2331,也就是说如果脚本没有target remote localhost:2331

也可以直接在gdb的命令行执行。

3、接下来我们需要直接把eCos编译成rom方式启动的代码



再参考本博客的其他文章编译好ecos的测试程序

4、连接GDB SERVER

现在我们启动Jlink的gdb server,如果检测硬件没有问题可以看到等待gdb连接的提示



执行arm-eabi-gdb twothread, 可以看到正常连接



5、通过load,把程序下载到cpu上



6、接下来就可以按照标准的gdb 去调试了

比如设置cyg_user_start为断点, b cyg_user_start



打开串口软件看twothread的结果

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: