Compile urJTAG for Windows

From DP

Revision as of 15:33, 19 January 2011 by Jamz (Talk | contribs)
Jump to: navigation , search

Contents

Introduction

Urjtag is a modern tool for communicating over JTAG with flash chips, CPU's etc. This version aimed at supporting Bus Blaster high speed JTAG/flash programmer development.

We are going to cross-compile urJTAG from another platform, preferably Linux, but also under Cygwin. The compiled version will run in native MS Windows.

Requirements

Before you can compile Urjtag for Windows, you need to have a cross-compiler environment for your OS.

Download and install the files from http://mingw-w64.sourceforge.net/:

Aside from these latest builds, you also need the following:

  • the latest Urjtag from the svn, which we will download later and
  • the required Windows libraries from ftdichip.com

Building the cross compile environment

Fortunately the people behind MingGW-w64 have done it for you. All you have to do is uncompress the downloaded toolchain into a directory of your choice and add the "bin" path to your PATH environment variable (assuming you uncompress toolchain tarball in /mingw-w32):

export PATH=/mingw-w32/bin:`printenv PATH`

Check your path by running:

printenv PATH

Testing the build environment

To test your cross-compile environment,

Create a simple hello.c

gcc -o hello hello.c

Patching Urjtag

You can run the following syntax to patch the source from the svn repository.

patch -p0 -i path-to-patch-file

Cross compiling Urjtag for Windows

When everything is working well, here is the sequence for cross-compilation:

  • Download the latest Urjtag from the repositories:

svn co http://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk urjtag
cd to your urjtag installation root
cd urjtag/urjtag

  • Run ./autogen to create makefiles for your system

./autogen.sh

  • Run the ./configure along with its flags and parameters:

./configure CFLAGS="-DJTAG_BIN_DIR=\\\"/\\\" -DJTAG_DATA_DIR=\\\"/data\\\"" LDFLAGS="-L/home/username/CDM20808/i386" LIBS="-lftd2xx" ./configure --enable-maintainer-mode --host=i586-mingw32msvc --with-ftd2xx="/home/username/CDM20808" --disable-werror --disable-nls --without-libusb --disable-silent-rules --enable-relocatable

  • Run make

make

And find your exe file in your src/apps/jtag directory.

Testing and running on Windows

Transfer the exe file created from the cross-compiler to a subdirectory and run the jtag.exe. You should see the following, along with the build no.:

Urjtagscreen.png

Some tricks

You may download the Windows binary from the repository, install it and just replace the exe file with your build. Don't forget to move the FTDI libraries into their own directories or include them in Windows's PATH.

References

http://urjtag.sourceforge.net/

http://mingw-w64.sourceforge.net/

Credits