搭建 paparazzi uav 调试环境 ppz

来源:互联网 发布:卷皮网源码7.0 编辑:程序博客网 时间:2024/04/28 00:32

关键字: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,所以出现无法识别调试信息的问题。

国外网站相关的信息

It's because
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.   
To avoid this problem, as you have discovered, you have to make sure that your entire software development toolchain (compiler, linker, debugger) is able to "speak" the same DWARF version. Your solution of compiling the latest version of gdb is correct.


我修改了./conf/Makefile.stm32文件的45行  #DEBUG = dwarf-2  去掉注释,但是不知道为什么,无果。最后放弃了这种调试方案。

2.使用eclipse(最后采用方案)

最初没有使用这个,觉得eclipse稍大,安装麻烦,其实经过一次安装之后,也没觉得太复杂。最重要的是,功能强大,使用起来舒服。

安装步骤如下:

JRE 安装
----------------------------------------------------------------------------------------------------------------------
apt-get install default-jre   不推荐使用,这个默认的jvm版本是1.6.0_31,  but version 1.7 or greater is required by eclipse-standard-luna-R-linux-gtk.tar.gz 

卸载之后 重新安装下载的最新的 参考以下链接
http://www.jb51.net/LINUXjishu/117147.html  我下的是jre-8u5-linux-i586.tar.gz
http://www.oracle.com/technetwork/java/javase/downloads/index.html
然后安装
http://blog.csdn.net/tianguokaka/article/details/16961471 
http://blog.csdn.net/zgrjkflmkyc/article/details/9263119 
http://www.cnblogs.com/heyonggang/archive/2013/10/13/3366996.html  

eclipse 安装
----------------------------------------------------------------------------------------------------------------------
在 http://www.eclipse.org/downloads/?osType=linux&release=undefined   下载eclipse

找这个 Eclipse IDE for C/C++ Developers, 171 MB

我下的是eclipse-cpp-luna-R-linux-gtk.tar  这个cpp版本的是包含cdt的,不需另外安装。
然后 tar -zxvf eclipse-standard-luna-R-linux-gtk.tar.gz  

zylin 安装
----------------------------------------------------------------------------------------------------------------------
下载 zylin 插件,在 eclipse 的 Help --> Install New Software 中 添加地址 http://opensource.zylin.com/zylincdt/ 就可以了。 按照提示安装之后 debug --> debug configuration 中可以看到 zylin 了
http://blog.csdn.net/etual/article/details/8238572 

使用方法
----------------------------------------------------------------------------------------------------------------------
直接在eclipse文件夹下执行 ./eclipse 启动eclipse。

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 servertarget remote 192.168.63.6:2331# Select flash devicemonitor flash device = STM32F103RC# Enable FlashDL and FlashBPsmonitor flash download = 1monitor flash breakpoints = 1# Clear all pendig breakpointsmonitor clrbpmonitor endian littlemonitor resetloadmonitor reg r13 = 0x2000c000break maincontinue

其中 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接口。






0 0
原创粉丝点击