1 | #-----------------------------------------------------------------------------
|
---|
2 | # Makefile for usb_jtag FX2 firmware
|
---|
3 | #-----------------------------------------------------------------------------
|
---|
4 | # Copyright 2007 Kolja Waschk, ixo.de
|
---|
5 | #-----------------------------------------------------------------------------
|
---|
6 | # This code is part of usbjtag. usbjtag is free software; you can redistribute
|
---|
7 | # it and/or modify it under the terms of the GNU General Public License as
|
---|
8 | # published by the Free Software Foundation; either version 2 of the License,
|
---|
9 | # or (at your option) any later version. usbjtag is distributed in the hope
|
---|
10 | # that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
---|
11 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | # GNU General Public License for more details. You should have received a
|
---|
13 | # copy of the GNU General Public License along with this program in the file
|
---|
14 | # COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
---|
15 | # St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
16 | #-----------------------------------------------------------------------------
|
---|
17 |
|
---|
18 | LIBDIR=fx2
|
---|
19 | LIB=libfx2.lib
|
---|
20 |
|
---|
21 | ifeq (${HARDWARE},)
|
---|
22 | #HARDWARE=hw_basic
|
---|
23 | HARDWARE=hw_fynu
|
---|
24 | endif
|
---|
25 |
|
---|
26 | CC=sdcc
|
---|
27 | CFLAGS+=-mmcs51 --no-xinit-opt -I${LIBDIR} -D${HARDWARE}
|
---|
28 | CFLAGS+=--opt-code-size
|
---|
29 |
|
---|
30 | # added by bram
|
---|
31 | CFLAGS+=--stack-auto
|
---|
32 |
|
---|
33 |
|
---|
34 | AS=asx8051
|
---|
35 | ASFLAGS+=-plosgff
|
---|
36 |
|
---|
37 | LDFLAGS=--code-loc 0x0000 --code-size 0x1800
|
---|
38 | LDFLAGS+=--xram-loc 0x1800 --xram-size 0x0800
|
---|
39 | LDFLAGS+=-Wl '-b USBDESCSEG = 0xE100'
|
---|
40 | LDFLAGS+=-L ${LIBDIR}
|
---|
41 |
|
---|
42 | %.rel : %.a51
|
---|
43 | $(AS) $(ASFLAGS) $<
|
---|
44 |
|
---|
45 | %.rel : %.c
|
---|
46 | $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
---|
47 |
|
---|
48 | %.iic : %.hex
|
---|
49 | ./hex2bix -ir -f 0xC2 -m 0xF000 -c 0x1 -o $@ $<
|
---|
50 |
|
---|
51 | default: usbjtag.iic
|
---|
52 |
|
---|
53 | usbjtag.hex: vectors.rel spi.rel usbjtag.rel dscr.rel eeprom.rel ${HARDWARE}.rel startup.rel ${LIBDIR}/${LIB}
|
---|
54 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
|
---|
55 | packihx $@ > .tmp.hex
|
---|
56 | rm $@
|
---|
57 | mv .tmp.hex $@
|
---|
58 |
|
---|
59 | ${LIBDIR}/${LIB}:
|
---|
60 | make -C ${LIBDIR}
|
---|
61 |
|
---|
62 | .PHONY: boot
|
---|
63 | boot: usbjtag.hex
|
---|
64 | -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I usbjtag.hex -t fx2
|
---|
65 | -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I usbjtag.hex -t fx2
|
---|
66 | -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I usbjtag.hex -t fx2
|
---|
67 |
|
---|
68 | REF=/home/kawk/work/xilinx/xtern/xusbdfwu/xusbdfwu-1025.hex
|
---|
69 |
|
---|
70 | .PHONY: ref
|
---|
71 | ref:
|
---|
72 | -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I ${REF} -t fx2
|
---|
73 | -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I ${REF} -t fx2
|
---|
74 | -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I ${REF} -t fx2
|
---|
75 |
|
---|
76 | dscr.rel: dscr.a51
|
---|
77 | eeprom.rel: eeprom.c eeprom.h
|
---|
78 | usbjtag.rel: usbjtag.c hardware.h eeprom.h
|
---|
79 | ${HARDWARE}.rel: ${HARDWARE}.c hardware.h
|
---|
80 |
|
---|
81 | .PHONY: clean distclean
|
---|
82 |
|
---|
83 | clean:
|
---|
84 | make -C ${LIBDIR} clean
|
---|
85 | rm -f *.lst *.asm *.lib *.sym *.rel *.mem *.map *.rst *.lnk *.ihx *.iic
|
---|
86 |
|
---|
87 | distclean: clean
|
---|
88 |
|
---|
89 |
|
---|
90 |
|
---|