OpenOCD compile on Windows

OpenOCD compile on Windows

  • About Open On-Chip Debugger

The Open On-Chip Debugger (openocd) aims to provide debugging, in-system programming and boundary-scan testing for embedded target devices. The targets are interfaced using JTAG (IEEE 1149.1) compliant hardware, but this may be extended to other connection types in the future.

Openocd currently supports Wiggler (clones), FTDI FT2232 based JTAG interfaces, the Amontec JTAG Accelerator, and the Gateworks GW1602. It allows ARM7 (ARM7TDMI and ARM720t), ARM9 (ARM920t, ARM922t, ARM926ej-s, ARM966e-s), XScale (PXA27x,PXA25x, IXP42x) and Cortex-M3 (Luminary Stellaris LM3 and ST STM32) based cores to be debugged.

Flash writing is supported for external CFI compatible flashes (Intel and AMD/Spansion command set) and several internal flashes (LPC2000, AT91SAM7, STR7x, STR9x, LM3 and STM32x). Preliminary support for using the LPC3180's NAND flash controller is included.

This OpenFacts entry will try to document openocd's current state, and provide general information about the technology involved.


  1. 安装cygwin
必须安装的组件包括: gcc, autoconf, automake, M4, perl

  1. 下载openocd源代码
The OpenOCD Wiki entries always document the latest version of OpenOCD. You can download the current SVN version with SVN client of your choice from the following repositories:
 svn://svn.berlios.de/openocd/trunk
or
http://svn.berlios.de/svnroot/repos/openocd/trunk
Using the SVN command line client, you could use the following command to fetch the latest version (make sure there is no (non-svn) directory called "openocd" in the current directory):svn checkout svn://svn.berlios.de/openocd/trunk

  1. 编译openocd

  • ./bootstrap
Bootstrap generates the configure script, and prepares building on your system.

  • ./configure --enable-parport --enable-parport_giveio
Configure generates the Makefiles used to build OpenOCD.

  • make
Make builds the OpenOCD, and places the final executable in ./src/

  1. 可能出现的编译错误及解决办法:
  • 编译parport.c时出错:
parport.c:65:20: sys/io.h: No such file or directory
解决办法:在parport.c中定义宏_WIN32,注意不能在config.h中定义这个宏,否则在编译其他模块代码时会出错。

  • -DPKGLIBDIR 错误:
        src/target src/flash
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/helper -I../../src/jtag -I../../src/target  -DPKGLIBDIR=/"/usr/local/lib/openocd/
"    -g -O2 -MT flash.o -MD -MP -MF .deps/flash.Tpo -c -o flash.o flash.c
gcc: no input files
解决办法:由于gcc不识别DPKGLIBDIR造成,更改DPKGLIBDIR即可。

  • OPENOCD_VERSION宏的错误
gcc -DHAVE_CONFIG_H -I. -I.. -I../src/helper -I../src/jtag -I../src/target -I../src/xsvf -I../src/server -I../src/flash -I../
src/pld  -DPKGLIBDIR=/"/usr/local/lib/openocd/" -DPKGBLDDATE=/"`date +%F-%R`/" -DPKGBLDREV=/"`../guess-rev.sh`/"    -g -O2 -M
T openocd-openocd.o -MD -MP -MF .deps/openocd-openocd.Tpo -c -o openocd-openocd.o `test -f 'openocd.c' || echo './'`openocd.c

openocd.c: In function `handle_version_command':
openocd.c:55: error: missing terminating " character
openocd.c: In function `main':
openocd.c:93: error: missing terminating " character
解决办法:更改-DPKGBLDREV=/"`../guess-rev.sh`/"即可。

  1. 运行
telnet localhost 4444


参考:
1.Building OpenOCD: http://openfacts.berlios.de/index-en.phtml?title=Building_OpenOCD
2.OpenOCD compile on Windows XP: http://forum.sparkfun.com/viewtopic.php?t=7743&highlight=xscale
3.parport issues: http://forum.sparkfun.com/viewtopic.php?t=3795

你可能感兴趣的:(windows,SVN,command,gcc,character,debugging)