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 -fno-strict-aliasing -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
53 # openocd -- OpenOCD bitbang device
56 # chipcon -- Chipcon radio 8051 debugging
58 # pic -- PIC24H/dsPIC33F debugger
59 # adc -- ADC10 (still specific to x2274, GoodFET32)
62 # nrf -- Nordic RF SPI
63 # ccspi -- Chipcon SPI
66 # glitch -- Glitch research tool
67 # smartcard -- Smartcard IO
73 # This is what you need to customize to specify which apps you want in your
74 # firmware. The "config" variable is just a space-delimited list of apps you
75 # want included. The makefile will take the list of apps and include all of
76 # the proper code needed to build your desired firmware.
82 # config = monitor jtag
85 # config = monitor chipcon ccspi
88 # config = monitor glitch
91 # config = monitor jtagxscale
93 # OpenOCD bit-bang device
94 #config = monitor openocd
97 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
100 config ?= monitor chipcon ccspi nrf spi jtagarm7 jtag430 jtag430x2 avr openocd
102 # Build the needed list of app and lib object files from the config
104 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o
108 # include monitor app
109 ifeq ($(filter monitor, $(config)), monitor)
110 apps+= apps/monitor/monitor.o
115 ifeq ($(filter spi, $(config)), spi)
116 apps+= apps/spi/spi.o
120 # include base jtag if they specified it explicitly
121 ifeq ($(filter jtag, $(config)), jtag)
122 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
123 apps+= apps/jtag/jtag.o
128 # include the sbw defs if they specified it
129 ifeq ($(filter sbw, $(config)), sbw)
130 # if they only specify sbw, include jtag
131 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
132 apps+= apps/jtag/jtag.o
135 apps+= apps/jtag/sbw.o
139 # include jtag430 app
140 ifeq ($(filter jtag430, $(config)), jtag430)
141 # add in base jtag code if not already
142 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
143 apps+= apps/jtag/jtag.o
146 # add in the jtag430asm code if needed
147 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
148 apps+= apps/jtag/jtag430asm.o
150 apps+= apps/jtag/jtag430.o
154 # include jtag430x2 app
155 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
156 # add in base jtag code if not already
157 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
158 apps+= apps/jtag/jtag.o
161 # add in the jtag430asm code if needed
162 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
163 libs+= apps/jtag/jtag430asm.o
165 #add in the jtag430 app if not already
166 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
167 apps+= apps/jtag/jtag430.o
170 apps+= apps/jtag/jtag430x2.o
175 ifeq ($(filter i2c, $(config)), i2c)
176 apps+= apps/i2c/i2c.o
180 # include jtagarm7 app
181 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
182 # add in base jtag code if not already
183 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
184 apps+= apps/jtag/jtag.o
187 apps+= apps/jtag/jtagarm7.o
191 # include jtagarm7tdmi app
192 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
193 # add in base jtag code if not already
194 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
195 #apps+= apps/jtag/jtag.o
198 #apps+= apps/jtag/jtagarm7tdmi.o
199 #hdrs+= jtagarm7tdmi.h
203 ifeq ($(filter ejtag, $(config)), ejtag)
204 # add in base jtag code if not already
205 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
206 apps+= apps/jtag/jtag.o
209 apps+= apps/jtag/ejtag.o
213 # include jtagxscale app
214 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
215 # add in base jtag code if not already
216 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
217 apps+= apps/jtag/jtag.o
220 apps+= apps/jtag/jtagxscale.o
224 # include openocd app
225 ifeq ($(filter openocd, $(config)), openocd)
226 # add in base jtag code if not already
227 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
228 apps+= apps/jtag/jtag.o
231 apps+= apps/jtag/openocd.o
235 # include chipcon app
236 ifeq ($(filter chipcon, $(config)), chipcon)
237 apps+= apps/chipcon/chipcon.o
242 ifeq ($(filter avr, $(config)), avr)
243 apps+= apps/avr/avr.o
248 ifeq ($(filter pic, $(config)), pic)
249 apps+= apps/pic/pic.o
254 ifeq ($(filter adc, $(config)), adc)
255 ifeq ($(mcu), msp430x2274)
256 apps+= apps/adc/adc.o
259 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
263 # include chipcon radio spi app
264 ifeq ($(filter ccspi, $(config)), ccspi)
265 apps+= apps/radios/ccspi.o
270 ifeq ($(filter nrf, $(config)), nrf)
271 apps+= apps/radios/nrf.o
276 ifeq ($(filter glitch, $(config)), glitch)
277 apps+= apps/glitch/glitch.o
281 # include smartcard app
282 ifeq ($(filter smartcard, $(config)), smartcard)
283 apps+= apps/smartcard/smartcard.o
288 ifeq ($(filter ps2, $(config)), ps2)
289 apps+= apps/plugins/ps2.o
306 cp platforms/$(platform).h include/config.h
315 ../client/goodfet.msp430 test
318 $(BSL) -e -p $(app).hex
320 $(BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
322 $(BSL) -P $(app).hex -v $(app).hex
325 $(app).c: config builddate appsfiles err
326 $(app): $(libs) $(apps)
328 msp430-objcopy goodfet -O ihex goodfet.hex
330 msp430-objdump -D -m msp430 $(app).hex | m4s init
334 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
338 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/