安裝相關的編譯工具:html
sudo apt-get install build-essential gcc-arm-linux-gnueabi
這裏我使用的是ubuntu系統源中含有的gcc-arm-linux-gnueabi系列工具,安裝完成後具備以下工具:linux
arm-linux-gnueabi-addr2line arm-linux-gnueabi-gcc arm-linux-gnueabi-gprof arm-linux-gnueabi-ranlib arm-linux-gnueabi-ar arm-linux-gnueabi-gcc-4.7 arm-linux-gnueabi-ld arm-linux-gnueabi-readelf arm-linux-gnueabi-as arm-linux-gnueabi-gcc-ar-4.7 arm-linux-gnueabi-ld.bfd arm-linux-gnueabi-size arm-linux-gnueabi-c++filt arm-linux-gnueabi-gcc-nm-4.7 arm-linux-gnueabi-ld.gold arm-linux-gnueabi-strings arm-linux-gnueabi-cpp arm-linux-gnueabi-gcc-ranlib-4.7 arm-linux-gnueabi-nm arm-linux-gnueabi-strip arm-linux-gnueabi-cpp-4.7 arm-linux-gnueabi-gcov arm-linux-gnueabi-objcopy arm-linux-gnueabi-elfedit arm-linux-gnueabi-gcov-4.7 arm-linux-gnueabi-objdump
注意在使用make進行編譯源碼的時候,設置CROSS_COMPILE參數爲: arm-linux-gnueabi-c++
make CROSS_COMPILE=arm-linux-gnueabi-
因爲ubuntu下沒有編譯好的針對arm平臺的gdb,故能夠去官網下載: http://ftp.gnu.org/gnu/gdb/ , 能夠先經過gdb -v 查看系統合適的版本;redis
$gdb -v GNU gdb (GDB) 7.5-ubuntu Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. $wget http://ftp.gnu.org/gnu/gdb/gdb-7.5.tar.bz2
編譯和安裝gdb,注意設置目標平臺爲arm-linux, 另外注意下面紅色參數:「--program-prefix=arm-linux-」,該參數使安裝後的程序名字爲arm-linux-gdb, 防止與系統已經安裝的gdb重名;ubuntu
$tar xjf gdb-7.5.tar.bz2 $cd gdb-7.5/ $./configure --target=arm-linux --program-prefix=arm-linux- $sudo make install
後續能夠直接經過命令行 arm-linux-gdb來調用該調試器;工具
可使用JLINK上的序列號進行下載,網址以下:ui
http://www.segger.com/cms/jlink-software.htmlspa
http://www.segger.com/cms/jlink-software.html?step=2&file=JLinkLinux_450i命令行
解壓後,鏈接好開發板,運行Jlink目錄中的start腳本或者JLinkExe程序,就能夠看到鏈接成功的消息:調試
usb爲jlink支持的命令,表示從usb鏈接,更多命令能夠經過輸入 ? 得到。
J-Link>usb Connecting to J-Link via USB (Port: 0) Updating firmware: J-Link ARM V8 compiled Jun 19 2012 11:29:30 Replacing firmware: J-Link ARM V8 compiled Jan 31 2011 18:34:52 Waiting for new firmware to boot New firmware booted successfully DLL version V4.50i, compiled Jun 22 2012 19:00:36 Firmware: J-Link ARM V8 compiled Jun 19 2012 11:29:30 Hardware: V8.00 S/N: 17892859 Feature(s): RDI,FlashDL,FlashBP,JFlash VTarget = 0.000V J-Link>