1 |
17 |
wfjm |
# $Id: Makefile 461 2012-04-09 21:17:54Z mueller $
|
2 |
|
|
#
|
3 |
|
|
# Copyright 2011-2012 by Walter F.J. Mueller
|
4 |
|
|
# Code was forked from ixo-jtag.svn.sourceforge.net on 2011-07-17
|
5 |
|
|
#
|
6 |
|
|
# - original copyright and licence disclaimer --------------------------------
|
7 |
|
|
# - Copyright 2007 Kolja Waschk, ixo.de
|
8 |
|
|
# - This code is part of usbjtag. usbjtag is free software;
|
9 |
|
|
#-----------------------------------------------------------------------------
|
10 |
|
|
#
|
11 |
|
|
# This program is free software; you may redistribute and/or modify it under
|
12 |
|
|
# the terms of the GNU General Public License as published by the Free
|
13 |
|
|
# Software Foundation, either version 2, or at your option any later version.
|
14 |
|
|
#
|
15 |
|
|
# This program is distributed in the hope that it will be useful, but
|
16 |
|
|
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
17 |
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
18 |
|
|
# for complete details.
|
19 |
|
|
#-----------------------------------------------------------------------------
|
20 |
|
|
#
|
21 |
|
|
# Makefile for FX2 Firmware on Digilent Nexys2, Nexys3, and Atlys boards
|
22 |
|
|
#
|
23 |
|
|
# Revision History:
|
24 |
|
|
# Date Rev Version Comment
|
25 |
|
|
# 2012-04-09 461 1.5.1 fixed nexys3_jtag_3fifo_ic.ihx rule,used _2fifo code
|
26 |
|
|
# 2012-02-11 457 1.5 re-organize VID/PID and descriptor handling
|
27 |
|
|
# 2012-01-02 448 1.4 add support for sync fifo w/ int. clock (_ic)
|
28 |
|
|
# 2011-12-29 446 1.3 add nexys3 support
|
29 |
|
|
# 2011-07-23 397 1.2 add usb_fifo_init.c
|
30 |
|
|
# 2011-07-17 395 1.1 reorganized to support multiple target/fifo configs
|
31 |
|
|
# 2011-07-17 394 1.0 Initial version (from ixo-jtag/usb_jtag Rev 204)
|
32 |
|
|
#-----------------------------------------------------------------------------
|
33 |
|
|
#
|
34 |
|
|
# handle USB VID/PID
|
35 |
|
|
# - normaly given via the environment variables (as 4 digit hex number)
|
36 |
|
|
# RETRO_FX2_VID
|
37 |
|
|
# RETRO_FX2_PID
|
38 |
|
|
#
|
39 |
|
|
# - in the retro11 project the default is:
|
40 |
|
|
# VID: 16c0 (VOTI)
|
41 |
|
|
# PID: 03ef (VOTI free for internal lab use 1007)
|
42 |
|
|
#
|
43 |
|
|
# !! Important Note on Usage of this USB VID/PID !!
|
44 |
|
|
# This VID/PID is owned by VOTI, a small dutch company. Usage is granted
|
45 |
|
|
# for 'internal lab use only' by VOTI under the conditions:
|
46 |
|
|
# - the gadgets in which you use those PIDs do not leave your desk
|
47 |
|
|
# - you won't complain to VOTI if you get in trouble with duplicate PIDs
|
48 |
|
|
# (for instance because someone else did not follow the previous rule).
|
49 |
|
|
# See also http://www.voti.nl/pids/pidfaq.html
|
50 |
|
|
#
|
51 |
|
|
ifndef RETRO_FX2_VID
|
52 |
|
|
RETRO_FX2_VID = 16c0
|
53 |
|
|
endif
|
54 |
|
|
ifndef RETRO_FX2_PID
|
55 |
|
|
RETRO_FX2_PID = 03ef
|
56 |
|
|
endif
|
57 |
|
|
#
|
58 |
|
|
DEFVIDPID=-DUSE_VID=0x${RETRO_FX2_VID} -DUSE_PID=0x${RETRO_FX2_PID}
|
59 |
|
|
#
|
60 |
|
|
# compiler and assembler flags
|
61 |
|
|
#
|
62 |
|
|
LIBDIR=lib
|
63 |
|
|
LIB=libfx2.lib
|
64 |
|
|
|
65 |
|
|
CC=sdcc
|
66 |
|
|
CFLAGS+=-mmcs51 --no-xinit-opt -I${LIBDIR}
|
67 |
|
|
|
68 |
|
|
AS=asx8051
|
69 |
|
|
ASFLAGS+=-plosgff
|
70 |
|
|
|
71 |
|
|
LDFLAGS=--code-loc 0x0000 --code-size 0x1800
|
72 |
|
|
LDFLAGS+=--xram-loc 0x1800 --xram-size 0x0800
|
73 |
|
|
LDFLAGS+=-Wl '-b USBDESCSEG = 0xE100'
|
74 |
|
|
LDFLAGS+=-L ${LIBDIR}
|
75 |
|
|
#
|
76 |
|
|
# compile rules
|
77 |
|
|
#
|
78 |
|
|
%.rel : %.a51
|
79 |
|
|
$(AS) $(ASFLAGS) $<
|
80 |
|
|
|
81 |
|
|
%.rel : %.c
|
82 |
|
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
83 |
|
|
#
|
84 |
|
|
# link rule
|
85 |
|
|
#
|
86 |
|
|
%.ihx :
|
87 |
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
|
88 |
|
|
#
|
89 |
|
|
# primary target rules
|
90 |
|
|
#
|
91 |
|
|
ALLIHX =nexys2_jtag.ihx
|
92 |
|
|
ALLIHX +=nexys2_jtag_2fifo_as.ihx
|
93 |
|
|
ALLIHX +=nexys2_jtag_3fifo_as.ihx
|
94 |
|
|
ALLIHX +=nexys2_jtag_2fifo_ic.ihx
|
95 |
|
|
ALLIHX +=nexys2_jtag_3fifo_ic.ihx
|
96 |
|
|
ALLIHX +=nexys3_jtag.ihx
|
97 |
|
|
ALLIHX +=nexys3_jtag_2fifo_as.ihx
|
98 |
|
|
ALLIHX +=nexys3_jtag_3fifo_as.ihx
|
99 |
|
|
ALLIHX +=nexys3_jtag_2fifo_ic.ihx
|
100 |
|
|
ALLIHX +=nexys3_jtag_3fifo_ic.ihx
|
101 |
|
|
|
102 |
|
|
.PHONY: all install
|
103 |
|
|
|
104 |
|
|
all: $(ALLIHX)
|
105 |
|
|
|
106 |
|
|
install: $(ALLIHX)
|
107 |
|
|
cp -p $(ALLIHX) ../bin
|
108 |
|
|
#
|
109 |
|
|
# rules to create USB descriptor sources
|
110 |
|
|
#
|
111 |
|
|
CPPA51=cpp -P -x assembler-with-cpp
|
112 |
|
|
|
113 |
|
|
dscr_nexys2_jtag.a51 : dscr_gen.A51
|
114 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS2 $< > $@
|
115 |
|
|
dscr_nexys2_jtag_2fifo_as.a51 : dscr_gen.A51
|
116 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS2 -DUSE_2FIFO -DUSE_AS $< > $@
|
117 |
|
|
dscr_nexys2_jtag_3fifo_as.a51 : dscr_gen.A51
|
118 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS2 -DUSE_3FIFO -DUSE_AS $< > $@
|
119 |
|
|
dscr_nexys2_jtag_2fifo_ic.a51 : dscr_gen.A51
|
120 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS2 -DUSE_2FIFO -DUSE_IC $< > $@
|
121 |
|
|
dscr_nexys2_jtag_3fifo_ic.a51 : dscr_gen.A51
|
122 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS2 -DUSE_3FIFO -DUSE_IC $< > $@
|
123 |
|
|
|
124 |
|
|
dscr_nexys3_jtag.a51 : dscr_gen.A51
|
125 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS3 $< > $@
|
126 |
|
|
dscr_nexys3_jtag_2fifo_as.a51 : dscr_gen.A51
|
127 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS3 -DUSE_2FIFO -DUSE_AS $< > $@
|
128 |
|
|
dscr_nexys3_jtag_3fifo_as.a51 : dscr_gen.A51
|
129 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS3 -DUSE_3FIFO -DUSE_AS $< > $@
|
130 |
|
|
dscr_nexys3_jtag_2fifo_ic.a51 : dscr_gen.A51
|
131 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS3 -DUSE_2FIFO -DUSE_IC $< > $@
|
132 |
|
|
dscr_nexys3_jtag_3fifo_ic.a51 : dscr_gen.A51
|
133 |
|
|
$(CPPA51) $(DEFVIDPID) -DUSE_NEXYS3 -DUSE_3FIFO -DUSE_IC $< > $@
|
134 |
|
|
#
|
135 |
|
|
# rules to create usb_fifo_init variants
|
136 |
|
|
#
|
137 |
|
|
usb_fifo_init_jtag.rel : usb_fifo_init.c
|
138 |
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
139 |
|
|
#
|
140 |
|
|
usb_fifo_init_jtag_2fifo_as.rel : usb_fifo_init.c
|
141 |
|
|
$(CC) -c $(CFLAGS) -DUSE_2FIFO $< -o $@
|
142 |
|
|
usb_fifo_init_jtag_3fifo_as.rel : usb_fifo_init.c
|
143 |
|
|
$(CC) -c $(CFLAGS) -DUSE_3FIFO $< -o $@
|
144 |
|
|
#
|
145 |
|
|
usb_fifo_init_jtag_2fifo_ic.rel : usb_fifo_init.c
|
146 |
|
|
$(CC) -c $(CFLAGS) -DUSE_2FIFO -DUSE_IC30 $< -o $@
|
147 |
|
|
usb_fifo_init_jtag_3fifo_ic.rel : usb_fifo_init.c
|
148 |
|
|
$(CC) -c $(CFLAGS) -DUSE_3FIFO -DUSE_IC30 $< -o $@
|
149 |
|
|
#
|
150 |
|
|
COM_REL=vectors.rel main.rel eeprom.rel startup.rel
|
151 |
|
|
#
|
152 |
|
|
I0_REL=usb_fifo_init_jtag.rel
|
153 |
|
|
#
|
154 |
|
|
IAS2_REL=usb_fifo_init_jtag_2fifo_as.rel
|
155 |
|
|
IAS3_REL=usb_fifo_init_jtag_3fifo_as.rel
|
156 |
|
|
#
|
157 |
|
|
IIC2_REL=usb_fifo_init_jtag_2fifo_ic.rel
|
158 |
|
|
IIC3_REL=usb_fifo_init_jtag_3fifo_ic.rel
|
159 |
|
|
#
|
160 |
|
|
N2_REL=hw_nexys2.rel
|
161 |
|
|
N3_REL=hw_nexys3.rel
|
162 |
|
|
#
|
163 |
|
|
LIB_REL=$(LIBDIR)/$(LIB)
|
164 |
|
|
#
|
165 |
|
|
# rules to compile all code
|
166 |
|
|
#
|
167 |
|
|
$(LIBDIR)/$(LIB) :
|
168 |
|
|
make -C $(LIBDIR)
|
169 |
|
|
|
170 |
|
|
eeprom.rel : eeprom.c eeprom.h
|
171 |
|
|
main.rel : main.c hardware.h eeprom.h
|
172 |
|
|
|
173 |
|
|
$(N2_REL) : hw_nexys2.c hardware.h
|
174 |
|
|
$(N3_REL) : hw_nexys3.c hardware.h
|
175 |
|
|
|
176 |
|
|
#
|
177 |
|
|
# rules to build Nexys2 firmware images
|
178 |
|
|
#
|
179 |
|
|
nexys2_jtag.ihx : $(COM_REL) dscr_nexys2_jtag.rel \
|
180 |
|
|
$(N2_REL) $(I0_REL) $(LIB_REL)
|
181 |
|
|
#
|
182 |
|
|
nexys2_jtag_2fifo_as.ihx : $(COM_REL) dscr_nexys2_jtag_2fifo_as.rel \
|
183 |
|
|
$(N2_REL) $(IAS2_REL) $(LIB_REL)
|
184 |
|
|
nexys2_jtag_3fifo_as.ihx : $(COM_REL) dscr_nexys2_jtag_3fifo_as.rel \
|
185 |
|
|
$(N2_REL) $(IAS3_REL) $(LIB_REL)
|
186 |
|
|
#
|
187 |
|
|
nexys2_jtag_2fifo_ic.ihx : $(COM_REL) dscr_nexys2_jtag_2fifo_ic.rel \
|
188 |
|
|
$(N2_REL) $(IIC2_REL) $(LIB_REL)
|
189 |
|
|
nexys2_jtag_3fifo_ic.ihx : $(COM_REL) dscr_nexys2_jtag_3fifo_ic.rel \
|
190 |
|
|
$(N2_REL) $(IIC3_REL) $(LIB_REL)
|
191 |
|
|
#
|
192 |
|
|
# rules to build Nexys3 firmware images
|
193 |
|
|
#
|
194 |
|
|
nexys3_jtag.ihx : $(COM_REL) dscr_nexys3_jtag.rel \
|
195 |
|
|
$(N3_REL) $(I0_REL) $(LIB_REL)
|
196 |
|
|
#
|
197 |
|
|
nexys3_jtag_2fifo_as.ihx : $(COM_REL) dscr_nexys3_jtag_2fifo_as.rel \
|
198 |
|
|
$(N3_REL) $(IAS2_REL) $(LIB_REL)
|
199 |
|
|
nexys3_jtag_3fifo_as.ihx : $(COM_REL) dscr_nexys3_jtag_3fifo_as.rel \
|
200 |
|
|
$(N3_REL) $(IAS3_REL) $(LIB_REL)
|
201 |
|
|
#
|
202 |
|
|
nexys3_jtag_2fifo_ic.ihx : $(COM_REL) dscr_nexys3_jtag_2fifo_ic.rel \
|
203 |
|
|
$(N3_REL) $(IIC2_REL) $(LIB_REL)
|
204 |
|
|
nexys3_jtag_3fifo_ic.ihx : $(COM_REL) dscr_nexys3_jtag_3fifo_ic.rel \
|
205 |
|
|
$(N3_REL) $(IIC3_REL) $(LIB_REL)
|
206 |
|
|
#
|
207 |
|
|
# cleanup phony's
|
208 |
|
|
#
|
209 |
|
|
.PHONY : clean distclean
|
210 |
|
|
|
211 |
|
|
clean :
|
212 |
|
|
make -C ${LIBDIR} clean
|
213 |
|
|
rm -f *.lst *.asm *.lib *.sym *.rel *.mem *.map *.rst *.lnk
|
214 |
|
|
rm -f dscr_*.a51
|
215 |
|
|
|
216 |
|
|
distclean : clean
|
217 |
|
|
rm -f *.ihx
|
218 |
|
|
|
219 |
|
|
|