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 | endif
|
---|
24 |
|
---|
25 | CC=sdcc
|
---|
26 | CFLAGS+=-mmcs51 --no-xinit-opt -I${LIBDIR} -D${HARDWARE}
|
---|
27 | CFLAGS+=--opt-code-size
|
---|
28 |
|
---|
29 | # added by bram
|
---|
30 | CFLAGS+=--stack-auto
|
---|
31 |
|
---|
32 |
|
---|
33 | AS=asx8051
|
---|
34 | ASFLAGS+=-plosgff
|
---|
35 |
|
---|
36 | LDFLAGS=--code-loc 0x0000 --code-size 0x1800
|
---|
37 | LDFLAGS+=--xram-loc 0x1800 --xram-size 0x0800
|
---|
38 | LDFLAGS+=-Wl '-b USBDESCSEG = 0xE100'
|
---|
39 | LDFLAGS+=-L ${LIBDIR}
|
---|
40 |
|
---|
41 | %.rel : %.a51
|
---|
42 | $(AS) $(ASFLAGS) $<
|
---|
43 |
|
---|
44 | %.rel : %.c
|
---|
45 | $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
---|
46 |
|
---|
47 | default: usbjtag.hex
|
---|
48 |
|
---|
49 | usbjtag.hex: vectors.rel usbjtag.rel dscr.rel eeprom.rel ${HARDWARE}.rel startup.rel ${LIBDIR}/${LIB}
|
---|
50 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+
|
---|
51 | packihx $@ > .tmp.hex
|
---|
52 | rm $@
|
---|
53 | mv .tmp.hex $@
|
---|
54 |
|
---|
55 | ${LIBDIR}/${LIB}:
|
---|
56 | make -C ${LIBDIR}
|
---|
57 |
|
---|
58 | .PHONY: boot
|
---|
59 | boot: usbjtag.hex
|
---|
60 | -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I usbjtag.hex -t fx2
|
---|
61 | -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I usbjtag.hex -t fx2
|
---|
62 | -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I usbjtag.hex -t fx2
|
---|
63 |
|
---|
64 | REF=/home/kawk/work/xilinx/xtern/xusbdfwu/xusbdfwu-1025.hex
|
---|
65 |
|
---|
66 | .PHONY: ref
|
---|
67 | ref:
|
---|
68 | -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I ${REF} -t fx2
|
---|
69 | -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I ${REF} -t fx2
|
---|
70 | -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I ${REF} -t fx2
|
---|
71 |
|
---|
72 | dscr.rel: dscr.a51
|
---|
73 | eeprom.rel: eeprom.c eeprom.h
|
---|
74 | usbjtag.rel: usbjtag.c hardware.h eeprom.h
|
---|
75 | ${HARDWARE}.rel: ${HARDWARE}.c hardware.h
|
---|
76 |
|
---|
77 | .PHONY: clean distclean
|
---|
78 |
|
---|
79 | clean:
|
---|
80 | make -C ${LIBDIR} clean
|
---|
81 | rm -f *.lst *.asm *.lib *.sym *.rel *.mem *.map *.rst *.lnk *.hex
|
---|
82 |
|
---|
83 | distclean: clean
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|