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