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