2009-11-16 23:52:10 +00:00
|
|
|
# MSPDebug - debugging tool for the eZ430
|
2015-03-01 20:39:21 +00:00
|
|
|
# Copyright (C) 2009-2015 Daniel Beer
|
2010-09-17 14:04:33 +00:00
|
|
|
# Copyright (C) 2010 Andrew Armenia
|
2009-11-16 23:52:10 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
2011-08-24 11:58:49 +00:00
|
|
|
CC ?= gcc
|
2010-03-18 01:02:05 +00:00
|
|
|
INSTALL = /usr/bin/install
|
|
|
|
PREFIX ?= /usr/local
|
2010-08-19 22:44:13 +00:00
|
|
|
LDFLAGS ?= -s
|
2009-11-16 23:52:10 +00:00
|
|
|
|
2011-10-03 15:14:45 +00:00
|
|
|
BINDIR = ${PREFIX}/bin/
|
|
|
|
MANDIR = ${PREFIX}/share/man/man1
|
|
|
|
LIBDIR = ${PREFIX}/lib/
|
|
|
|
|
2016-08-29 18:28:44 +00:00
|
|
|
UNAME_S := $(shell sh -c 'uname -s')
|
|
|
|
UNAME_O := $(shell sh -c 'uname -o 2> /dev/null')
|
|
|
|
|
2010-03-23 02:49:33 +00:00
|
|
|
ifdef WITHOUT_READLINE
|
2010-07-12 04:36:01 +00:00
|
|
|
READLINE_CFLAGS =
|
|
|
|
READLINE_LIBS =
|
2016-01-23 17:37:54 +00:00
|
|
|
CONSOLE_INPUT_OBJ = ui/input_console.o
|
2010-03-23 02:49:33 +00:00
|
|
|
else
|
2010-07-12 04:36:01 +00:00
|
|
|
READLINE_CFLAGS = -DUSE_READLINE
|
|
|
|
READLINE_LIBS = -lreadline
|
2016-01-23 17:37:54 +00:00
|
|
|
CONSOLE_INPUT_OBJ = ui/input_readline.o
|
2010-03-23 02:49:33 +00:00
|
|
|
endif
|
|
|
|
|
2016-11-26 10:03:41 +00:00
|
|
|
BSLHID_OBJ ?= transport/bslhid.o
|
|
|
|
|
2011-07-26 13:21:44 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2016-05-13 23:47:28 +00:00
|
|
|
MSPDEBUG_CC = $(CC)
|
2011-10-24 21:43:17 +00:00
|
|
|
BINARY = mspdebug.exe
|
2012-04-24 23:02:22 +00:00
|
|
|
ifneq ($(UNAME_O),Cygwin)
|
|
|
|
OS_LIBS = -lws2_32 -lregex
|
2013-12-10 22:25:40 +00:00
|
|
|
OS_CFLAGS = -D__Windows__ -DNO_SHELLCMD
|
2016-08-29 18:28:44 +00:00
|
|
|
RM = del
|
2012-04-24 23:02:22 +00:00
|
|
|
endif
|
2011-07-26 13:21:44 +00:00
|
|
|
else
|
2011-10-24 21:43:17 +00:00
|
|
|
MSPDEBUG_CC = $(CC)
|
|
|
|
BINARY = mspdebug
|
|
|
|
|
2015-03-01 20:39:21 +00:00
|
|
|
|
2013-12-12 02:27:56 +00:00
|
|
|
ifneq ($(filter $(UNAME_S),OpenBSD NetBSD),)
|
2012-10-09 03:49:42 +00:00
|
|
|
OS_LIBS =
|
2013-12-12 09:49:48 +00:00
|
|
|
else ifneq ($(filter $(UNAME_S),FreeBSD DragonFly),)
|
2012-10-24 09:49:16 +00:00
|
|
|
OS_CFLAGS = -pthread
|
|
|
|
OS_LIBS = -lpthread
|
2014-07-04 22:35:07 +00:00
|
|
|
else ifneq ($(filter $(UNAME_S),SunOS),)
|
|
|
|
OS_LIBS = -lpthread -ldl -lresolv -lsocket -lnsl
|
2011-10-24 21:43:17 +00:00
|
|
|
else
|
2012-10-08 20:55:48 +00:00
|
|
|
OS_LIBS = -lpthread -ldl
|
2011-10-24 21:43:17 +00:00
|
|
|
endif
|
2015-03-01 20:39:21 +00:00
|
|
|
|
|
|
|
ifeq ($(UNAME_S),Darwin) # Mac OS X/MacPorts stuff
|
2015-03-15 19:18:39 +00:00
|
|
|
ifeq ($(shell fink -V > /dev/null 2>&1 && echo ok),ok)
|
|
|
|
PORTS_CFLAGS := $(shell pkg-config --cflags libusb)
|
|
|
|
PORTS_LDFLAGS := $(shell pkg-config --libs libusb) -ltermcap -pthread
|
2015-03-01 20:39:21 +00:00
|
|
|
else
|
2015-03-15 19:18:39 +00:00
|
|
|
PORTS_CFLAGS := -I/opt/local/include
|
2016-11-26 10:03:41 +00:00
|
|
|
PORTS_LDFLAGS := -L/opt/local/lib -framework IOKit -framework CoreFoundation
|
2015-03-01 20:39:21 +00:00
|
|
|
endif
|
2016-11-26 10:03:41 +00:00
|
|
|
BSLHID_OBJ = transport/bslosx.o
|
2015-03-15 19:18:39 +00:00
|
|
|
else ifneq ($(filter $(UNAME_S),OpenBSD NetBSD DragonFly),)
|
|
|
|
PORTS_CFLAGS := $(shell pkg-config --cflags libusb)
|
|
|
|
PORTS_LDFLAGS := $(shell pkg-config --libs libusb) -ltermcap -pthread
|
|
|
|
else
|
|
|
|
PORTS_CFLAGS :=
|
|
|
|
PORTS_LDFLAGS :=
|
2015-03-01 20:39:21 +00:00
|
|
|
endif
|
2011-07-26 13:21:44 +00:00
|
|
|
endif
|
|
|
|
|
2012-09-10 02:22:00 +00:00
|
|
|
INCLUDES = -I. -Isimio -Iformats -Itransport -Idrivers -Iutil -Iui
|
2011-09-16 04:09:03 +00:00
|
|
|
GCC_CFLAGS = -O1 -Wall -Wno-char-subscripts -ggdb
|
2011-10-03 15:14:45 +00:00
|
|
|
CONFIG_CFLAGS = -DLIB_DIR=\"$(LIBDIR)\"
|
2011-07-26 13:21:44 +00:00
|
|
|
|
|
|
|
MSPDEBUG_LDFLAGS = $(LDFLAGS) $(PORTS_LDFLAGS)
|
2016-11-26 10:03:41 +00:00
|
|
|
MSPDEBUG_LIBS = -L. -lusb $(READLINE_LIBS) $(OS_LIBS)
|
2011-09-16 04:09:03 +00:00
|
|
|
MSPDEBUG_CFLAGS = $(CFLAGS) $(READLINE_CFLAGS) $(PORTS_CFLAGS)\
|
2012-04-24 23:02:22 +00:00
|
|
|
$(GCC_CFLAGS) $(INCLUDES) $(CONFIG_CFLAGS) $(OS_CFLAGS)
|
2010-05-13 04:45:38 +00:00
|
|
|
|
2011-07-26 13:21:44 +00:00
|
|
|
all: $(BINARY)
|
2009-11-16 23:52:10 +00:00
|
|
|
|
2015-03-01 20:39:21 +00:00
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
clean:
|
2016-08-29 18:28:44 +00:00
|
|
|
ifeq ($(UNAME_O),Cygwin)
|
|
|
|
$(RM) */*.o
|
|
|
|
$(RM) $(BINARY)
|
|
|
|
else
|
|
|
|
$(RM) drivers\*.o
|
|
|
|
$(RM) formats\*.o
|
|
|
|
$(RM) simio\*.o
|
|
|
|
$(RM) transport\*.o
|
|
|
|
$(RM) ui\*.o
|
|
|
|
$(RM) util\*.o
|
|
|
|
$(RM) $(BINARY)
|
|
|
|
endif
|
2015-03-01 20:39:21 +00:00
|
|
|
else
|
2009-11-16 23:52:10 +00:00
|
|
|
clean:
|
2016-08-29 18:28:44 +00:00
|
|
|
$(RM) */*.o
|
|
|
|
$(RM) $(BINARY)
|
2015-03-01 20:39:21 +00:00
|
|
|
endif
|
2009-11-16 23:52:10 +00:00
|
|
|
|
2011-07-26 13:21:44 +00:00
|
|
|
install: $(BINARY) mspdebug.man
|
2011-10-03 15:14:45 +00:00
|
|
|
mkdir -p $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -m 0755 $(BINARY) $(DESTDIR)$(BINDIR)
|
|
|
|
mkdir -p $(DESTDIR)$(MANDIR)
|
|
|
|
$(INSTALL) -m 0644 mspdebug.man $(DESTDIR)$(MANDIR)/mspdebug.1
|
|
|
|
mkdir -p $(DESTDIR)$(LIBDIR)/mspdebug
|
2011-09-16 04:09:03 +00:00
|
|
|
$(INSTALL) -m 0644 ti_3410.fw.ihex \
|
2011-10-03 15:14:45 +00:00
|
|
|
$(DESTDIR)$(LIBDIR)/mspdebug/ti_3410.fw.ihex
|
2010-03-18 01:02:05 +00:00
|
|
|
|
2009-11-16 23:52:10 +00:00
|
|
|
.SUFFIXES: .c .o
|
|
|
|
|
2011-09-14 04:08:02 +00:00
|
|
|
OBJ=\
|
2011-09-14 04:19:30 +00:00
|
|
|
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 \
|
2011-10-13 23:12:14 +00:00
|
|
|
util/dynload.o \
|
2012-07-12 12:13:20 +00:00
|
|
|
util/demangle.o \
|
2012-10-03 03:28:51 +00:00
|
|
|
util/powerbuf.o \
|
2012-10-08 20:55:48 +00:00
|
|
|
util/ctrlc.o \
|
2013-08-27 02:58:08 +00:00
|
|
|
util/chipinfo.o \
|
2014-12-14 20:06:30 +00:00
|
|
|
util/gpio.o \
|
2012-09-13 01:55:14 +00:00
|
|
|
transport/cp210x.o \
|
|
|
|
transport/cdc_acm.o \
|
2012-09-13 02:53:30 +00:00
|
|
|
transport/ftdi.o \
|
2012-09-10 02:22:00 +00:00
|
|
|
transport/rf2500.o \
|
|
|
|
transport/ti3410.o \
|
2012-09-13 02:33:04 +00:00
|
|
|
transport/comport.o \
|
2016-11-26 10:03:41 +00:00
|
|
|
$(BSLHID_OBJ) \
|
2011-09-14 04:15:37 +00:00
|
|
|
drivers/device.o \
|
|
|
|
drivers/bsl.o \
|
|
|
|
drivers/fet.o \
|
2012-09-17 23:17:55 +00:00
|
|
|
drivers/fet_core.o \
|
2012-09-13 03:49:19 +00:00
|
|
|
drivers/fet_proto.o \
|
2011-09-14 04:15:37 +00:00
|
|
|
drivers/fet_error.o \
|
|
|
|
drivers/fet_db.o \
|
|
|
|
drivers/flash_bsl.o \
|
|
|
|
drivers/gdbc.o \
|
|
|
|
drivers/sim.o \
|
2011-10-13 23:49:04 +00:00
|
|
|
drivers/tilib.o \
|
2012-07-18 00:26:55 +00:00
|
|
|
drivers/goodfet.o \
|
2012-09-11 02:35:31 +00:00
|
|
|
drivers/obl.o \
|
2012-10-03 00:37:29 +00:00
|
|
|
drivers/devicelist.o \
|
|
|
|
drivers/fet_olimex_db.o \
|
2012-10-11 22:33:20 +00:00
|
|
|
drivers/jtdev.o \
|
2015-02-03 21:22:39 +00:00
|
|
|
drivers/jtdev_gpio.o \
|
2012-10-11 22:33:20 +00:00
|
|
|
drivers/jtaglib.o \
|
|
|
|
drivers/pif.o \
|
2013-07-18 02:00:04 +00:00
|
|
|
drivers/loadbsl.o \
|
|
|
|
drivers/loadbsl_fw.o \
|
2013-09-08 01:41:55 +00:00
|
|
|
drivers/hal_proto.o \
|
|
|
|
drivers/v3hil.o \
|
|
|
|
drivers/fet3.o \
|
2014-04-02 01:48:42 +00:00
|
|
|
drivers/bsllib.o \
|
2014-04-17 03:58:16 +00:00
|
|
|
drivers/rom_bsl.o \
|
2015-06-07 23:37:25 +00:00
|
|
|
drivers/tilib_api.o \
|
2011-09-14 04:11:47 +00:00
|
|
|
formats/binfile.o \
|
|
|
|
formats/coff.o \
|
|
|
|
formats/elf32.o \
|
|
|
|
formats/ihex.o \
|
|
|
|
formats/symmap.o \
|
|
|
|
formats/srec.o \
|
|
|
|
formats/titext.o \
|
2011-09-14 04:08:02 +00:00
|
|
|
simio/simio.o \
|
|
|
|
simio/simio_tracer.o \
|
|
|
|
simio/simio_timer.o \
|
|
|
|
simio/simio_wdt.o \
|
|
|
|
simio/simio_hwmult.o \
|
|
|
|
simio/simio_gpio.o \
|
2012-10-16 14:02:38 +00:00
|
|
|
simio/simio_console.o \
|
2011-09-14 04:22:01 +00:00
|
|
|
ui/gdb.o \
|
|
|
|
ui/rtools.o \
|
|
|
|
ui/sym.o \
|
|
|
|
ui/devcmd.o \
|
2012-08-29 10:38:13 +00:00
|
|
|
ui/flatfile.o \
|
2011-09-14 04:22:01 +00:00
|
|
|
ui/reader.o \
|
|
|
|
ui/cmddb.o \
|
|
|
|
ui/stdcmd.o \
|
|
|
|
ui/aliasdb.o \
|
2012-10-03 03:28:51 +00:00
|
|
|
ui/power.o \
|
2012-10-09 01:52:02 +00:00
|
|
|
ui/input.o \
|
2012-10-09 02:42:54 +00:00
|
|
|
ui/input_async.o \
|
2016-01-23 17:37:54 +00:00
|
|
|
$(CONSOLE_INPUT_OBJ) \
|
2011-09-14 04:22:01 +00:00
|
|
|
ui/main.o
|
2011-09-14 04:08:02 +00:00
|
|
|
|
|
|
|
$(BINARY): $(OBJ)
|
2011-09-18 16:04:08 +00:00
|
|
|
$(MSPDEBUG_CC) $(MSPDEBUG_LDFLAGS) -o $@ $^ $(MSPDEBUG_LIBS)
|
2009-11-16 23:52:10 +00:00
|
|
|
|
2013-11-21 23:55:34 +00:00
|
|
|
util/chipinfo.o: chipinfo.db
|
|
|
|
|
2009-11-16 23:52:10 +00:00
|
|
|
.c.o:
|
2011-09-18 16:04:08 +00:00
|
|
|
$(MSPDEBUG_CC) $(MSPDEBUG_CFLAGS) -o $@ -c $*.c
|