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
28 CC=msp430-gcc -Wall -Os -g -mmcu=$(mcu) -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms $(CCEXTRA)
30 # Available Applications
31 # ======================
32 # Below is a list of available applications and their descriptions.
35 # None have made it to production grade quality
38 # monitor -- Basic monitor
39 # spi -- Turns GF into USB-to-SPI adapter
40 # jtag -- Low level JTAG (needed by all other JTAG code)
41 # sbw -- Makes JTAG Spy-by-wire multiplexable
44 # jtag430 -- 16-bit MSP430 JTAG
45 # jtag430x2 -- 20-bit MSP430 JTAG
49 # i2c -- Turns GF into USB-to-i2c adapter
50 # jtagarm7 -- ARM7TDMI JTAG
52 # jtagxscale -- XScale JTAG
55 # chipcon -- Chipcon radio 8051 debugging
57 # pic -- PIC24H/dsPIC33F debugger
58 # adc -- ADC10 (still specific to x2274, GoodFET32)
61 # nrf -- Nordic RF SPI
62 # ccspi -- Chipcon SPI
65 # glitch -- Glitch research tool
66 # smartcard -- Smartcard IO
72 # This is what you need to customize to specify which apps you want in your
73 # firmware. The "config" variable is just a space-delimited list of apps you
74 # want included. The makefile will take the list of apps and include all of
75 # the proper code needed to build your desired firmware.
81 # config = monitor jtag
84 # config = monitor chipcon ccspi
87 # config = monitor glitch
90 # config = monitor jtagxscale
93 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
96 config ?= monitor chipcon ccspi nrf spi jtagarm7 jtag430 jtag430x2 avr
98 # Build the needed list of app and lib object files from the config
100 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o
104 # include monitor app
105 ifeq ($(filter monitor, $(config)), monitor)
106 apps+= apps/monitor/monitor.o
111 ifeq ($(filter spi, $(config)), spi)
112 apps+= apps/spi/spi.o
116 # include base jtag if they specified it explicitly
117 ifeq ($(filter jtag, $(config)), jtag)
118 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
119 apps+= apps/jtag/jtag.o
124 # include the sbw defs if they specified it
125 ifeq ($(filter sbw, $(config)), sbw)
126 # if they only specify sbw, include jtag
127 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
128 apps+= apps/jtag/jtag.o
131 apps+= apps/jtag/sbw.o
135 # include jtag430 app
136 ifeq ($(filter jtag430, $(config)), jtag430)
137 # add in base jtag code if not already
138 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
139 apps+= apps/jtag/jtag.o
142 # add in the jtag430asm code if needed
143 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
144 apps+= apps/jtag/jtag430asm.o
146 apps+= apps/jtag/jtag430.o
150 # include jtag430x2 app
151 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
152 # add in base jtag code if not already
153 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
154 apps+= apps/jtag/jtag.o
157 # add in the jtag430asm code if needed
158 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
159 libs+= apps/jtag/jtag430asm.o
161 #add in the jtag430 app if not already
162 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
163 apps+= apps/jtag/jtag430.o
166 apps+= apps/jtag/jtag430x2.o
171 ifeq ($(filter i2c, $(config)), i2c)
172 apps+= apps/i2c/i2c.o
176 # include jtagarm7 app
177 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
178 # add in base jtag code if not already
179 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
180 apps+= apps/jtag/jtag.o
183 apps+= apps/jtag/jtagarm7.o
187 # include jtagarm7tdmi app
188 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
189 # add in base jtag code if not already
190 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
191 #apps+= apps/jtag/jtag.o
194 #apps+= apps/jtag/jtagarm7tdmi.o
195 #hdrs+= jtagarm7tdmi.h
199 ifeq ($(filter ejtag, $(config)), ejtag)
200 # add in base jtag code if not already
201 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
202 apps+= apps/jtag/jtag.o
205 apps+= apps/jtag/ejtag.o
209 # include jtagxscale app
210 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
211 # add in base jtag code if not already
212 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
213 apps+= apps/jtag/jtag.o
216 apps+= apps/jtag/jtagxscale.o
220 # include chipcon app
221 ifeq ($(filter chipcon, $(config)), chipcon)
222 apps+= apps/chipcon/chipcon.o
227 ifeq ($(filter avr, $(config)), avr)
228 apps+= apps/avr/avr.o
233 ifeq ($(filter pic, $(config)), pic)
234 apps+= apps/pic/pic.o
239 ifeq ($(filter adc, $(config)), adc)
240 ifeq ($(mcu), msp430x2274)
241 apps+= apps/adc/adc.o
244 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
248 # include chipcon radio spi app
249 ifeq ($(filter ccspi, $(config)), ccspi)
250 apps+= apps/radios/ccspi.o
255 ifeq ($(filter nrf, $(config)), nrf)
256 apps+= apps/radios/nrf.o
261 ifeq ($(filter glitch, $(config)), glitch)
262 apps+= apps/glitch/glitch.o
266 # include smartcard app
267 ifeq ($(filter smartcard, $(config)), smartcard)
268 apps+= apps/smartcard/smartcard.o
273 ifeq ($(filter ps2, $(config)), ps2)
274 apps+= apps/plugins/ps2.o
291 cp platforms/$(platform).h include/config.h
300 ../client/goodfet.msp430 test
303 $(BSL) -e -p $(app).hex
305 $(BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
307 $(BSL) -P $(app).hex -v $(app).hex
310 $(app).c: config builddate appsfiles err
311 $(app): $(libs) $(apps)
313 msp430-objcopy goodfet -O ihex goodfet.hex
315 msp430-objdump -D -m msp430 $(app).hex | m4s init
319 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
323 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/