Houston, we have a trunk.
[debian/gnuradio] / usrp / firmware / src / usrp2 / Makefile.am
1 #
2 # Copyright 2003,2006 Free Software Foundation, Inc.
3
4 # This file is part of GNU Radio
5
6 # GNU Radio is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # GNU Radio is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Radio; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
20
21
22 firmware2dir = $(prefix)/share/usrp/rev2
23 firmware2_DATA = std.ihx
24
25 # we put the same stuff in the rev4 directory
26 firmware4dir = $(prefix)/share/usrp/rev4
27 firmware4_DATA = std.ihx
28
29 EXTRA_DIST =                    \
30         edit-gpif               \
31         _startup.a51            \
32         blink_leds.c            \
33         board_specific.c        \
34         check_mdelay.c          \
35         check_udelay.c          \
36         eeprom_boot.a51         \
37         eeprom_init.c           \
38         eeprom_io.c             \
39         eeprom_io.h             \
40         fpga_load.c             \
41         fpga_rev2.c             \
42         fpga_rev2.h             \
43         gpif.c                  \
44         init_gpif.c             \
45         spi.c                   \
46         spi.h                   \
47         usb_descriptors.a51     \
48         usrp_common.c           \
49         usrp_common.h           \
50         usrp_gpif.c             \
51         usrp_main.c             \
52         usrp_rev2_regs.h        \
53         vectors.a51             
54
55
56 DEFINES=-DHAVE_USRP2
57 INCLUDES=-I$(top_srcdir)/usrp/firmware/include -I$(top_srcdir)/usrp/firmware/src/usrp2 -I$(top_srcdir)/usrp/firmware/src/common -I./ -I../common
58
59 # with EA = 0, the FX2 implements a portion of the 8051 "external memory"
60 # on chip.  This memory is mapped like this:
61 #
62 # The bottom 8K of memory (0x0000 - 0x1fff) is used for both data and
63 # code accesses.  There's also 512 bytes for data only from 0xe000 - 0xe1ff.
64 #
65 # We tell the linker to start the xdata segment at 0x1800, 6K up from
66 # the bottom.
67
68 MEMOPTS = --code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 \
69  -Wl '-b USBDESCSEG = 0xE000'
70
71 LIBOPTS = -L ../../lib libfx2.lib
72 LIBDEP = ../../lib/libfx2.lib
73
74 LINKOPTS = $(MEMOPTS) $(LIBOPTS)
75
76 EXECUTABLES =                   \
77         std.ihx                 \
78         blink_leds.ihx          \
79         check_mdelay.ihx        \
80         check_udelay.ihx        \
81         eeprom_boot.ihx         
82
83 STARTUP = _startup.rel
84
85 noinst_SCRIPTS =                \
86         burn-usrp2-eeprom       \
87         burn-usrp4-eeprom
88
89
90 %.rel : %.c
91         $(XCC) $(INCLUDES) $(DEFINES) \
92                 -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
93
94 %.rel : %.a51
95         test -f `basename '$<'` || ln -s '$<' .
96         test -f ../common/`basename '$<'` -o \
97                 \! -f `dirname '$<'`/../common/`basename '$<'` \
98                 || ln -s `dirname '$<'`/../common/`basename '$<'` ../common/.
99         $(XAS) `basename '$<'`
100
101
102 EEPROM_BOOT_OBJS = eeprom_boot.rel eeprom_init.rel $(STARTUP)
103
104 eeprom_boot.ihx: $(EEPROM_BOOT_OBJS) $(LIBDEP)
105         $(XCC) $(LINKOPTS) -o $@ $(EEPROM_BOOT_OBJS)
106
107 burn-usrp2-eeprom: eeprom_boot.ihx
108         $(srcdir)/../common/build_eeprom.py -r2 $< > $@
109         chmod +x $@
110
111 burn-usrp4-eeprom: eeprom_boot.ihx
112         $(srcdir)/../common/build_eeprom.py -r4 $< > $@
113         chmod +x $@
114
115
116 BLINK_LEDS_OBJS = blink_leds.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP)
117
118 blink_leds.ihx: $(BLINK_LEDS_OBJS) $(LIBDEP)
119         $(XCC) $(LINKOPTS) -o $@ $(BLINK_LEDS_OBJS)
120
121
122 CHECK_MDELAY_OBJS = check_mdelay.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP)
123
124 check_mdelay.ihx: $(CHECK_MDELAY_OBJS) $(LIBDEP)
125         $(XCC) $(LINKOPTS) -o $@ $(CHECK_MDELAY_OBJS)
126
127
128
129 CHECK_UDELAY_OBJS = check_udelay.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP)
130
131 check_udelay.ihx: $(CHECK_UDELAY_OBJS) $(LIBDEP)
132         $(XCC) $(LINKOPTS) -o $@ $(CHECK_UDELAY_OBJS)
133
134
135
136 USRP_OBJS = \
137         vectors.rel                                             \
138         usrp_main.rel usrp_common.rel board_specific.rel        \
139         fpga_load.rel fpga_rev2.rel init_gpif.rel usrp_gpif.rel \
140         usb_descriptors.rel spi.rel eeprom_io.rel $(STARTUP)
141
142 std.ihx: $(USRP_OBJS) $(LIBDEP)
143         $(XCC) $(LINKOPTS) -o $@ $(USRP_OBJS)
144
145 CLEANFILES =            \
146         *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib     \
147         usrp_gpif.c usrp_gpif_inline.h \
148         burn-usrp2-eeprom       \
149         burn-usrp4-eeprom
150
151 DISTCLEANFILES =        \
152         *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib
153
154 # build gpif stuff
155
156 all: usrp_gpif.c
157
158 usrp_gpif.c usrp_gpif_inline.h : gpif.c
159         srcdir=$(srcdir) $(srcdir)/edit-gpif $(srcdir)/gpif.c usrp_gpif.c usrp_gpif_inline.h
160
161
162 # dependencies
163
164 usrp_main.rel: usrp_gpif_inline.h
165 #usrp_main.rel: fpga.h usrp_common.h ../../include/usrp_commands.h usrp_gpif_inline.h  ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h
166 #usrp_common.rel: usrp_common.h ../../include/usrp_commands.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h
167 #fpga.rel: usrp_common.h ../../include/usrp_commands.h fpga.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h
168 #init_gpif.rel: usrp_common.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h