1 |
59 |
nyawn |
prefix = /usr/local
|
2 |
|
|
|
3 |
|
|
# Your build environment. selects libs, lib dirs, and include dirs
|
4 |
|
|
# Supported: linux, cygwin, freebsd
|
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 parallel cables
|
12 |
|
|
SUPPORT_PARALLEL_CABLES=true
|
13 |
|
|
|
14 |
|
|
# Set this to 'true' to include support for cables which require libusb
|
15 |
|
|
# currently includes Altera USB-Blaster and Xilinx XPC DLC8
|
16 |
|
|
SUPPORT_USB_CABLES=true
|
17 |
|
|
|
18 |
|
|
# Set this to 'true' to support cables which require libFTDI
|
19 |
|
|
# SUPPORT_USB_CABLES must also be set to 'true' to support FTDI-based cables.
|
20 |
|
|
SUPPORT_FTDI_CABLES=true
|
21 |
|
|
|
22 |
|
|
# Some Xilinx Parallel Cable IIIs will work just as fast as we can drive them.
|
23 |
|
|
# Some (clones) require us to limit their clock rate. Three schemes are defined:
|
24 |
|
|
# "sleep_wait": tries not to use CPU, but may sleep much longer than desired
|
25 |
|
|
# "timer_wait": does busy-wait polling on a timer
|
26 |
|
|
# "no_wait": does not wait, runs as fast as possible
|
27 |
|
|
XPC3_LIMIT_SCHEME=timer_wait
|
28 |
|
|
|
29 |
|
|
# Normal error-checking on every word of a burst write can cause a significant
|
30 |
|
|
# slowdown, especially when using the USB-Blaster cable. Setting this option
|
31 |
|
|
# true will eliminate this slowdown, at the cost of per-word error checking.
|
32 |
|
|
# Note that this option must also be defined in the hardware HDL.
|
33 |
|
|
USE_HISPEED=true
|
34 |
|
|
|
35 |
|
|
# If you have the JTAG Serial Port (JSP) included in you hardware, set
|
36 |
|
|
# the following to true to compile the JSP server
|
37 |
|
|
INCLUDE_JSP_SERVER=true
|
38 |
|
|
|
39 |
|
|
# The JTAG serial port is normally compatible with multi-device JTAG chains.
|
40 |
|
|
# However, this can hurt performance when using USB JTAG cables. If you are
|
41 |
|
|
# using a USB JTAG cable and your JTAG chain has only one device on it,
|
42 |
|
|
# set this false to use a performance-optimized version. Note this must also
|
43 |
|
|
# be defined in the hardware HDL.
|
44 |
|
|
JSP_MULTI_DEVICE_CHAIN=true
|
45 |
|
|
|
46 |
|
|
# Different optimizations have been implemented for different JTAG cables in
|
47 |
|
|
# the JSP driver. The default implementation transfers the least number of
|
48 |
|
|
# bits, which works well for parallel JTAG cables. When using a USB JTAG
|
49 |
|
|
# cable, set this to true to use a version of the driver that instead uses
|
50 |
|
|
# the smallest number of USB transactions.
|
51 |
|
|
JSP_OPTIMIZE_FOR_USB=true
|
52 |
|
|
|
53 |
|
|
# ----------------------------------------------------------------------------
|
54 |
|
|
# Most people shouldn't have to change anything below this line
|
55 |
|
|
|
56 |
|
|
ifeq ($(BUILD_ENVIRONMENT),linux)
|
57 |
|
|
# These are for native Linux. You may need to put the path to libusb into the LIBS variable
|
58 |
|
|
# with the -L command.
|
59 |
|
|
CFLAGS = -g -O2 -Wall
|
60 |
|
|
CC = gcc
|
61 |
|
|
LIBS = -lpthread -lrt
|
62 |
|
|
INCLUDEDIRS = -I/usr/local/include/libusb-1.0/ -I/usr/include/ -I/usr/local/include/
|
63 |
|
|
endif
|
64 |
|
|
|
65 |
|
|
ifeq ($(BUILD_ENVIRONMENT),cygwin)
|
66 |
|
|
# These are for cygwin. It assumes libusb.a is in the current directory.
|
67 |
|
|
CFLAGS = -g -O2 -Wall
|
68 |
|
|
CC = gcc
|
69 |
|
|
LIBS = -L. -lioperm -lpthread -lrt
|
70 |
|
|
INCLUDEDIRS = -I/usr/local/include/
|
71 |
|
|
endif
|
72 |
|
|
|
73 |
|
|
ifeq ($(BUILD_ENVIRONMENT),freebsd)
|
74 |
|
|
# These are for FreeBSD. Only FreeBSD >= 8 is supported (assumes, that
|
75 |
|
|
# libusb(8) is present in the base system (/usr/lib/libusb* exists).
|
76 |
|
|
CFLAGS = -g -O2 -Wall
|
77 |
|
|
CC = gcc
|
78 |
|
|
LIBS = -L. -L/usr/local/lib -lpthread -lrt
|
79 |
|
|
INCLUDEDIRS = -I/usr/local/include/
|
80 |
|
|
# We don't have a support for parallel cables on FreeBSD yet.
|
81 |
|
|
SUPPORT_PARALLEL_CABLES=false
|
82 |
|
|
endif
|
83 |
|
|
|
84 |
|
|
ifeq ($(SUPPORT_LEGACY),true)
|
85 |
|
|
CFLAGS += -D__LEGACY__
|
86 |
|
|
endif
|
87 |
|
|
|
88 |
|
|
ifeq ($(USE_HISPEED),true)
|
89 |
|
|
CFLAGS += -DADBG_OPT_HISPEED
|
90 |
|
|
endif
|
91 |
|
|
|
92 |
|
|
ifeq ($(JSP_MULTI_DEVICE_CHAIN),true)
|
93 |
|
|
CFLAGS += -DENABLE_JSP_MULTI
|
94 |
|
|
endif
|
95 |
|
|
|
96 |
|
|
ifeq ($(JSP_OPTIMIZE_FOR_USB),true)
|
97 |
|
|
CFLAGS += -DOPTIMIZE_JSP_FOR_USB
|
98 |
|
|
endif
|
99 |
|
|
|
100 |
|
|
ifeq ($(XPC3_LIMIT_SCHEME),sleep_wait)
|
101 |
|
|
CFLAGS += -D__PARALLEL_SLEEP_WAIT__
|
102 |
|
|
else
|
103 |
|
|
ifeq ($(XPC3_LIMIT_SCHEME),timer_wait)
|
104 |
|
|
CFLAGS += -D__PARALLEL_TIMER_BUSY_WAIT__
|
105 |
|
|
else
|
106 |
|
|
# no_wait is the default, nothing to define
|
107 |
|
|
endif
|
108 |
|
|
endif
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
PROGRAMS = adv_jtag_bridge
|
112 |
|
|
|
113 |
|
|
HEADERS = adv_jtag_bridge.h chain_commands.h opencores_tap.h \
|
114 |
|
|
altera_virtual_jtag.h rsp-server.h bsdl.h or32_selftest.c cable_common.h \
|
115 |
|
|
cable_sim.h \
|
116 |
|
|
bsdl_parse.h errcodes.h spr-defs.h except.h adv_dbg_commands.h dbg_api.h \
|
117 |
|
|
legacy_dbg_commands.h utilities.h hardware_monitor.h hwp_server.h
|
118 |
|
|
|
119 |
|
|
SOURCES = adv_jtag_bridge.c rsp-server.c chain_commands.c cable_common.c bsdl.c \
|
120 |
|
|
or32_selftest.c cable_sim.c utilities.c \
|
121 |
|
|
bsdl_parse.c errcodes.c adv_dbg_commands.c dbg_api.c legacy_dbg_commands.c \
|
122 |
|
|
hardware_monitor.c hwp_server.c
|
123 |
|
|
|
124 |
|
|
OBJECTS = adv_jtag_bridge.o rsp-server.o chain_commands.o cable_common.o bsdl.o \
|
125 |
|
|
or32_selftest.o cable_sim.o utilities.o \
|
126 |
|
|
bsdl_parse.o errcodes.o adv_dbg_commands.o dbg_api.o legacy_dbg_commands.o \
|
127 |
|
|
hardware_monitor.o hwp_server.o
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
ifeq ($(SUPPORT_PARALLEL_CABLES),true)
|
131 |
|
|
CFLAGS += -D__SUPPORT_PARALLEL_CABLES__
|
132 |
|
|
HEADERS += cable_parallel.h
|
133 |
|
|
SOURCES += cable_parallel.c
|
134 |
|
|
OBJECTS += cable_parallel.o
|
135 |
|
|
endif
|
136 |
|
|
|
137 |
|
|
ifeq ($(SUPPORT_USB_CABLES),true)
|
138 |
|
|
CFLAGS += -D__SUPPORT_USB_CABLES__
|
139 |
|
|
HEADERS += cable_xpc_dlc9.h cable_usbblaster.h
|
140 |
|
|
SOURCES += cable_xpc_dlc9.c cable_usbblaster.c
|
141 |
|
|
OBJECTS += cable_xpc_dlc9.o cable_usbblaster.o
|
142 |
|
|
|
143 |
|
|
ifeq ($(SUPPORT_FTDI_CABLES),true)
|
144 |
|
|
CFLAGS += -D__SUPPORT_FTDI_CABLES__
|
145 |
|
|
LIBS += -lftdi
|
146 |
|
|
HEADERS += cable_ft2232.h cable_ft245.h
|
147 |
|
|
SOURCES += cable_ft2232.c cable_ft245.c
|
148 |
|
|
OBJECTS += cable_ft2232.o cable_ft245.o
|
149 |
|
|
endif
|
150 |
|
|
|
151 |
|
|
# libusb must follow libftdi in the list of libraries
|
152 |
|
|
LIBS += -lusb
|
153 |
|
|
endif
|
154 |
|
|
|
155 |
|
|
ifeq ($(INCLUDE_JSP_SERVER),true)
|
156 |
|
|
CFLAGS += -DENABLE_JSP
|
157 |
|
|
HEADERS += jsp_server.h
|
158 |
|
|
SOURCES += jsp_server.c
|
159 |
|
|
OBJECTS += jsp_server.o
|
160 |
|
|
endif
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
all: $(PROGRAMS)
|
164 |
|
|
|
165 |
|
|
default: $(PROGRAMS)
|
166 |
|
|
|
167 |
|
|
.c.o:
|
168 |
|
|
$(CC) $(CFLAGS) -c $<
|
169 |
|
|
|
170 |
|
|
adv_jtag_bridge: Makefile $(OBJECTS) $(HEADERS)
|
171 |
|
|
rm -f $@
|
172 |
|
|
$(CC) -o $@ $(CFLAGS) $(INCLUDEDIRS) $(OBJECTS) $(LIBS)
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
install: all
|
176 |
|
|
[ -d $(prefix)/bin ] || mkdir -p $(prefix)/bin
|
177 |
|
|
for p in $(PROGRAMS) ; do \
|
178 |
|
|
/bin/rm -f $(prefix)/bin/$$p; \
|
179 |
|
|
/bin/cp -p $$p $(prefix)/bin/$$p; \
|
180 |
|
|
done
|
181 |
|
|
|
182 |
|
|
clean: Makefile
|
183 |
|
|
rm -f $(PROGRAMS) *.o *~
|