v1.0.0 reorg
[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/rf/chibi
51 OBJS += chb.o chb_buf.o chb_drvr.o chb_eeprom.o chb_spi.o
52
53 # 4K EEPROM
54 VPATH += drivers/storage/eeprom drivers/storage/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/displays/tft drivers/displays/tft/hw
67 VPATH += drivers/displays/tft/dialogues
68 OBJS += drawing.o touchscreen.o colors.o bmp.o alphanumeric.o
69
70 # Bitmap (non-AA) fonts
71 VPATH += drivers/displays/tft/fonts
72 OBJS += fonts.o
73 OBJS += dejavusans9.o dejavusansbold9.o dejavusanscondensed9.o
74 OBJS += dejavusansmono8.o dejavusansmonobold8.o
75 OBJS += verdana9.o verdana14.o verdanabold14.o
76
77 # Anti-aliased fonts
78 VPATH += drivers/displays/tft/aafonts/aa2 drivers/displays/tft/aafonts/aa4
79 OBJS += aafonts.o
80 OBJS += DejaVuSansCondensed14_AA2.o DejaVuSansCondensedBold14_AA2.o
81 OBJS += DejaVuSansMono10_AA2.o DejaVuSansMono13_AA2.o DejaVuSansMono14_AA2.o
82
83 # LCD Driver (Only one can be included at a time!)
84 # OBJS += hx8340b.o
85 OBJS += ILI9328.o
86 # OBJS += ILI9325.o
87 # OBJS += ssd1331.o
88 # OBJS += ssd1351.o
89 # OBJS += st7735.o
90 # OBJS += st7783.o
91
92 # Bitmap/Monochrome LCD support (ST7565, SSD1306, etc.)
93 VPATH += drivers/displays
94 VPATH += drivers/displays/bitmap/sharpmem
95 VPATH += drivers/displays/bitmap/st7565
96 VPATH += drivers/displays/bitmap/ssd1306
97 OBJS += smallfonts.o sharpmem.o st7565.o ssd1306.o
98
99 #Character Displays (VFD text displays, etc.)
100 VPATH += drivers/displays/character/samsung_20T202DA2JA
101 OBJS += samsung_20T202DA2JA.o
102
103 # ChaN FatFS and SD card support
104 VPATH += drivers/fatfs
105 OBJS += ff.o mmc.o
106
107 # Motors
108 VPATH += drivers/motor/stepper
109 OBJS += stepper.o
110
111 # RSA Encryption/Descryption
112 VPATH += drivers/rsa
113 OBJS += rsa.o
114
115 # DAC
116 VPATH += drivers/dac/mcp4725
117 OBJS += mcp4725.o
118
119 # RFID/NFC
120 VPATH += drivers/rf/pn532 drivers/rf/pn532/helpers
121 OBJS += pn532.o pn532_bus_i2c.o pn532_bus_uart.o
122 OBJS += pn532_mifare_classic.o pn532_mifare_ultralight.o
123
124 # TAOS Light Sensors
125 VPATH += drivers/sensors/tcs3414 drivers/sensors/tsl2561
126 OBJS += tcs3414.o tsl2561.o
127
128 # SPI Flash
129 VPATH += drivers/storage/spiflash/w25q16bv
130 OBJS += w25q16bv.o
131
132 ##########################################################################
133 # Library files
134 ##########################################################################
135
136 VPATH += core core/adc core/cmd core/cpu core/gpio core/i2c core/pmu
137 VPATH += core/ssp core/systick core/timer16 core/timer32 core/uart
138 VPATH += core/usbhid-rom core/wdt core/usbcdc core/pwm core/iap
139 VPATH += core/libc
140 OBJS += stdio.o string.o
141 OBJS += adc.o cpu.o cmd.o gpio.o i2c.o pmu.o ssp.o systick.o timer16.o
142 OBJS += timer32.o uart.o uart_buf.o usbconfig.o usbhid.o
143 OBJS += wdt.o cdcuser.o cdc_buf.o usbcore.o usbdesc.o usbhw.o usbuser.o
144 OBJS += sysinit.o pwm.o iap.o
145
146 ##########################################################################
147 # GNU GCC compiler prefix and location
148 ##########################################################################
149
150 CROSS_COMPILE = arm-none-eabi-
151 AS = $(CROSS_COMPILE)gcc
152 CC = $(CROSS_COMPILE)gcc
153 LD = $(CROSS_COMPILE)gcc
154 SIZE = $(CROSS_COMPILE)size
155 OBJCOPY = $(CROSS_COMPILE)objcopy
156 OBJDUMP = $(CROSS_COMPILE)objdump
157 OUTFILE = firmware
158 LPCRC = ./lpcrc
159 CP = cp
160
161 ##########################################################################
162 # GNU GCC compiler flags
163 ##########################################################################
164 ROOT_PATH = .
165 INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/project
166
167 ##########################################################################
168 # Startup files
169 ##########################################################################
170
171 LD_PATH = lpc1xxx
172 LD_SCRIPT = $(LD_PATH)/linkscript.ld
173 LD_TEMP = $(LD_PATH)/memory.ld
174
175 ifeq (LPC11xx,$(TARGET))
176 CORTEX_TYPE=m0
177 else
178 CORTEX_TYPE=m3
179 endif
180
181 CPU_TYPE = cortex-$(CORTEX_TYPE)
182 VPATH += lpc1xxx
183 OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o
184
185 ##########################################################################
186 # Compiler settings, parameters and flags
187 ##########################################################################
188 ifeq (TRUE,$(DEBUGBUILD))
189 CFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin
190 ASFLAGS = -c -g -O0 $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
191 else
192 CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin
193 ASFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -D__ASSEMBLY__ -x assembler-with-cpp
194 endif
195
196 LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections
197 LDLIBS = -lm
198 OCFLAGS = --strip-unneeded
199
200 all: firmware
201
202 %.o : %.c
203 $(CC) $(CFLAGS) -o $@ $<
204
205 %.o : %.s
206 $(AS) $(ASFLAGS) -o $@ $<
207
208 firmware: $(OBJS) $(SYS_OBJS)
209 -@echo "MEMORY" > $(LD_TEMP)
210 -@echo "{" >> $(LD_TEMP)
211 -@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
212 -@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)" >> $(LD_TEMP)
213 -@echo "}" >> $(LD_TEMP)
214 -@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
215 $(LD) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
216 -@echo ""
217 $(SIZE) $(OUTFILE).elf
218 -@echo ""
219 $(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin
220 $(OBJCOPY) $(OCFLAGS) -O ihex $(OUTFILE).elf $(OUTFILE).hex
221 -@echo ""
222 $(LPCRC) firmware.bin
223
224 clean:
225 rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
This page took 0.045306 seconds and 5 git commands to generate.