Compiling mspdebug for Windows using MinGW

We were trying to compile the windows version of Mspdebug from its source.
In this post we would detail the dependencies that needed to be taken care off and how to make the Mspdebug-0.18build with MinGW.

First let us browse the setup:

1. We need Latest version of the MinGW installed presently using :gcc version 4.6.1 (GCC)
2. Download the Old Regex utility from GNU http://ftp.gnu.org/old-gnu/regex/ file regex-0.12.tar.gz

3. Download the Mspdebug-0.18 http://sourceforge.net/projects/mspdebug/files/mspdebug-0.18.tar.gz/download

Note: Make sure that MinGW in in the path along with Msys for the binutils

Building the Dependency of the regex in MinGW

1. Extract the regex-0.12.tar.gz file in a directory say regex-0.12

2. Compile the files: gcc -g -DHAVE_STRING_H=1 -I. -c regex.c

3. Now make the lib file: ar ru libregex.a regex.o

4. Copy the files to the respective directories:

libregex.a => [MinGW dir]\lib and regex.h => [MinGW dir]\include

Here are some quick commands:

cp libregex.a ..\MinGw\lib

cp regex.h ..\MinGW\include

Thanks to kemovitra blog for help.
File modifications for including LibUsb-Win32 used in MinGW:

1. Need to change #include<usb.h> to: #include <lusb0_usb.h>

2. Each of the following files need to be modified:

mspdebug-0.18\util\usbutil.h      Line number: 22

mspdebug-0.18\drivers\olimex.c Line number: 23

mspdebug-0.18\drivers\rf2500.c Line number: 22

mspdebug-0.18\drivers\ti3410.c Line number: 23

Compiling the  Mspdebug:

1. Use the command:  make WITHOUT_READLINE=1

Here is the output view of the compile:

E:\D\mspdebug-0.18>make WITHOUT_READLINE=1

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/btree.o -c util/btree.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/expr.o -c util/expr.c

util/expr.c: In function ‘expr_eval’:

util/expr.c:236:6: warning: variable ‘last_cc’ set but not used [-Wunused-but-se

t-variable]

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/list.o -c util/list.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/sockets.o -c util/sockets.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/sport.o -c util/sport.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/usbutil.o -c util/usbutil.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/util.o -c util/util.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/vector.o -c util/vector.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/output.o -c util/output.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/output_util.o -c util/output_util.

c

util/output_util.c: In function ‘format_addr’:

util/output_util.c:30:6: warning: variable ‘numeric’ set but not used [-Wunused-

but-set-variable]

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/opdb.o -c util/opdb.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/prog.o -c util/prog.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/stab.o -c util/stab.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/dis.o -c util/dis.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/gdb_proto.o -c util/gdb_proto.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o util/dynload.o -c util/dynload.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/device.o -c drivers/device.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/bsl.o -c drivers/bsl.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/fet.o -c drivers/fet.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/fet_error.o -c drivers/fet_erro

r.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/fet_db.o -c drivers/fet_db.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/flash_bsl.o -c drivers/flash_bs

l.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/gdbc.o -c drivers/gdbc.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/olimex.o -c drivers/olimex.c

drivers/olimex.c: In function ‘open_interface’:

drivers/olimex.c:121:6: warning: variable ‘ret’ set but not used [-Wunused-but-s

et-variable]

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/rf2500.o -c drivers/rf2500.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/sim.o -c drivers/sim.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/uif.o -c drivers/uif.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/ti3410.o -c drivers/ti3410.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o drivers/tilib.o -c drivers/tilib.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/binfile.o -c formats/binfile.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/coff.o -c formats/coff.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/elf32.o -c formats/elf32.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/ihex.o -c formats/ihex.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/symmap.o -c formats/symmap.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/srec.o -c formats/srec.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o formats/titext.o -c formats/titext.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio.o -c simio/simio.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio_tracer.o -c simio/simio_tra

cer.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio_timer.o -c simio/simio_time

r.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio_wdt.o -c simio/simio_wdt.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio_hwmult.o -c simio/simio_hwm

ult.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o simio/simio_gpio.o -c simio/simio_gpio.

c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/gdb.o -c ui/gdb.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/rtools.o -c ui/rtools.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/sym.o -c ui/sym.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/devcmd.o -c ui/devcmd.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/reader.o -c ui/reader.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/cmddb.o -c ui/cmddb.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/stdcmd.o -c ui/stdcmd.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/aliasdb.o -c ui/aliasdb.c

gcc -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Idrivers -Iut

il -Iui -DLIB_DIR=\”/usr/local/lib/\” -o ui/main.o -c ui/main.c

gcc -s -o mspdebug.exe util/btree.o util/expr.o util/list.o util/sockets.o util

/sport.o util/usbutil.o util/util.o util/vector.o util/output.o util/output_util

.o util/opdb.o util/prog.o util/stab.o util/dis.o util/gdb_proto.o util/dynload.

o drivers/device.o drivers/bsl.o drivers/fet.o drivers/fet_error.o drivers/fet_d

b.o drivers/flash_bsl.o drivers/gdbc.o drivers/olimex.o drivers/rf2500.o drivers

/sim.o drivers/uif.o drivers/ti3410.o drivers/tilib.o formats/binfile.o formats/

coff.o formats/elf32.o formats/ihex.o formats/symmap.o formats/srec.o formats/ti

text.o simio/simio.o simio/simio_tracer.o simio/simio_timer.o simio/simio_wdt.o

simio/simio_hwmult.o simio/simio_gpio.o ui/gdb.o ui/rtools.o ui/sym.o ui/devcmd.

o ui/reader.o ui/cmddb.o ui/stdcmd.o ui/aliasdb.o ui/main.o -lusb -lws2_32 -lre

gex

2. If this works then you have a mspdebug.exe ready !!

Here is what we got:

E:\D\mspdebug-0.18>mspdebug.exe –help

Usage: mspdebug.exe [options] [command …]

-q

Start in quiet mode.

-d device

Connect via the given tty device, rather than USB.

-U bus:dev

Specify a particular USB device to connect to.

-s serial

Specify a particular device serial number to connect to.

-j

Use JTAG, rather than Spy-Bi-Wire (UIF devices only).

-v voltage

Set the supply voltage, in millivolts.

-n

Do not read ~/.mspdebug on startup.

–long-password

Send 32-byte IVT as BSL password (flash-bsl only)

–help

Show this help text.

–fet-list

Show a list of devices supported by the FET driver.

–fet-force-id string

Override the device ID returned by the FET.

–usb-list

Show a list of available USB devices.

–force-reset

Force target reset in initialization sequence.

–allow-fw-update

Update FET firmware (tilib only) if necessary.

–version

Show copyright and version information.

Most drivers connect by default via USB, unless told otherwise via the

-d option. By default, the first USB device found is opened.

If commands are given, they will be executed. Otherwise, an interactive

command reader is started.

Available drivers are:

rf2500

eZ430-RF2500 devices. Only USB connection is supported.

olimex

Olimex MSP-JTAG-TINY.

olimex-iso

Olimex MSP-JTAG-ISO.

sim

Simulation mode.

uif

TI FET430UIF and compatible devices (e.g. eZ430).

uif-bsl

TI FET430UIF bootloader.

flash-bsl

TI generic flash-based bootloader via RS-232

gdbc

GDB client mode

tilib

TI MSP430 library

 

Next we need to try out using this to program the MSP430 chips.

Advertisements

About boseji

Bharteya Anusandhankarta ( Indian Researcher)
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

One Response to Compiling mspdebug for Windows using MinGW

  1. Thanks for the Great Tutorial!

    Btw I was Having issues While trying to Compile the MSPdebug. Mingw was giving an error “lusb0_usb.h: no such file or directory”.

    All i did was Download libusb-win32(http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.5.0/libusb-win32-bin-1.2.5.0.zip/download).
    Extract lusb0_usb.h to c:\mingw\include, rename to usb.h
    Extract lib/gcc/libusb.a to c:\mingw\lib.

    An everything was Good!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s