Openwince's JTAG Compile/Usage Instructions

Jtag-0.5.1 and Samsung/29LV160DB Programming

Greg patched JTAG-0.5.1 to support the Am29LV160DB in 16 bit mode. 
He is using Samsung S3C4510B on several router boards so its the 
only CPU tested with. In theory it should work with other CPUs. 
Read below. 

Other uses of supported flash would be good, including trying to
use the include linux executable and check if it works.

One thing that remains to be looked into is the address shift issue
for Samsung and resolve (see below). In any case it can detect,
write flash and read flash to file on all boards he have, now,
except Compaq CP-2E/2W -- TBD)

jtag*                 (linux binary)
jtagin                (script for Samsung)
jtag051-s3c4510.patch (kblaszkowski's Samsung patch)
jtag051-29lv160.patch (My 29lv160 16 bit patch)
README                (readme file)

Download from:


Modified JTAG-0.5.1 (

This program and patch is to support the AMD Am29LV160DB with JTAG-0.5.1
configured in 16 bit mode. This was using the Samsung S3C4510B based board
as the platform. A wiggler clone was used but other supported JTAG interfaces
can be used. See JTAG-0.5.1 docs.

Use 'jtag jtagin' under user root or another user account that can get
control of the parallel port. This will start and load the script for 
the Samsung based boards. Make the appropriate changes for other CPUs. 
The included binary is an x86 linux exacutable. If you need a Cygwin 
exacutable then you need to see below to make a Cygwin binary.

Try 'detectflash' to see if it can detect the 29LV160 part or other parts.

To build the included jtag binary:

1) install include-x.xx from the openwince site above.
2) install readline libraries (if not installed already from the linux dist)
3) untar jtag-0.5.1
4) apply Samsung S3C4510B patch, Need to even if not using the 4510B CPU
   In the 'jtag-0.5.1' dir, do: patch -p0 < jtag051-s3c4510.patch
5) apply my 29lv160 patch
   In the 'jtag-0.5.1' dir, do: patch -p0 < jtag051-29lv160.patch
6) configure and build per jtag-0.5.1 instructions
   make        (binary will be in the 'src' dir at this point)
   make install

Hopefully this will be integrated in the CVS soon.

There might be an issue with the way the 29LV160 part and other 16 bit parts
are connected to the Samsung 4510B CPUs. A0 of the CPU is connected to A0 of
the flash, A1 to A1, etc. The code, when it detects the flash in 16 bit
mode, will assume the flash/CPU is connected in another way which is more 

i.e. A0 of CPU not connected to flash, A1 of CPU connected to A0 of flash,
A2 of CPU to A1 of flash and so on. I have corrected this to work for the
Samsung so that other CPUs may not work in 16 bit mode anymore. See below 
to make the change back. I may have to put a 'if' statement to check for 
which CPU is used, ie Samsung or not.

In the jtag-0.5.1/libbrux/flash/amd.c, amd_flash_autodetect16 function:

static int
amd_flash_autodetect16( cfi_array_t *cfi_array )
   if(cfi_array->bus_width != 2) return 0;
   o = 1; /* Heuristic */
   return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS);

For my code and patch I had to change to change o = 1; to o = 0;
This compensates for the bit shift. For 0 bit shift in the address value
when a '0' is used and a left shift by one bit when a '1' is used. See 
rest of code in amd.c.

This stumped me for awhile and I couldn't explain it until recently. 
I'll fix it in the final patch.


published on the list at 17/Nov/2003

$Id: openwince.html,v 1.2 2004/02/19 20:57:29 bcabral Exp $