Compile urJTAG for Windows
From DP
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.
In linux,
refer to http://www.mingw.org/wiki/LinuxCrossMinGW
If you are using debian, you may also run the Synaptic Package Manager and search for 'cross' under Debian also, you can use the command to download and install the needed packages:
aptitude install -R autoconf automake bash bison bzip2 cmake flex g++ intltool make sed libtool openssl libssl-dev libxml-parser-perl patch perl pkg-config scons unzip wget yasm
or
Download and install the files from http://mingw-w64.sourceforge.net/:
- For the Windows/Cygwin environment, download mingw-w32-1.0-bin_i686-cygwin-1.7.7-1_20110117.tar.bz2
- For the Linux environment, download mingw-w32-1.0-bin_i686-linux_20110117.tar.bz2
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:
/* hello.c -- hello world example. */
#include <stdio.h>
int main () {
printf ("Hello world!\n");
return 0;
}
and compile with the command:
i686-w64-mingw32-gcc -o hello hello.c
then find the generated hello.exe file in your home directory, test it in both windows and Linux
Patching Urjtag
You can run the following syntax to patch the source from the svn repository.
patch -p0 -i ./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 your patch (optional)
patch -p0 -i ./patch-file
- Run ./autogen to create makefiles for your system
<code> ./autogen.sh
- Run the ./configure along with its flags and parameters: (Debian/Linux)
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.
Please note that the --host flag need to be modified accordingly.
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.:
Some tricks and Notes
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.
The filename's prefix in the 'bin' directory is used as parameter in the --host during ./configure.
References
http://urjtag.sourceforge.net/
http://mingw-w64.sourceforge.net/
http://wiki.osdev.org/GCC_Cross-Compiler
Credits
Tjtag & Robots
