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