-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
171 lines (156 loc) · 4.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Tiva Makefile
# #####################################
#
# user configuration:
#######################################
# TARGET: name of the output file
TARGET = main
ARCHIV = ADXL345_Klepp
#######################################
# MCU: part number to build for
MCU = TM4C123GH6PM
#######################################
# SOURCES: list of input source sources
SOURCES += $(wildcard *.c)
#######################################
# Tivaware driverlib
#SOURCES += adc.c
#SOURCES += aes.c
#SOURCES += can.c
#SOURCES += comp.c
#SOURCES += cpu.c
#SOURCES += crc.c
#SOURCES += des.c
#SOURCES += eeprom.c
#SOURCES += emac.c
#SOURCES += epi.c
#SOURCES += flash.c
#SOURCES += fpu.c
SOURCES += gpio.c
#SOURCES += hibernate.c
SOURCES += i2c.c
#SOURCES += interrupt.c
#SOURCES += lcd.c
#SOURCES += mpu.c
#SOURCES += onewire.c
#SOURCES += pwm.c
#SOURCES += qei.c
#SOURCES += shamd5.c
#SOURCES += ssi.c
#SOURCES += sw_crc.c
SOURCES += sysctl.c
#SOURCES += sysexc.c
#SOURCES += systick.c
#SOURCES += timer.c
SOURCES += uart.c
#SOURCES += udma.c
#SOURCES += usb.c
#SOURCES += watchdog.c
#######################################
# Tivaware utils
#SOURCES += cmdline.c
#SOURCES += cpu_usage.c
#SOURCES += flash_pb.c
#SOURCES += fswrapper.c
#SOURCES += isqrt.c
#SOURCES += locator.c
#SOURCES += lwiplib.c
#SOURCES += ptpdlib.c
#SOURCES += random.c
#SOURCES += ringbuf.c
#SOURCES += scheduler.c
#SOURCES += sine.c
#SOURCES += smbus.c
#SOURCES += softi2c.c
#SOURCES += softssi.c
#SOURCES += softuart.c
#SOURCES += speexlib.c
#SOURCES += spi_flash.c
#SOURCES += swupdate.c
#SOURCES += tftp.c
SOURCES += uartstdio.c
#SOURCES += ustdlib.c
#SOURCES += wavfile.c
#######################################
# TIVAWARE_PATH: path to tivaware folder
TIVAWARE_PATH = $(HOME)/opt/tivaware
#######################################
# Driverlib
#TI_LIB = $(TIVAWARE_PATH)/driverlib/gcc/libdriver.a
#######################################
# OUTDIR: directory to use for output
OUTDIR = build
#######################################
# GCC path
GCC_PATH = /usr/lib/gcc/arm-none-eabi/4.9.2
#######################################
# INCLUDES: list of includes, by default, use Includes directory
INCLUDES = -IInclude -I$(TIVAWARE_PATH)
#######################################
# LD_SCRIPT: linker script
LD_SCRIPT = $(MCU).ld
LDFLAGS = -T $(LD_SCRIPT) --entry ResetISR --gc-sections
LDFLAGS += -L$(GCC_PATH)/fpu/ -lgcc
#######################################
# Path to look for source files at
VPATH = src:libraries:$(TIVAWARE_PATH):$(TIVAWARE_PATH)/driverlib:$(TIVAWARE_PATH)/utils
#######################################
# define flags
CFLAGS += -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
CFLAGS += -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall -Dgcc
CFLAGS += -pedantic -DPART_$(MCU) -c -DTARGET_IS_BLIZZARD_RA1 $(INCLUDES)
CFLAGS += -g -D DEBUG
#######################################
# Clang Flags
CLANG_INCLUDES += -I$(GCC_PATH)/include
CLANG_FLAGS += -O0 -g -nostdlib -ffreestanding -target arm-none-eabi
CLANG_FLAGS += -mfloat-abi=soft
CLANG_FLAGS += $(CLANG_INCLUDES)
#######################################
# end of user configuration
#######################################
#
#######################################
# binaries
#######################################
#C = clang $(CLANG_FLAGS)
#C++ = clang++ $(CLANG_FLAGS)
C = arm-none-eabi-gcc
C++ = arm-none-eabi-g++
LD = arm-none-eabi-ld
OBJCOPY = arm-none-eabi-objcopy
RM = rm -f
MKDIR = mkdir -p
#######################################
# list of object files, placed in the build directory regardless of source path
OBJECTS = $(addprefix $(OUTDIR)/,$(notdir $(SOURCES:=.o)))
# default: build bin
all: $(OUTDIR)/$(TARGET).bin
#all: $(OUTDIR)/$(ARCHIV).zip
archiv: $(OUTDIR)/$(ARCHIV).zip
$(OUTDIR)/%.c.o: %.c | $(OUTDIR)
$(C) -o $@ $^ $(CFLAGS)
$(OUTDIR)/%.cpp.o: %.cpp | $(OUTDIR)
$(C++) -o $@ $^ $(CFLAGS)
$(OUTDIR)/$(TARGET): $(OBJECTS)
$(LD) -o $@ $^ $(LDFLAGS)
$(OUTDIR)/$(TARGET).bin: $(OUTDIR)/$(TARGET)
$(OBJCOPY) -O binary $< $@
# create the output directory
$(OUTDIR):
$(MKDIR) $(OUTDIR)
README.pdf:
rst2pdf README.rst
$(OUTDIR)/$(ARCHIV).zip: README.pdf
zip -r $(OUTDIR)/$(ARCHIV).zip . -x build/* -x build/
flash: $(OUTDIR)/$(TARGET).bin
lm4flash $(OUTDIR)/$(TARGET).bin
program: flash
debug: clean $(OUTDIR)/$(TARGET).bin
debug/debug_nemiver.sh
clean:
-$(RM) $(OUTDIR)/*
-$(RM) README.pdf
print_objs:
echo $(OBJECTS)
.PHONY: all flash program debug clean