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