<subject "The XDS510 Simulator">
<nedstat "ABQAcAsd47yLuFrFjWU0OL3I6nMA">

<sdf notypo>

P1: Introduction

Texas Instruments has some pretty cool DSPs. But programming many of them
requires TI's XDS510 JTAG interface, that TI unfortunately sells for a
horrendous (for a hobbyist) price. I have written an extension to Wine that
enables TI's programming tools to function by using a software-simulated
XDS510, and a trivial parallel interface. I have tested this system with
the TMS320F241, but it should work with many other models, as long as the
same XDS510 features that are used by the programming software are those
that I have implemented.  If you want to program an XDS510 cheaply, this is
the thing for you.  If Wine is a problem for you, the code that I have
written can be adapted to TI's software in other ways.  Don't hesitate to
ask me for more information.

Another option may be to buy an imitation XDS510 such as the one sold
{{[jump="http://www.quickembed.com/en/XDS510.htm"]here}}. I haven't tried it and
would love to hear any feedback about it.

P1: Other options

Thanks to Ben Apopei for pointing out two other ways to get an XDS510.
First, if you are working for a university, TI has a university program
that may be able to get an XDS510 given to you. Alternatively, you can go
on eBay and get one for only a few hundred dollars.
  
P1: You don't have Linux or Wine, you just want to try something quick from
Windows.

You can use the code that I provided to hack into the DLLs in another way. 
Check out the Technical details section. Some people have already done this
(many thanks to them!), here is what they have produced.

P2: Guillaume Zin's modified Dosbox

Guillaume Zin has patched Dosbox using my code. You can download
{{[jump="DosBoxXDS510.zip"]precompiled binaries and source}} for this work.
I haven't tried this myself, but according to Guillaume, you just need to
run DosBox, and then use TI's programming tools (see What You Will Need
section below) from the resulting DOS window.

P2: Lorenzo Lutti's

You can also try out {{[jump="xds510_win.zip"]Lorenzo Lutti's Windows
port}} that is described in this {{[jump="win-readme.txt"]readme}} file.

P1: What you will need

 * A runnning Linux installation.

 * Wine: I used release 20000430, but it no longer seems to be available 
so you will have to do a little patching by hand.

 * {{[jump="xds510.tgz"] The wine patch that I wrote.}}
 
 * A simple, easy to make at home, JTAG interface such as those provided 
by Lattice. {{[jump="VantisManual.pdf"]
 See Appendix A of the LatticePro application note.}}

 * The JTAG programing tools that TI provides for free Prg2xx (the internal
version, not parallel port or serial port). You will probably have to
change the case of some file names since wine looks for its DLLs in a case
sensitive way. The tools for the 2000 family are
{{[jump="http://focus.ti.com/docs/toolsw/folders/print/sprc143.html"]
here}}, but they keep changin the link, so it is often broken. You can
search for prg2xx to find their new location if the link is broken (and
please email me the new link so I can update the page). I have only
experimented with Prg2xx for the TMS320F241.

P1: Prepatched version of wine

You can directly download a {{[jump="wine-20000430-xds510.tgz"]prepatched
version of wine}}. It works fine for XDS510 programming, but it is rather
old (2001), so you probably don't want to do anything else with it. With
this you can start from step 5 in the patching wine section. 

Please tell me if you have trouble compiling this source code. This is a
new part of this website.

P1: Patching wine

 ^ Untar the Wine archive.
 
 + Untar my archive in Wine's the msdos directory. This adds the files that
actually do the real work.

 + Now you have tell Wine about my files by modifying {{EX: ioports.c}} in
Wine's msdos directory. The following changes have to be made:

  * Add {{EX: #include "hds510.h"}} at the top of the file.
  
  * Add {{EX: XDS510_init();}} in the last line of the IO_port_init function.

  * Change the default case in IO_inport to:
  
  > if ((port >= XDS510(0x00) && port < XDS510(0x20)) || 
  >     (port >= XDS510(0x400) && port < XDS510(0x410)) ||
  >      port == XDS510(0x800))
  > {
  >   res = XDS510_read(port - XDS510_BASE);
  > }
  > else
  > {
  >   printf("Direct I/O read attempted from port %x\n", port);
  >   WARN("Direct I/O read attempted from port %x\n", port);
  >   res = 0xffffffff;
  > }
  > break;
      
  *Change the default case in IO_outport to:
    
  > if ((port >= XDS510(0x00) && port < XDS510(0x20)) ||
  >     (port >= XDS510(0x400) && port < XDS510(0x410)) ||
  >      port == XDS510(0x800))
  > {
  >   XDS510_write(port - XDS510_BASE, value);
  > }
  > else
  > {
  >   printf("Direct I/O write attempted to port %x\n", port );
  >   WARN("Direct I/O write attempted to port %x\n", port );
  > }
  > break;
      
 + Add {{EX: xds510.c}} and {{EX: xds510_io.c}} in C_SRCS in the Makefile.in of Wine's msdos
directory.

 + Modify {{EX: xds510.c}} so that the address of your parallel port is in
 {{EX: PAR_ADDR}}.  You can also change the base address of the simulated
 {{EX: xds510}} in {{EX: xds510.h}}.
 
 + Run configure and make.
 
 + If you want to install Wine, run make install. You can also choose not
 to install it, but in that case, you have to make sure that the
 winelibthat is being used is the one you just compiled.

 + Install TI's tools and run them with Wine. You will need to configure
wine so that it can write to the parallel port. You might have to rename
the DLLs that come with the TI software so that the case is the way Wine
wants it.

P1: Using it

If all goes well, you should now be able to use TI's software with wine.
If it doesn't work I would love to have some feedback to try to help you
get it working.

P1: Technical details

The simulator is quite straightforward. It intercepts ins and outs to the
ports that the xds510 occupies in {{EX: ioports.c}}. Then it interprets
them in {{EX: xds510.c}} and genereates JTAG signals that are sent to the
parallel port in {{EX: xds510_io.c}}.

The xds510 is built with the SN74ACT8990, a documented chip from TI. {{[jump="http://www-s.ti.com/sc/psheets/scaa044/scaa044.pdf#xml=http://www-search.ti.com/search97cgi/s97_cgi?action=View&VdkVgwKey=http%3A%2F%2Fwww%2Ds%2Eti%2Ecom%2Fsc%2Fpsheets%2Fscaa044%2Fscaa044%2Epdf&doctype=xml&Collection=TechDocs&QueryZip=%3CACCRUE%3E%28%5B90%5D%28test%2Dbus+controller%29+%3CIN%3E+Keywords%2C+%5B85%5D%28test%2Dbus+controller%29+%3CIN%3E+Title%2C+%5B70%5D%28%28%28test%2Dbus+controller%29+%3CIN%3E+Body+%3CAND%3E+%3CNOT%3E+%28test%2Dbus+controller%29+%3CIN%3E+A%29+%3COR%3E+%28test%2Dbus+controller%29+%3CIN%3E+Page%29%2C+%5B10%5D%28test%2Dbus+controller%29+%3CIN%3E+A%29&"]
You can read about it (if this link fails search for Test bus controller
on www.ti.com).}} You will find that I only implemented a subset ofthe
xds510 functionality.

If you want to avoid Linux and Wine, you can intercept the ins and outs that
the TI software makes by patching TI's {{EX: SMG510W.DLL}}. There are just
two simple functions in which IO is performed. If you can intercept them
and get my code called from them, then you can use my simulator in Windows.
Have fun, and tell me about your successes or failures!

</sdf>

