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