-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedefs
82 lines (73 loc) · 2.7 KB
/
makedefs
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
OBJFOLDER=objs
#VERBOSE=1
# Compiler and Flags
#******************************************************************************
CC= /usr/local/arm-cs-tools/bin/arm-none-eabi-gcc-4.4.1
CFLAGS=-mthumb \
-mcpu=cortex-m0 \
-Os \
-Wall \
-ffunction-sections\
-fdata-sections \
-fmessage-length=0 \
-fno-builtin \
-MD
# Assembler Flags
#******************************************************************************
AFLAGS=-mthumb \
-mcpu=cortex-m0 \
-MD
# Linker and Flags
#******************************************************************************
LD=/usr/local/arm-cs-tools/bin/arm-none-eabi-gcc-4.4.1
LDFLAGS= -mcpu=cortex-m0 -mthumb -Wl,--gc-sections
LD_PATH = lpc1xxx
LD_SCRIPT = $(LD_PATH)/linkscript.ld
LD_FILE = $(LD_PATH)/memory.ld
# OBJCOPY and Flags
#******************************************************************************
OBJCOPY=/usr/local/arm-cs-tools/bin/arm-none-eabi-objcopy
OCFLAGS = --strip-unneeded
# SIZE
#******************************************************************************
SIZE=/usr/local/arm-cs-tools/bin/arm-none-eabi-size
# Build the objects from c source files
#******************************************************************************
${OBJFOLDER}/%.o: %.c
@if [ 'x${VERBOSE}' = x ]; \
then \
echo " CC ${<}"; \
else \
echo ${CC} ${CFLAGS} -o ${@} -c ${<}; \
fi
@${CC} ${CFLAGS} -o ${@} -c ${<}
# Build the objects from the assembly files
#******************************************************************************
${OBJFOLDER}/%.o: %.S
@if [ 'x${VERBOSE}' = x ]; \
then \
echo " CC ${<}"; \
else \
echo ${CC} ${AFLAGS} -o ${@} -c ${<}; \
fi
@${CC} ${AFLAGS} -o ${@} -c ${<}
# Link the objects into an elf file
# Print the size
# output a hex file
#******************************************************************************
${OBJFOLDER}/%.elf:
@if [ 'x${VERBOSE}' = x ]; \
then \
echo " LD ${@}"; \
fi
@if [ 'x${VERBOSE}' != x ]; \
then \
echo ${LD} -T ${LD_FILE} \
${LDFLAGS} -o ${@} ${^} -lm; \
fi
@${LD} -T ${LD_FILE} \
${LDFLAGS} -o ${@} ${^} -lm
@${SIZE} ${@}
@.bin/size ${@}
@echo " OBJ ${@:.elf=.hex}"
@${OBJCOPY} $(OCFLAGS) -O ihex ${@} ${@:.elf=.hex}