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