GoodFET32 in firmware.
[goodfet] / firmware / config.mk
1 ##################################
2 ## These are production boards.
3 ##################################
4
5 #Unset by default, but can be explicitly overwritten.
6 config ?= undef
7
8 ifneq (,$(findstring $(board),apimote1 apimote))
9 mcu ?= msp430f2618
10 platform := apimote
11 config := monitor spi ccspi
12 MSP430BSL?=goodfet.bsl --speed=38400 --swap-reset-test
13 CFLAGS += -Duseuart1 -Dapimote
14 endif
15
16 ifneq (,$(findstring $(board),goodthopter01 goodthopter10 goodthopter11))
17 mcu ?= msp430f2274
18 platform := goodfet
19 config := monitor spi
20 endif
21
22 ifneq (,$(findstring $(board),goodfet20 goodfet10 goodfet11))
23 mcu ?= msp430f1611
24 platform := goodfet
25 endif
26
27 ifneq (,$(findstring $(board),goodfet21,goodfet22))
28 mcu ?= msp430f2618
29 platform := goodfet
30 endif
31
32 ifneq (,$(findstring $(board),goodfet30 goodfet31 goodfet32))
33 mcu ?= msp430f2274
34 platform := goodfet
35 # This will link to fit in a '2254, so unneeded packages should be omited.
36 CONFIG_ccspi = n
37 CONFIG_nrf = y
38 endif
39
40 ifneq (,$(findstring $(board),goodfet40 goodfet41 goodfet42))
41 mcu ?= msp430f2618
42 platform := goodfet
43 CONFIG_nrf = y
44 CONFIG_ccspi = y
45 endif
46
47 ifneq (,$(findstring $(board),stm32f4discovery))
48
49 periph ?= /opt/STM32F4xx_StdPeriph_Driver
50 discovery ?= /opt/STM32F4-Discovery_FW_V1.1.0
51
52 usbcore ?= $(discovery)/Libraries/STM32_USB_Device_Library/Core
53 usbsrc ?= $(usbcore)/src
54 otginc ?= /opt/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32_USB_OTG_Driver/inc
55 otgsrc ?= /opt/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32_USB_OTG_Driver/src
56
57 pincs ?=  -I$(periph)/inc -I$(usbcore)/inc -I$(otginc) -I$(discovery)/Libraries/CMSIS/ST/STM32F4xx/Include  -I$(discovery)/Libraries/CMSIS/Include -Dassert_param\(x\)= -DUSE_USB_OTG_FS -I/opt/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery
58 psrc ?=  /opt/STM32F4xx_StdPeriph_Driver/src
59
60
61 GCC     = arm-none-eabi-gcc
62 CC      = arm-none-eabi-gcc
63 LD      = arm-none-eabi-ld -v
64 AR      = arm-none-eabi-ar
65 AS      = arm-none-eabi-as
66 CP      = arm-none-eabi-objcopy
67 OD      = arm-none-eabi-objdump
68 CFLAGS  = -c -fno-common -O1 -g -mcpu=cortex-m3 -mthumb $(pincs)
69 AFLAGS  = -ahls -mapcs-32
70 LFLAGS  = -Ttmplink.cmd -nostartfiles
71 CPFLAGS = -Obinary
72 ODFLAGS = -S
73 LDFLAGS = 
74
75
76 mcu ?= stm32f407
77 platform := stm32f4discovery
78 config = monitor
79
80 # This is a pain.
81 #usblibs =  $(usbsrc)/usbd_core.o $(usbsrc)/usbd_req.o $(usbsrc)/usbd_ioreq.o $(usbsrc)/usbd_core.o $(otgsrc)/usb_dcd.o $(otgsrc)/usb_dcd_int.o $(otgsrc)/usb_hcd.o $(otgsrc)/usb_hcd_int.o $(otgsrc)/usb_otg.o
82 extralibs = lib/cortexm3.o lib/system_stm32f4xx.o lib/stm32f4xx_rcc.o $(psrc)/stm32f4xx_gpio.o $(psrc)/stm32f4xx_usart.o $(usblibs) 
83
84 endif
85
86 ifneq (,$(findstring $(board),facedancer10 facedancer11 facedancer20 facedancer21))
87 mcu ?= msp430f2618
88 platform := goodfet
89 config = monitor spi maxusb
90 endif
91
92 ifeq ($(board),z1)
93 mcu ?= msp430f2617
94 platform := z1
95 config = monitor spi ccspi
96 MSP430BSL?=goodfet.bsl --z1  --speed=38400
97 endif
98
99 ifneq (,$(findstring $(board),goodfet24))
100 mcu ?= msp430f2618
101 platform := goodfet
102 CONFIG_glitch = y
103 CONFIG_nrf = y
104 endif
105
106 ifneq (,$(findstring $(board),nhb12b))
107 mcu ?= msp430f2618
108 CONFIG_nrf = y
109 platform := nhb12b
110 endif
111
112 ifneq (,$(findstring $(board),nhb12))
113 mcu ?= msp430f2618
114 CONFIG_nrf = y
115 platform := nhb12
116 endif
117
118 ifneq (,$(findstring $(board),goodfet50 goodfet51))
119 mcu ?= msp430f5510
120 platform := goodfet
121 endif
122
123 ifeq ($(board),telosb)
124 mcu ?= msp430f1611
125 platform := telosb
126 config := monitor spi ccspi
127 CFLAGS += -Duseuart1
128 endif
129
130 ifeq ($(board),telosbbt)
131 mcu ?=msp430f1612
132 platform := telosb
133 config := monitor spi ccspi
134 endif
135
136
137
138
139 ##################################
140 ## These are experimental boards.
141 ##################################
142
143 ifneq (,$(findstring $(board),donbfet))
144 GCC := avr-gcc
145 CC := avr-gcc
146 mcu ?= atmega644p
147 platform = donbfet
148 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
149 config := monitor avr spi jscan
150 endif
151
152 ifneq (,$(findstring $(board),zigduino))
153 GCC := avr-gcc
154 CC := avr-gcc
155 mcu ?= atmega128rfa1
156 platform = zigduino
157 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
158 config := monitor atmel_radio #avr spi
159 AVR_PLATFORM := m128rfa1
160 endif
161
162
163 ifneq (,$(findstring $(board),arduino))
164 GCC := avr-gcc
165 mcu ?= atmega168
166 #BSL := avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
167 LDFLAGS := 
168 config := monitor
169 endif
170
171 ifneq (,$(findstring $(board),tilaunchpad))
172 mcu ?=msp430f1612
173 CFLAGS := -DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG
174 CFLAGS+= -Wall
175 config := monitor chipcon i2c
176 endif
177
178
179
180 mcu ?= undef
181 ifeq ($(mcu),undef)
182 $(error Please define board, as explained in the README)
183 endif
184 #platform := $(board)
185
186 AVAILABLE_APPS = monitor spi jtag sbw jtag430 jtag430x2 i2c jtagarm7 ejtag jtagxscale openocd chipcon avr pic adc nrf ccspi glitch smartcard ps2 slc2  maxusb atmel_radio cc2500
187
188 # defaults
189 CONFIG_monitor    ?= y
190 CONFIG_spi        ?= y
191 CONFIG_maxusb     ?= y
192 CONFIG_jtag       ?= n
193 CONFIG_sbw        ?= n
194 CONFIG_jtag430    ?= y
195 CONFIG_jtag430x2  ?= y
196 CONFIG_i2c        ?= n
197 CONFIG_jtagarm7   ?= y
198 CONFIG_ejtag      ?= n
199 CONFIG_jtagxscale ?= n
200 CONFIG_openocd    ?= y
201 CONFIG_chipcon    ?= y
202 CONFIG_avr        ?= y
203 CONFIG_pic        ?= n
204 CONFIG_adc        ?= n
205 CONFIG_nrf        ?= n
206 CONFIG_ccspi      ?= n
207 CONFIG_cc2500     ?= y
208 CONFIG_glitch     ?= n
209 CONFIG_smartcard  ?= n
210 CONFIG_ps2        ?= n
211 CONFIG_slc2       ?= n
212 CONFIG_atmel_radio ?=n
213
214 #The CONFIG_foo vars are only interpreted if $(config) is "unset".
215 ifeq ($(config),undef)
216 config += $(foreach app,$(AVAILABLE_APPS),$(if $(findstring $(CONFIG_$(app)),y yes t true Y YES T TRUE),$(app)))
217 endif