Levelauswahl auf Badge.
[hackover2013-badge-firmware.git] / Makefile
1 ##########################################################################
2 # User configuration and firmware specific object files
3 ##########################################################################
4
5 # The target, flash and ram of the LPC1xxx microprocessor.
6 # Use for the target the value: LPC11xx, LPC13xx or LPC17xx
7 TARGET = LPC13xx
8 FLASH = 32K
9 SRAM = 8K
10
11 # For USB HID support the LPC134x reserves 384 bytes from the sram,
12 # if you don't want to use the USB features, just use 0 here.
13 SRAM_USB = 384
14
15 ##########################################################################
16 # Debug settings
17 ##########################################################################
18
19 # Set DEBUGBUILD to 'TRUE' for full debugging (larger, slower binaries),
20 # or to 'FALSE' for release builds (smallest, fastest binaries)
21 DEBUGBUILD = FALSE
22
23 ##########################################################################
24 # IDE Flags (Keeps various IDEs happy)
25 ##########################################################################
26
27 #OPTDEFINES = -D __NEWLIB__ -DR0KET
28 OPTDEFINES = -D __NEWLIB__ -DHOB_REV2
29 ##########################################################################
30 # Project-specific files
31 ##########################################################################
32
33 SRCS = \
34 badge/main.c \
35 badge/init.c \
36 badge/jumpnrun/collision.c \
37 badge/jumpnrun/enemies.c \
38 badge/jumpnrun/game_state.c \
39 badge/jumpnrun/items.c \
40 badge/jumpnrun/jumpnrun.c \
41 badge/jumpnrun/level_load.c \
42 badge/jumpnrun/player.c \
43 badge/jumpnrun/render.c \
44 badge/jumpnrun/shots.c \
45 badge/jumpnrun/starter.c \
46 badge/jumpnrun/stats.c \
47 badge/jumpnrun/tiles.c \
48 badge/ui/display.c \
49 badge/ui/event.c \
50 badge/ui/font.c \
51 badge/ui/menu.c \
52 badge/ui/sprite.c
53
54 SRCS += \
55 dataflash/iobase.c \
56 dataflash/diskio.c \
57 dataflash/at45db041d.c
58
59 SRCS += \
60 funk/nrf24l01p.c
61
62 SRCS += \
63 project/commands.c
64
65 SRCS += \
66 project/commands/cmd_chibi_addr.c \
67 project/commands/cmd_chibi_tx.c \
68 project/commands/cmd_i2ceeprom_read.c \
69 project/commands/cmd_i2ceeprom_write.c \
70 project/commands/cmd_lm75b_gettemp.c \
71 project/commands/cmd_reset.c \
72 project/commands/cmd_sd_dir.c \
73 project/commands/cmd_sysinfo.c \
74 project/commands/cmd_uart.c \
75 project/commands/cmd_pwm.c
76
77 SRCS += \
78 project/commands/drawing/cmd_backlight.c \
79 project/commands/drawing/cmd_bmp.c \
80 project/commands/drawing/cmd_button.c \
81 project/commands/drawing/cmd_calibrate.c \
82 project/commands/drawing/cmd_circle.c \
83 project/commands/drawing/cmd_clear.c \
84 project/commands/drawing/cmd_line.c \
85 project/commands/drawing/cmd_orientation.c \
86 project/commands/drawing/cmd_pixel.c \
87 project/commands/drawing/cmd_progress.c \
88 project/commands/drawing/cmd_rectangle.c \
89 project/commands/drawing/cmd_roundedcorner.c \
90 project/commands/drawing/cmd_text.c \
91 project/commands/drawing/cmd_textw.c \
92 project/commands/drawing/cmd_tsthreshhold.c \
93 project/commands/drawing/cmd_tswait.c \
94 project/commands/drawing/cmd_triangle.c
95
96 ##########################################################################
97 # Optional driver files
98 ##########################################################################
99
100 # Chibi Light-Weight Wireless Stack (AT86RF212)
101 SRCS += \
102 drivers/rf/chibi/chb.c \
103 drivers/rf/chibi/chb_buf.c \
104 drivers/rf/chibi/chb_drvr.c \
105 drivers/rf/chibi/chb_eeprom.c \
106 drivers/rf/chibi/chb_spi.c
107
108 # 4K EEPROM
109 SRCS += \
110 drivers/storage/eeprom/eeprom.c \
111 drivers/storage/eeprom/mcp24aa/mcp24aa.c
112
113 # LM75B temperature sensor
114 SRCS += \
115 drivers/sensors/lm75b/lm75b.c
116
117 # ISL12022M RTC
118 SRCS += \
119 drivers/rtc/isl12022m/isl12022m.c
120
121 # TFT LCD support
122 SRCS += \
123 drivers/displays/tft/drawing.c \
124 drivers/displays/tft/touchscreen.c \
125 drivers/displays/tft/colors.c \
126 drivers/displays/tft/theme.c \
127 drivers/displays/tft/bmp.c
128
129 # GUI Controls
130 SRCS += \
131 drivers/displays/tft/controls/button.c \
132 drivers/displays/tft/controls/hsbchart.c \
133 drivers/displays/tft/controls/huechart.c \
134 drivers/displays/tft/controls/label.c \
135 drivers/displays/tft/controls/labelcentered.c \
136 drivers/displays/tft/controls/progressbar.c
137
138 # Bitmap (non-AA) fonts
139 SRCS += \
140 drivers/displays/tft/fonts.c \
141 drivers/displays/tft/fonts/dejavusans9.c \
142 drivers/displays/tft/fonts/dejavusansbold9.c \
143 drivers/displays/tft/fonts/dejavusanscondensed9.c \
144 drivers/displays/tft/fonts/dejavusansmono8.c \
145 drivers/displays/tft/fonts/dejavusansmonobold8.c \
146 drivers/displays/tft/fonts/verdana9.c \
147 drivers/displays/tft/fonts/verdana14.c \
148 drivers/displays/tft/fonts/verdanabold14.c
149
150 # Anti-aliased fonts
151 SRCS += \
152 drivers/displays/tft/aafonts.c \
153 drivers/displays/tft/aafonts/aa2/DejaVuSansCondensed14_AA2.c \
154 drivers/displays/tft/aafonts/aa2/DejaVuSansCondensedBold14_AA2.c \
155 drivers/displays/tft/aafonts/aa2/DejaVuSansMono10_AA2.c \
156 drivers/displays/tft/aafonts/aa2/DejaVuSansMono13_AA2.c \
157 drivers/displays/tft/aafonts/aa2/DejaVuSansMono14_AA2.c
158
159 # LCD Driver (Only one can be included at a time!)
160 # SRCS += drivers/displays/tft/hw/hx8340b.c
161 # SRCS += drivers/displays/tft/hw/hx8347d.c
162 # SRCS += drivers/displays/tft/hw/ILI9328.c
163 # SRCS += drivers/displays/tft/hw/ILI9325.c
164 # SRCS += drivers/displays/tft/hw/ssd1331.c
165 # SRCS += drivers/displays/tft/hw/ssd1351.c
166 # SRCS += drivers/displays/tft/hw/st7735.c
167 # SRCS += drivers/displays/tft/hw/st7783.c
168
169 # Bitmap/Monochrome LCD support (ST7565, SSD1306, etc.)
170 SRCS += \
171 drivers/displays/smallfonts.c \
172 drivers/displays/bitmap/sharpmem/sharpmem.c \
173 drivers/displays/bitmap/st7565/st7565.c \
174 drivers/displays/bitmap/ssd1306/ssd1306.c
175
176 #Character Displays (VFD text displays, etc.)
177 SRCS += \
178 drivers/displays/character/samsung_20T202DA2JA/samsung_20T202DA2JA.c
179
180 # ChaN FatFS and SD card support
181 SRCS += \
182 drivers/fatfs/ff.c
183 # drivers/fatfs/mmc.c
184
185 # Motors
186 SRCS += \
187 drivers/motor/stepper/stepper.c
188
189 # RSA Encryption/Descryption
190 SRCS += \
191 drivers/rsa/rsa.c
192
193 # DAC
194 SRCS += \
195 drivers/dac/mcp4725/mcp4725.c \
196 drivers/dac/mcp4901/mcp4901.c
197
198 # RFID/NFC
199 SRCS += \
200 drivers/rf/pn532/pn532.c \
201 drivers/rf/pn532/pn532_bus_i2c.c \
202 drivers/rf/pn532/pn532_bus_uart.c \
203 drivers/rf/pn532/helpers/pn532_mifare_classic.c \
204 drivers/rf/pn532/helpers/pn532_mifare_ultralight.c
205
206 # TAOS Light Sensors
207 SRCS += \
208 drivers/sensors/tcs3414/tcs3414.c \
209 drivers/sensors/tsl2561/tsl2561.c
210
211 # SPI Flash
212 SRCS += \
213 drivers/storage/spiflash/w25q16bv/w25q16bv.c
214
215 # FM Radio
216 SRCS += \
217 drivers/audio/tea5767/tea5767.c
218
219 # IN219 Current Sensor
220 SRCS += \
221 drivers/sensors/ina219/ina219.c
222
223 # MPL115A2 Barometric Pressure Sensor
224 SRCS += \
225 drivers/sensors/mpl115a2/mpl115a2.c
226
227 # ADS1015 12-bit ADC
228 SRCS += \
229 drivers/adc/ads1015/ads1015.c
230
231 ##########################################################################
232 # Library files
233 ##########################################################################
234
235 SRCS += \
236 core/adc/adc.c \
237 core/cmd/cmd.c \
238 core/cpu/cpu.c \
239 core/gpio/gpio.c \
240 core/i2c/i2c.c \
241 core/iap/iap.c \
242 core/libc/stdio.c \
243 core/libc/string.c \
244 core/pmu/pmu.c \
245 core/pwm/pwm.c \
246 core/ssp/ssp.c \
247 core/systick/systick.c \
248 core/timer16/timer16.c \
249 core/timer32/timer32.c \
250 core/uart/uart_buf.c \
251 core/uart/uart.c \
252 core/usbcdc/cdc_buf.c \
253 core/usbcdc/cdcuser.c \
254 core/usbcdc/usbcore.c \
255 core/usbcdc/usbdesc.c \
256 core/usbcdc/usbhw.c \
257 core/usbcdc/usbuser.c \
258 core/usbhid-rom/usbconfig.c \
259 core/usbhid-rom/usbhid.c \
260 core/usbhid-rom/usbmsc.c \
261 core/wdt/wdt.c
262
263 ##########################################################################
264 # GNU GCC compiler prefix and location
265 ##########################################################################
266
267 CROSS_COMPILE = arm-none-eabi-
268 AS = $(CROSS_COMPILE)gcc
269 CC = $(CROSS_COMPILE)gcc
270 LD = $(CROSS_COMPILE)gcc
271 SIZE = $(CROSS_COMPILE)size
272 OBJCOPY = $(CROSS_COMPILE)objcopy
273 OBJDUMP = $(CROSS_COMPILE)objdump
274 OUTFILE = firmware
275
276 CC_FOR_BUILD = gcc
277 LPCRC = ./lpcrc
278
279 ##########################################################################
280 # GNU GCC compiler flags
281 ##########################################################################
282 ROOT_PATH = .
283 INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/project
284
285 ##########################################################################
286 # Startup files
287 ##########################################################################
288
289 LD_PATH = lpc1xxx
290 LD_SCRIPT = $(LD_PATH)/linkscript.ld
291 LD_TEMP = $(LD_PATH)/memory.ld
292
293 ifeq (LPC11xx,$(TARGET))
294 CORTEX_TYPE=m0
295 else
296 CORTEX_TYPE=m3
297 endif
298
299 CPU_TYPE = cortex-$(CORTEX_TYPE)
300
301 SRCS += \
302 lpc1xxx/$(TARGET)_handlers.c \
303 lpc1xxx/LPC1xxx_startup.c
304
305 OBJS = $(SRCS:%.c=%.o)
306 DEPS = $(SRCS:%.c=%.dep)
307
308 ##########################################################################
309 # Compiler settings, parameters and flags
310 ##########################################################################
311 ifeq (TRUE,$(DEBUGBUILD))
312 CFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin $(OPTDEFINES) -std=c99
313 ASFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
314 else
315 CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin $(OPTDEFINES) -std=c99
316 ASFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
317 endif
318
319 LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections
320 LDLIBS = -lm
321 OCFLAGS = --strip-unneeded
322
323 all: dep size $(OUTFILE).bin $(OUTFILE).hex
324
325 dep: $(DEPS)
326
327 $(DEPS) : %.dep : %.c
328 $(CC) $(CPPFLAGS) $(CFLAGS) -MM $< -MT $@ -MT $(@:%.dep=%.o) -MF $@
329
330 sinclude $(DEPS)
331
332 $(LD_TEMP):
333 -@echo "MEMORY" > $(LD_TEMP)
334 -@echo "{" >> $(LD_TEMP)
335 -@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
336 -@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)" >> $(LD_TEMP)
337 -@echo "}" >> $(LD_TEMP)
338 -@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
339
340 $(OUTFILE).elf: $(OBJS) $(LD_TEMP)
341 $(LD) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
342
343 $(OUTFILE).bin: $(OUTFILE).elf $(LPCRC)
344 $(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin
345 $(LPCRC) $(OUTFILE).bin
346
347 $(OUTFILE).hex: $(OUTFILE).elf
348 $(OBJCOPY) $(OCFLAGS) -O ihex $(OUTFILE).elf $(OUTFILE).hex
349
350 size: $(OUTFILE).elf
351 $(SIZE) $(OUTFILE).elf
352
353 clean:
354 rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
355
356 distclean: clean
357 rm -f $(DEPS) $(LPCRC)
358
359 .PHONY: all dep size clean distclean
360
361 CFLAGS_FOR_BUILD = -Wall -Wextra -std=c99 -O0 -g
362
363 LPCRC_SRCS = tools/lpcrc/lpcrc.c
364 LPCRC_OBJS = $(LPCRC_SRCS:%.c=%.o)
365 LPCRC_DEPS = $(LPCRC_SRCS:%.c=%.dep)
366
367 $(LPCRC_DEPS) : %.dep : %.c
368 $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -MM $< -MT $@ -MT $(@:%.dep=%.o) -MF $@
369
370 $(LPCRC_OBJS): %.o : %.c
371 $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ -c $<
372
373 $(LPCRC): $(LPCRC_OBJS)
374 $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $+ $(LDLIBS_FOR_BUILD)
This page took 0.065486 seconds and 5 git commands to generate.