Eclipse配合GDB和jlinkGDBServer仿真调试STM32

时间:2022-07-22
本文章向大家介绍Eclipse配合GDB和jlinkGDBServer仿真调试STM32,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

在Eclipse的IDE环境下,除了可以搭建STM32的编译环境外,还可以配合jlink仿真器实时仿真调试stm32.

Eclipse SDK Version: 3.7.2 Build id: M20120208-0800

首先需要配置下。

在RUN菜单下的debug configration中,找到GDB Hardware Debugging选项,选择新建,若没有这个选项需要下载这个插件, 地址在

CDT Juno http://download.eclipse.org/tools/cdt/releases/indigo

在新建的选项中,可以命名一个名字,如J-link GDB Server

然后配置下如下参数,在startup选项中的,initialization commands中,设下如下内容:

并选择要加载调试的elf文件。

# 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 = STM32F103ZE
# 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

在Run commands下面的编辑框中填入

monitor reg r13 = (0x00000000)
monitor reg pc = (0x00000004)
break ResetHandler
break main
continue

还没有完,还需要配置下jlink的 GDBServer的位置:

在Run菜单的最后一项 Extrnal tools菜单中,选择Extrnal tools configration,

选择program

配置下GDBserver地址

D:Program FilesSEGGERJLinkARM_V408lJLinkGDBServer.exe

arguments: -if SWD

然后再点击Debug就可以仿真调试了。需要注意的是先要启动GdbServer.

附件:截图和Eclipse配合GDBServer仿真STM32流水灯的例子。例子工程在CSDN资源中。

-------------------------------------------------------------------------------------------

成功不是追求别人眼中的最好,而是把自己能做的事情做得最好。

每个人都应该有梦想,这才是生命的意义。

做事情贵在坚持,只有这份坚持,才实践了意义。

处处留心皆学问,爱学习,爱思考。

在这里分享学习,分享感悟,共同进步。

凝聚学习的圈子,思考的圈子。

凝聚学习和思考的圈子。

--------------------------------------------------------------------------------------------