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