原创 How to build openocd for windows

2008-10-30 12:40 3013 9 8 分类: MCU/ 嵌入式

Hello,


here is a short tutorial how to build openocd for windows.

1)
Install cygwin, but you need some additional tools from the
development package like:

- autoconf: Wrapper scripts for autoconf commands
- automake: Wrapper scripts for automake and aclocals
- gcc: C compiler upgrade helper
- make: The GNU version og the 'make' utility
- subversion: A version control system

2)
In case you want to build openocd for the FT2232 interface,
you need the driver from FTDI too. Which can be found here:
http://www.ftdichip.com/Drivers/D2XX.htm

I assumed you have installed cygwin and downloaded the ftdi driver.
Extract the ftdi driver in the following directory /home/openocd.
This will create an extra folder inside /home/openocd called:

"CDM 2.04.06 WHQL Certified"

I do not like the spaces in the name here, please rename this
folder too "ftd2xx" You must now copy the file "ftd2xx.lib" from
/home/openocd/ftd2xx/i386 or /home/openocd/ftd2xx/amd64
depending from your architecture into the following folder:

/home/openocd/ftd2xx

3)
Now we need the opencd source, change into /home/openocd and
use the following svn command:




Code:


svn checkout http://svn.berlios.de/svnroot/repos/openocd/trunk trunk


or


svn checkout svn://svn.berlios.de/openocd/trunk



Now the openocd source will be loaded and stored in the
folder "trunk". You will now have two folders under /home/openocd like:

/home/openocd/trunk
/home/openocd/ftd2xx

4)
Change into /home/openocd/trunk. Here we will build openocd
for a FT2232 interface now.

Type in the following commands:




Code:


./bootstrap



If you want to build a cygwin based openocd type now:




Code:


./configure --enable-ft2232_ftd2xx --with-ftd2xx=/home/openocd/ftd2xx



but if you want to build a mingw based openocd type:




Code:



./configure --enable-ft2232_ftd2xx --with-ftd2xx=/home/openocd/ftd2xx CC="gcc -mno-cygwin"



In case you want to create a debug version of OpenOCD you must add the following line to the configure command:

CFLAGS="-O0 -g -Wall"




The new command will look like for a cygwin debug build:




Code:


./configure --enable-ft2232_ftd2xx --with-ftd2xx=/home/openocd/ftd2xx CFLAGS="-O0 -g -Wall"



and here the command for a mingw debug build:




Code:


./configure --enable-ft2232_ftd2xx --with-ftd2xx=/home/openocd/ftd2xx CC="gcc -mno-cygwin" CFLAGS="-O0 -g -Wall"



After the configure step OpenOCD can be build with the
following command:




Code:


make



The executable "openocd.exe" will be created in the following folder:

/home/openocd/trunk/src

Even you can build the html docs with:




Code:


make html



The pdf of the documentation can be build with:




Code:


make pdf



but here you must have tex installed too.

openocd.cfg file as below:



#daemon configuration


telnet_port 4444


gdb_port 3333


tcl_port 6666




# tell gdb our flash memory map


# and enable flash programming


gdb_memory_map enable


gdb_flash_program enable




#interface


interface ft2232


ft2232_device_desc "USB Serial Converter A"


#ft2232_device_desc "USB OpenOCD JTAG A"


ft2232_layout "usbjtag"


ft2232_vid_pid 0x0403 0x6010


jtag_speed 3


#jtag_khz 300




#delays on reset lines


jtag_ntrst_delay 200




# NOTE!!! LPCs need reset pulled while RTCK is low. 0 to activate


# JTAG, power-on reset is not enough, i.e. you need to perform a


# reset before being able to talk to the LPC2148, attach is not


# possible.




#use combined on interfaces or targets that can't set TRST/SRST separately


reset_config trst_and_srst srst_pulls_trst




#LPCs need reset pulled while RTCK is low. 0 to activate JTAG, power-on reset is not enough


jtag_reset 1 1


jtag_reset 0 0




#jtag scan chain


jtag_device 4 0x1 0xf 0xe




target arm7tdmi little 0 arm7tdmi-s_r4


[new_target_name] configure -event reset-init {


# Force target into ARM state


soft_reset_halt


#do not remap 0x0000-0x0020 to anything but the flash


mwb 0xE01FC040 0x01



}


working_area 0 0x40000000 0x4000 nobackup


#flash bank lpc2000 <base> <size> 0 0 <target#> <variant>


flash bank lpc2000 0x0 0x7d000 0 0 0 lpc2000_v2 14765



Run openocd.exe -f openocd.cfg


点击看大图



Best regards,

Michael




PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
我要评论
0
9
关闭 站长推荐上一条 /3 下一条