Added SSD1331_COLORORDER_RGB/BGR flag
[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 VPATH =
16 OBJS = main.o
17
18 ##########################################################################
19 # Debug settings
20 ##########################################################################
21
22 # Set DEBUGBUILD to 'TRUE' for full debugging (larger, slower binaries),
23 # or to 'FALSE' for release builds (smallest, fastest binaries)
24 DEBUGBUILD = FALSE
25
26 ##########################################################################
27 # Project-specific files
28 ##########################################################################
29
30 VPATH += project
31 OBJS += commands.o
32
33 VPATH += project/commands
34 OBJS += cmd_chibi_addr.o cmd_chibi_tx.o
35 OBJS += cmd_i2ceeprom_read.o cmd_i2ceeprom_write.o cmd_lm75b_gettemp.o
36 OBJS += cmd_reset.o cmd_sd_dir.o cmd_sysinfo.o cmd_uart.o
37 OBJS += cmd_roundedcorner.o
38
39 VPATH += project/commands/drawing
40 OBJS += cmd_backlight.o cmd_bmp.o cmd_button.o cmd_calibrate.o
41 OBJS += cmd_circle.o cmd_clear.o cmd_line.o cmd_orientation.o
42 OBJS += cmd_pixel.o cmd_progress.o cmd_rectangle.o cmd_text.o
43 OBJS += cmd_textw.o cmd_tsthreshhold.o cmd_tswait.o cmd_triangle.o
44
45 ##########################################################################
46 # Optional driver files
47 ##########################################################################
48
49 # Chibi Light-Weight Wireless Stack (AT86RF212)
50 VPATH += drivers/chibi
51 OBJS += chb.o chb_buf.o chb_drvr.o chb_eeprom.o chb_spi.o
52
53 # 4K EEPROM
54 VPATH += drivers/eeprom drivers/eeprom/mcp24aa
55 OBJS += eeprom.o mcp24aa.o
56
57 # LM75B temperature sensor
58 VPATH += drivers/sensors/lm75b
59 OBJS += lm75b.o
60
61 # ISL12022M RTC
62 VPATH += drivers/rtc/isl12022m
63 OBJS += isl12022m.o
64
65 # TFT LCD support
66 VPATH += drivers/lcd/tft drivers/lcd/tft/hw drivers/lcd/tft/fonts
67 VPATH += drivers/lcd/tft/dialogues
68 OBJS += drawing.o touchscreen.o bmp.o alphanumeric.o
69 OBJS += dejavusans9.o dejavusansbold9.o dejavusanscondensed9.o
70 OBJS += dejavusansmono8.o dejavusansmonobold8.o
71 OBJS += verdana9.o verdana14.o verdanabold14.o
72
73 # LCD Driver (Only one can be included at a time!)
74 OBJS += ILI9328.o
75 # OBJS += ILI9325.o
76 # OBJS += ssd1331.o
77 # OBJS += ssd1351.o
78 # OBJS += st7735.o
79 # OBJS += st7783.o
80
81 # Bitmap/Monochrome LCD support (ST7565, SSD1306, etc.)
82 VPATH += drivers/lcd drivers/lcd/bitmap/st7565
83 VPATH += drivers/lcd/bitmap/ssd1306
84 OBJS += smallfonts.o st7565.o ssd1306.o
85
86 # ChaN FatFS and SD card support
87 VPATH += drivers/fatfs
88 OBJS += ff.o mmc.o
89
90 # Motors
91 VPATH += drivers/motor/stepper
92 OBJS += stepper.o
93
94 # RSA Encryption/Descryption
95 VPATH += drivers/rsa
96 OBJS += rsa.o
97
98 # DAC
99 VPATH += drivers/dac/mcp4725
100 OBJS += mcp4725.o
101
102 # RFID/NFC
103 VPATH += drivers/sensors/pn532
104 OBJS += pn532.o
105
106 # TAOS Light Sensors
107 VPATH += drivers/sensors/tcs3414 drivers/sensors/tsl2561
108 OBJS += tcs3414.o tsl2561.o
109
110 # SPI Flash
111 VPATH += drivers/spiflash/w25q16bv
112 OBJS += w25q16bv.o
113
114 ##########################################################################
115 # Library files
116 ##########################################################################
117
118 VPATH += core core/adc core/cmd core/cpu core/gpio core/i2c core/pmu
119 VPATH += core/ssp core/systick core/timer16 core/timer32 core/uart
120 VPATH += core/usbhid-rom core/libc core/wdt core/usbcdc core/pwm
121 VPATH += core/iap
122 OBJS += adc.o cpu.o cmd.o gpio.o i2c.o pmu.o ssp.o systick.o timer16.o
123 OBJS += timer32.o uart.o uart_buf.o usbconfig.o usbhid.o stdio.o string.o
124 OBJS += wdt.o cdcuser.o cdc_buf.o usbcore.o usbdesc.o usbhw.o usbuser.o
125 OBJS += sysinit.o pwm.o iap.o
126
127 ##########################################################################
128 # GNU GCC compiler prefix and location
129 ##########################################################################
130
131 CROSS_COMPILE = arm-none-eabi-
132 AS = $(CROSS_COMPILE)gcc
133 CC = $(CROSS_COMPILE)gcc
134 LD = $(CROSS_COMPILE)gcc
135 SIZE = $(CROSS_COMPILE)size
136 OBJCOPY = $(CROSS_COMPILE)objcopy
137 OBJDUMP = $(CROSS_COMPILE)objdump
138 OUTFILE = firmware
139 LPCRC = ./lpcrc
140 CP = cp
141
142 ##########################################################################
143 # GNU GCC compiler flags
144 ##########################################################################
145 ROOT_PATH = .
146 INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/project
147
148 ##########################################################################
149 # Startup files
150 ##########################################################################
151
152 LD_PATH = lpc1xxx
153 LD_SCRIPT = $(LD_PATH)/linkscript.ld
154 LD_TEMP = $(LD_PATH)/memory.ld
155
156 ifeq (LPC11xx,$(TARGET))
157 CORTEX_TYPE=m0
158 else
159 CORTEX_TYPE=m3
160 endif
161
162 CPU_TYPE = cortex-$(CORTEX_TYPE)
163 VPATH += lpc1xxx
164 OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o
165
166 ##########################################################################
167 # Compiler settings, parameters and flags
168 ##########################################################################
169 ifeq (TRUE,$(DEBUGBUILD))
170 CFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin
171 ASFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
172 else
173 CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin
174 ASFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
175 endif
176
177 LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections
178 LDLIBS = -lm
179 OCFLAGS = --strip-unneeded
180
181 all: firmware
182
183 %.o : %.c
184 $(CC) $(CFLAGS) -o $@ $<
185
186 %.o : %.s
187 $(AS) $(ASFLAGS) -o $@ $<
188
189 firmware: $(OBJS) $(SYS_OBJS)
190 -@echo "MEMORY" > $(LD_TEMP)
191 -@echo "{" >> $(LD_TEMP)
192 -@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
193 -@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)" >> $(LD_TEMP)
194 -@echo "}" >> $(LD_TEMP)
195 -@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
196 $(LD) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
197 -@echo ""
198 $(SIZE) $(OUTFILE).elf
199 -@echo ""
200 $(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin
201 $(OBJCOPY) $(OCFLAGS) -O ihex $(OUTFILE).elf $(OUTFILE).hex
202 -@echo ""
203 $(LPCRC) firmware.bin
204
205 clean:
206 rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
This page took 0.047022 seconds and 5 git commands to generate.