1 |
21 |
nyawn |
prefix = /usr/local
|
2 |
|
|
|
3 |
|
|
# Your build environment. selects libs, lib dirs, and include dirs
|
4 |
|
|
# Supported: linux, cygwin
|
5 |
|
|
BUILD_ENVIRONMENT=cygwin
|
6 |
|
|
|
7 |
|
|
# Set this to 'true' if you want to build for the legacy debug unit ('debug_if' core),
|
8 |
|
|
# leave 'false' if you are building for the Advanced Debug Unit.
|
9 |
|
|
SUPPORT_LEGACY=false
|
10 |
|
|
|
11 |
|
|
# Set this to 'true' to include support for cables which require libusb
|
12 |
|
|
# currently includes Altera USB-Blaster and Xilinx XPC DLC8
|
13 |
|
|
SUPPORT_USB_CABLES=true
|
14 |
|
|
|
15 |
|
|
# Set this to 'true' to support cables which require libFTDI
|
16 |
|
|
# SUPPORT_USB_CABLES must also be set to 'true' to support FTDI-based cables.
|
17 |
|
|
SUPPORT_FTDI_CABLES=true
|
18 |
|
|
|
19 |
32 |
nyawn |
# Some users have reported failures with the standard libusb-based USBBlaster
|
20 |
|
|
# driver, but success using a libftdi-based driver. Set this 'true' to use
|
21 |
|
|
# this libftdi-based driver. Do not use except as a last resort - this driver
|
22 |
|
|
# does not use the USB-Blaster's high speed transfer mode, making it very slow.
|
23 |
|
|
# SUPPORT_FTDI_CABLES must also be set 'true' to use this driver.
|
24 |
|
|
USE_ALT_FTDI_USBBLASTER_DRIVER=false
|
25 |
21 |
nyawn |
|
26 |
32 |
nyawn |
# Normal error-checking on every word of a burst write can cause a significant
|
27 |
|
|
# slowdown, especially when using the USB-Blaster cable. Setting this option
|
28 |
|
|
# true will eliminate this slowdown, at the cost of per-word error checking.
|
29 |
42 |
nyawn |
# Note that this option must also be defined in the hardware HDL.
|
30 |
32 |
nyawn |
USE_HISPEED=true
|
31 |
|
|
|
32 |
42 |
nyawn |
# If you have the JTAG Serial Port (JSP) included in you hardware, set
|
33 |
|
|
# the following to true to compile the JSP server
|
34 |
|
|
INCLUDE_JSP_SERVER=true
|
35 |
|
|
|
36 |
|
|
# The JTAG serial port is normally compatible with multi-device JTAG chains.
|
37 |
|
|
# However, this can hurt performance when using USB JTAG cables. If you are
|
38 |
|
|
# using a USB JTAG cable and your JTAG chain has only one device on it,
|
39 |
|
|
# set this false to use a performance-optimized version. Note this must also
|
40 |
|
|
# be defined in the hardware HDL.
|
41 |
|
|
JSP_MULTI_DEVICE_CHAIN=true
|
42 |
|
|
|
43 |
|
|
# Different optimizations have been implemented for different JTAG cables in
|
44 |
|
|
# the JSP driver. The default implementation transfers the least number of
|
45 |
|
|
# bits, which works well for parallel JTAG cables. When using a USB JTAG
|
46 |
|
|
# cable, set this to true to use a version of the driver that instead uses
|
47 |
|
|
# the smallest number of USB transactions.
|
48 |
|
|
JSP_OPTIMIZE_FOR_USB=true
|
49 |
|
|
|
50 |
21 |
nyawn |
# ----------------------------------------------------------------------------
|
51 |
|
|
# Most people shouldn't have to change anything below this line
|
52 |
|
|
|
53 |
|
|
ifeq ($(BUILD_ENVIRONMENT),linux)
|
54 |
|
|
# These are for native Linux. You may need to put the path to libusb into the LIBS variable
|
55 |
|
|
# with the -L command.
|
56 |
|
|
CFLAGS = -g -O2 -Wall
|
57 |
|
|
CC = gcc
|
58 |
|
|
LIBS = -lpthread
|
59 |
|
|
INCLUDEDIRS = -I/usr/local/include/libusb-1.0/ -I/usr/local/include/
|
60 |
|
|
|
61 |
|
|
else
|
62 |
|
|
|
63 |
|
|
ifeq ($(BUILD_ENVIRONMENT),cygwin)
|
64 |
|
|
# These are for cygwin. It assumes libusb.a is in the current directory.
|
65 |
|
|
CFLAGS = -g -O2 -Wall
|
66 |
|
|
CC = gcc
|
67 |
|
|
LIBS = -L. -lioperm -lpthread
|
68 |
|
|
INCLUDEDIRS = -I/usr/local/include/
|
69 |
|
|
endif
|
70 |
|
|
|
71 |
|
|
endif
|
72 |
|
|
|
73 |
|
|
ifeq ($(SUPPORT_LEGACY),true)
|
74 |
|
|
CFLAGS += -D__LEGACY__
|
75 |
|
|
endif
|
76 |
|
|
|
77 |
32 |
nyawn |
ifeq ($(USE_HISPEED),true)
|
78 |
|
|
CFLAGS += -DADBG_OPT_HISPEED
|
79 |
|
|
endif
|
80 |
21 |
nyawn |
|
81 |
42 |
nyawn |
ifeq ($(JSP_MULTI_DEVICE_CHAIN),true)
|
82 |
|
|
CFLAGS += -DENABLE_JSP_MULTI
|
83 |
|
|
endif
|
84 |
32 |
nyawn |
|
85 |
42 |
nyawn |
ifeq ($(JSP_OPTIMIZE_FOR_USB),true)
|
86 |
|
|
CFLAGS += -DOPTIMIZE_JSP_FOR_USB
|
87 |
|
|
endif
|
88 |
|
|
|
89 |
|
|
|
90 |
21 |
nyawn |
PROGRAMS = adv_jtag_bridge
|
91 |
|
|
|
92 |
|
|
HEADERS = adv_jtag_bridge.h chain_commands.h opencores_tap.h \
|
93 |
|
|
altera_virtual_jtag.h rsp-server.h bsdl.h or32_selftest.c cable_common.h \
|
94 |
|
|
cable_parallel.h cable_sim.h \
|
95 |
|
|
bsdl_parse.h errcodes.h spr-defs.h except.h adv_dbg_commands.h dbg_api.h \
|
96 |
42 |
nyawn |
legacy_dbg_commands.h utilities.h hardware_monitor.h
|
97 |
21 |
nyawn |
|
98 |
|
|
SOURCES = adv_jtag_bridge.c rsp-server.c chain_commands.c cable_common.c bsdl.c \
|
99 |
42 |
nyawn |
or32_selftest.c cable_parallel.c cable_sim.c utilities.c \
|
100 |
|
|
bsdl_parse.c errcodes.c adv_dbg_commands.c dbg_api.c legacy_dbg_commands.c \
|
101 |
|
|
hardware_monitor.c
|
102 |
21 |
nyawn |
|
103 |
|
|
OBJECTS = adv_jtag_bridge.o rsp-server.o chain_commands.o cable_common.o bsdl.o \
|
104 |
42 |
nyawn |
or32_selftest.o cable_parallel.o cable_sim.o utilities.o \
|
105 |
|
|
bsdl_parse.o errcodes.o adv_dbg_commands.o dbg_api.o legacy_dbg_commands.o \
|
106 |
|
|
hardware_monitor.o
|
107 |
21 |
nyawn |
|
108 |
|
|
|
109 |
|
|
ifeq ($(SUPPORT_USB_CABLES),true)
|
110 |
|
|
CFLAGS += -D__SUPPORT_USB_CABLES__
|
111 |
32 |
nyawn |
HEADERS += cable_xpc_dlc9.h
|
112 |
|
|
SOURCES += cable_xpc_dlc9.c
|
113 |
|
|
OBJECTS += cable_xpc_dlc9.o
|
114 |
21 |
nyawn |
|
115 |
32 |
nyawn |
ifeq ($(USE_ALT_FTDI_USBBLASTER_DRIVER),false)
|
116 |
|
|
HEADERS += cable_usbblaster.h
|
117 |
|
|
SOURCES += cable_usbblaster.c
|
118 |
|
|
OBJECTS += cable_usbblaster.o
|
119 |
|
|
endif
|
120 |
|
|
|
121 |
21 |
nyawn |
ifeq ($(SUPPORT_FTDI_CABLES),true)
|
122 |
|
|
CFLAGS += -D__SUPPORT_FTDI_CABLES__
|
123 |
|
|
LIBS += -lftdi
|
124 |
|
|
HEADERS += cable_ft2232.h
|
125 |
|
|
SOURCES += cable_ft2232.c
|
126 |
|
|
OBJECTS += cable_ft2232.o
|
127 |
32 |
nyawn |
|
128 |
|
|
ifeq ($(USE_ALT_FTDI_USBBLASTER_DRIVER),true)
|
129 |
|
|
HEADERS += cable_usbblaster.h
|
130 |
|
|
SOURCES += cable_usbblaster_ftdi.c
|
131 |
|
|
OBJECTS += cable_usbblaster_ftdi.o
|
132 |
21 |
nyawn |
endif
|
133 |
|
|
|
134 |
32 |
nyawn |
endif
|
135 |
|
|
|
136 |
21 |
nyawn |
# libusb must follow libftdi in the list of libraries
|
137 |
|
|
LIBS += -lusb
|
138 |
|
|
endif
|
139 |
|
|
|
140 |
42 |
nyawn |
ifeq ($(INCLUDE_JSP_SERVER),true)
|
141 |
|
|
CFLAGS += -DENABLE_JSP
|
142 |
|
|
HEADERS += jsp_server.h
|
143 |
|
|
SOURCES += jsp_server.c
|
144 |
|
|
OBJECTS += jsp_server.o
|
145 |
|
|
endif
|
146 |
21 |
nyawn |
|
147 |
42 |
nyawn |
|
148 |
21 |
nyawn |
all: $(PROGRAMS)
|
149 |
|
|
|
150 |
|
|
default: $(PROGRAMS)
|
151 |
|
|
|
152 |
|
|
.c.o:
|
153 |
|
|
$(CC) $(CFLAGS) -c $<
|
154 |
|
|
|
155 |
|
|
adv_jtag_bridge: Makefile $(OBJECTS) $(HEADERS)
|
156 |
|
|
rm -f $@
|
157 |
|
|
$(CC) -o $@ $(CFLAGS) $(OBJECTS) $(LIBS) $(INCLUDEDIRS)
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
install: all
|
161 |
|
|
[ -d $(prefix)/bin ] || mkdir -p $(prefix)/bin
|
162 |
|
|
for p in $(PROGRAMS) ; do \
|
163 |
|
|
/bin/rm -f $(prefix)/bin/$$p; \
|
164 |
|
|
/bin/cp -p $$p $(prefix)/bin/$$p; \
|
165 |
|
|
done
|
166 |
|
|
|
167 |
|
|
clean: Makefile
|
168 |
|
|
rm -f $(PROGRAMS) *.o *~
|