windows下如何通过jlink调试eCos

本文详细介绍了在cygwin环境下,如何使用J-Link GDB Server进行ecos程序的调试,包括配置脚本、编译ecos为ROM启动代码、连接GDB Server、下载程序及标准gdb调试流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

接续上一篇关于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的结果

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值