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