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.
21 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
22 #GCCINC=-T ldscripts/161x.x
23 GCCINC=-T ldscripts/$(mcu).x
26 CC=msp430-gcc -Wall -Os -g -mmcu=$(mcu) -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include $(CCEXTRA)
28 # Available Applications
29 # ======================
30 # Below is a list of available applications and their descriptions.
33 # None have made it to production grade quality
36 # monitor -- Basic monitor
37 # spi -- Turns GF into USB-to-SPI adapter
38 # jtag -- Low level JTAG (needed by all other JTAG code)
39 # sbw -- Makes JTAG Spy-by-wire multiplexable
42 # jtag430 -- 16-bit MSP430 JTAG
43 # jtag430x2 -- 20-bit MSP430 JTAG
47 # i2c -- Turns GF into USB-to-i2c adapter
48 # jtagarm7 -- ARM7TDMI JTAG
50 # jtagxscale -- XScale JTAG
53 # chipcon -- Chipcon radio 8051 debugging
55 # dspic -- PIC24H/dsPIC33F debugger
56 # adc -- ADC10 (still specific to x2274, GoodFET32)
59 # nrf -- Nordic RF SPI
60 # ccspi -- Chipcon SPI
63 # glitch -- Glitch research tool
64 # smartcard -- Smartcard IO
69 # This is what you need to customize to specify which apps you want in your
70 # firmware. The "config" variable is just a space-delimited list of apps you
71 # want included. The makefile will take the list of apps and include all of
72 # the proper code needed to build your desired firmware.
78 # config = monitor jtag
81 # config = monitor chipcon ccspi
84 # config = monitor glitch
87 # config = monitor jtagxscale
90 config = monitor sbw glitch chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
93 # Build the needed list of app and lib object files from the config
95 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o
98 ifeq ($(filter monitor, $(config)), monitor)
99 apps+= apps/monitor/monitor.o
103 ifeq ($(filter spi, $(config)), spi)
104 apps+= apps/spi/spi.o
107 # include base jtag if they specified it explicitly
108 ifeq ($(filter jtag, $(config)), jtag)
109 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
110 apps+= apps/jtag/jtag.o
114 # include the sbw defs if they specified it
115 ifeq ($(filter sbw, $(config)), sbw)
116 # if they only specify sbw, include jtag
117 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
118 apps+= apps/jtag/jtag.o
120 apps+= apps/jtag/sbw.o
123 # include jtag430 app
124 ifeq ($(filter jtag430, $(config)), jtag430)
125 # add in base jtag code if not already
126 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
127 apps+= apps/jtag/jtag.o
129 # add in the jtag430asm code if needed
130 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
131 apps+= apps/jtag/jtag430asm.o
133 apps+= apps/jtag/jtag430.o
136 # include jtag430x2 app
137 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
138 # add in base jtag code if not already
139 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
140 apps+= apps/jtag/jtag.o
142 # add in the jtag430asm code if needed
143 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
144 libs+= apps/jtag/jtag430asm.o
146 apps+= apps/jtag/jtag430x2.o
150 ifeq ($(filter i2c, $(config)), i2c)
151 apps+= apps/i2c/i2c.o
154 # include jtagarm7 app
155 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
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
160 apps+= apps/jtag/jtagarm7.o
163 # include jtagarm7tdmi app
164 ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
165 # add in base jtag code if not already
166 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
167 apps+= apps/jtag/jtag.o
169 apps+= apps/jtag/jtagarm7tdmi.o
173 ifeq ($(filter ejtag, $(config)), ejtag)
174 # add in base jtag code if not already
175 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
176 apps+= apps/jtag/jtag.o
178 apps+= apps/jtag/ejtag.o
181 # include jtagxscale app
182 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
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
187 apps+= apps/jtag/jtagxscale.o
190 # include chipcon app
191 ifeq ($(filter chipcon, $(config)), chipcon)
192 apps+= apps/chipcon/chipcon.o
196 ifeq ($(filter avr, $(config)), avr)
197 apps+= apps/avr/avr.o
201 ifeq ($(filter pic, $(config)), pic)
202 apps+= apps/pic/dspic33f.o
206 ifeq ($(filter adc, $(config)), adc)
207 ifeq ($(mcu), msp430x2274)
208 apps+= apps/pic/dspic33f.o
210 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
217 # include chipcon radio spi app
218 ifeq ($(filter ccspi, $(config)), ccspi)
219 apps+= apps/radios/ccspi.o
223 ifeq ($(filter nrf, $(config)), nrf)
224 apps+= apps/radios/nrf.o
228 ifeq ($(filter glitch, $(config)), glitch)
229 apps+= apps/glitch/glitch.o
232 # include smartcard app
233 ifeq ($(filter smartcard, $(config)), smartcard)
234 apps+= apps/smartcard/smartcard.o
251 cp platforms/$(platform).h include/config.h
255 ../client/goodfet.msp430 test
258 $(BSL) -e -p $(app).hex
259 ls info.txt && $(BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
261 $(BSL) -P $(app).hex -v $(app).hex
265 $(app): $(app).c $(libs) $(apps)
267 msp430-objcopy goodfet -O ihex goodfet.hex
269 msp430-objdump -D -m msp430 $(app).hex | m4s init
273 rm -f $(app) $(app).hex $(libs) $(apps) include/config.h
277 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/