5 #For tos-bsl, use --invert-reset --invert-test
6 BSL?=goodfet.bsl --speed=38400
8 #One of these should be defined explicitly.
9 #Default removed because of confusion.
23 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
24 #GCCINC=-T ldscripts/161x.x
25 GCCINC=-T ldscripts/$(mcu).x
27 CCEXTRA?= -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms
29 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
31 # Available Applications
32 # ======================
33 # Below is a list of available applications and their descriptions.
36 # None have made it to production grade quality
39 # monitor -- Basic monitor
40 # spi -- Turns GF into USB-to-SPI adapter
41 # jtag -- Low level JTAG (needed by all other JTAG code)
42 # sbw -- Makes JTAG Spy-by-wire multiplexable
45 # jtag430 -- 16-bit MSP430 JTAG
46 # jtag430x2 -- 20-bit MSP430 JTAG
50 # i2c -- Turns GF into USB-to-i2c adapter
51 # jtagarm7 -- ARM7TDMI JTAG
53 # jtagxscale -- XScale JTAG
54 # openocd -- OpenOCD bitbang device
57 # chipcon -- Chipcon radio 8051 debugging
59 # pic -- PIC24H/dsPIC33F debugger
60 # adc -- ADC10 (still specific to x2274, GoodFET32)
63 # nrf -- Nordic RF SPI
64 # ccspi -- Chipcon SPI
67 # glitch -- Glitch research tool
68 # smartcard -- Smartcard IO
74 # This is what you need to customize to specify which apps you want in your
75 # firmware. The "config" variable is just a space-delimited list of apps you
76 # want included. The makefile will take the list of apps and include all of
77 # the proper code needed to build your desired firmware.
83 # config = monitor jtag
86 # config = monitor chipcon ccspi
89 # config = monitor glitch
92 # config = monitor jtagxscale
94 # OpenOCD bit-bang device
95 #config = monitor openocd
98 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
101 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
103 # Build the needed list of app and lib object files from the config
105 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o
109 # include monitor app
110 ifeq ($(filter monitor, $(config)), monitor)
111 apps+= apps/monitor/monitor.o
116 ifeq ($(filter spi, $(config)), spi)
117 apps+= apps/spi/spi.o
121 # include base jtag if they specified it explicitly
122 ifeq ($(filter jtag, $(config)), jtag)
123 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
124 apps+= apps/jtag/jtag.o
129 # include the sbw defs if they specified it
130 ifeq ($(filter sbw, $(config)), sbw)
131 # if they only specify sbw, include jtag
132 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
133 apps+= apps/jtag/jtag.o
136 apps+= apps/jtag/sbw.o
140 # include jtag430 app
141 ifeq ($(filter jtag430, $(config)), jtag430)
142 # add in base jtag code if not already
143 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
144 apps+= apps/jtag/jtag.o
147 # add in the jtag430asm code if needed
148 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
149 apps+= apps/jtag/jtag430asm.o
151 apps+= apps/jtag/jtag430.o
155 # include jtag430x2 app
156 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
157 # add in base jtag code if not already
158 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
159 apps+= apps/jtag/jtag.o
162 # add in the jtag430asm code if needed
163 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
164 libs+= apps/jtag/jtag430asm.o
166 #add in the jtag430 app if not already
167 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
168 apps+= apps/jtag/jtag430.o
171 apps+= apps/jtag/jtag430x2.o
176 ifeq ($(filter i2c, $(config)), i2c)
177 apps+= apps/i2c/i2c.o
181 # include jtagarm7 app
182 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
183 # add in base jtag code if not already
184 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
185 apps+= apps/jtag/jtag.o
188 apps+= apps/jtag/jtagarm7.o
192 # include jtagarm7tdmi app
193 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
194 # add in base jtag code if not already
195 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
196 #apps+= apps/jtag/jtag.o
199 #apps+= apps/jtag/jtagarm7tdmi.o
200 #hdrs+= jtagarm7tdmi.h
204 ifeq ($(filter ejtag, $(config)), ejtag)
205 # add in base jtag code if not already
206 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
207 apps+= apps/jtag/jtag.o
210 apps+= apps/jtag/ejtag.o
214 # include jtagxscale app
215 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
216 # add in base jtag code if not already
217 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
218 apps+= apps/jtag/jtag.o
221 apps+= apps/jtag/jtagxscale.o
225 # include openocd app
226 ifeq ($(filter openocd, $(config)), openocd)
227 # add in base jtag code if not already
228 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
229 apps+= apps/jtag/jtag.o
232 apps+= apps/jtag/openocd.o
236 # include chipcon app
237 ifeq ($(filter chipcon, $(config)), chipcon)
238 apps+= apps/chipcon/chipcon.o
243 ifeq ($(filter avr, $(config)), avr)
244 apps+= apps/avr/avr.o
249 ifeq ($(filter pic, $(config)), pic)
250 apps+= apps/pic/pic.o
255 ifeq ($(filter adc, $(config)), adc)
256 ifeq ($(mcu), msp430x2274)
257 apps+= apps/adc/adc.o
260 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
264 # include chipcon radio spi app
265 ifeq ($(filter ccspi, $(config)), ccspi)
266 apps+= apps/radios/ccspi.o
271 ifeq ($(filter nrf, $(config)), nrf)
272 apps+= apps/radios/nrf.o
277 ifeq ($(filter glitch, $(config)), glitch)
278 apps+= apps/glitch/glitch.o
282 # include smartcard app
283 ifeq ($(filter smartcard, $(config)), smartcard)
284 apps+= apps/smartcard/smartcard.o
289 ifeq ($(filter ps2, $(config)), ps2)
290 apps+= apps/plugins/ps2.o
307 cp platforms/$(platform).h include/config.h
316 ../client/goodfet.msp430 test
319 $(BSL) -e -p $(app).hex
321 $(BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
323 $(BSL) -P $(app).hex -v $(app).hex
326 $(app).c: config builddate appsfiles err
327 $(app): $(libs) $(apps)
329 msp430-objcopy goodfet -O ihex goodfet.hex
331 msp430-objdump -D -m msp430 $(app).hex | m4s init
335 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
339 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/