关键字:paparazzi gdb eclipse jlink lisa-m
环境:win7 + ubuntu10(虚拟机)
时隔一年,从mwc转到paparazzi,要crack代码,搭建个方便的调试环境是必要的,官网上有介绍直接使用gdb进行调试,但是命令行方式的确不方便。
由于原来有在linux下调试uboot的经验,所以还是搭建个窗口调试环境。前期方案如下:
前端使用insight或eclipse 调用gdb, 用gdb连接windows下或者linux下的jlink的gdbserver。
1.使用insight(放弃方案)
安装insight之后,出现问题
这是因为paparazzi默认编译器arm-none-eabi-gcc版本为4.8.3,会默认生成dwarf4格式的调试信息,配套gdb版本为GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20131129-cvs,而insight 6.8使用的gdb版本是6.8,所以出现无法识别调试信息的问题。
国外网站相关的信息
gcc-4.6.x has started using -gdwarf4 by default, and the embedded gdb-7.0 version within crash doesn't support it. It will require an upgrade of the embedded gdb.
我修改了./conf/Makefile.stm32文件的45行 #DEBUG = dwarf-2 去掉注释,但是不知道为什么,无果。最后放弃了这种调试方案。
2.使用eclipse(最后采用方案)
最初没有使用这个,觉得eclipse稍大,安装麻烦,其实经过一次安装之后,也没觉得太复杂。最重要的是,功能强大,使用起来舒服。
安装步骤如下:
找这个 Eclipse IDE for C/C++ Developers, 171 MB
file->new->project
next
next
在这里填写交叉编译器前缀及路径。前提是你已经装好了这个编译器。 然后finish
选择刚刚建立的工程,点击 Run->Debug Configurations... 双击左侧 Zylin Embedded debug (Native)
在c/c++ Application中 填入ppz编译生成的elf文件。我的是/usr/local/paparazzi/var/aircrafts/Microjet_LisaM/ap/ap.elf
在Debugger选项卡中的 GDB-debugger 中 填入 arm-none-eabi-gdb
在Commands选项卡中 ‘Initialize’ commands 中填入
# connect to the J-Link gdb server
target remote 192.168.63.6:2331
# Select flash device
monitor flash device = STM32F103RC
# Enable FlashDL and FlashBPs
monitor flash download = 1
monitor flash breakpoints = 1
# Clear all pendig breakpoints
monitor clrbp
monitor endian little
monitor reset
load
monitor reg r13 = 0x2000c000
break main
continue
其中 target remote 192.168.63.6:2331 是windows的地址 2331 是jlink gdbserver的端口号
我用的器件是STM32F103RC
monitor reg r13 = 0x2000c000 设置堆栈指针, c000对应STM32F103RC 的 48K ram, 否则默认的是0x00000000,运行的时候会出错。 关于ppz堆栈的指针这个问题还没搞清楚 to be continued。
然后点击右下角的 Debug 就可以运行了。
windows下jlink的使用就不赘述了,给个截图:我自己做的类ppz的板子,swd接口的。标准ppz是jtag接口。