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.
- 安裝cygwin
必須安裝的組件包括: gcc, autoconf, automake, M4, perl
- 下載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
- 編譯openocd
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 builds the OpenOCD, and places the final executable in ./src/
- 可能出現的編譯錯誤及解決辦法:
parport.c:65:20: sys/io.h: No such file or directory
解決辦法:在parport.c中定義宏_WIN32,注意不能在config.h中定義這個宏,否則在編譯其他模組代碼時會出錯。
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即可。
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`/"即可。
- 運行
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