-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·103 lines (72 loc) · 3.14 KB
/
Copy pathMakefile
File metadata and controls
executable file
·103 lines (72 loc) · 3.14 KB
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
include makedefs
OUTFILE=firmware
# Include all sub directories use regex to exlude hidden dirs
INCLUDEDIRS=$(shell find * \( ! -regex '.*/\..*' \) -type d)
INCLUDE=-I.
INCLUDE+=$(addprefix -I, $(INCLUDEDIRS))
CFLAGS+= $(INCLUDE)
CFLAGS+=-D'BAUDRATE=115200'
VPATH=lpc1xxx:libs:core
VPATH+=$(addprefix :, $(INCLUDEDIRS))
OBJFILES = main.o cpu_init.o uart.o core_cm0.o
OBJFILES +=port.o heap_2.o croutine.o list.o queue.o tasks.o
OBJFILES +=ledTask.o stack_checker.o uartTask.o
OBJS = $(addprefix ${OBJFOLDER}/, $(OBJFILES))
INIT_OBJS= ${OBJFOLDER}/LPC11xx_handlers.o ${OBJFOLDER}/LPC1xxx_startup.o
##########################################################################
#LPC21ISP PROGRAMMING
##########################################################################
LPC21ISP = /usr/local/bin/lpc21isp
LPC21ISP_PORT = /dev/tty.usbserial*
LPC21ISP_BAUD = 115200 #38400
LPC21ISP_XTAL = 12000
LPC21ISP_FLASHFILE = $(OBJFOLDER)/$(OUTFILE).hex
LPC21ISP_CONTROL = -control -RstDone
LPC21ISP_OPTIONS = -verify -term
# Make all
##########################################################################
all: ${OBJFOLDER} \
${OBJFOLDER}/$(OUTFILE).elf
# Clean the stuff
##########################################################################
clean:
@rm -rf ${OBJFOLDER} ${wildcard *.bin} $(OUTFILE).elf
# Make the folder used to hold the objs
##########################################################################
${OBJFOLDER}:
@mkdir ${OBJFOLDER}
# Make the efl and hex from the objects
##########################################################################
${OBJFOLDER}/$(OUTFILE).elf: ${INIT_OBJS} ${OBJS}
# Flash the board
##########################################################################
flash:
@echo " PROG $(OUTFILE).hex"
@ps axc | grep lpc21isp >/dev/null; if [ $$? -eq 0 ] ; then killall lpc21isp ; fi
@echo '$(LPC21ISP) $(LPC21ISP_OPTIONS) $(LPC21ISP_CONTROL) $(LPC21ISP_DEBUG) "$(CURDIR)/$(LPC21ISP_FLASHFILE)" $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)' > $(OBJFOLDER)/debugcommand.txt
@chmod +x $(OBJFOLDER)/debugcommand.txt
@open -a terminal.app $(OBJFOLDER)/debugcommand.txt
# Build the files and program the board
##########################################################################
program:all flash
# Open a terminal using lpc21isp This controls the bootloader so the
# board is not stuck in reset
##########################################################################
term: ${OBJFOLDER}
@echo "TERM lpc21isp"
@ps axc | grep lpc21isp >/dev/null; if [ $$? -eq 0 ] ; then killall lpc21isp ; fi
@echo '$(LPC21ISP) -termonly $(LPC21ISP_CONTROL) $(LPC21ISP_DEBUG) "$(CURDIR)/$(LPC21ISP_FLASHFILE)" $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)' > $(OBJFOLDER)/debugcommand.txt
@chmod +x $(OBJFOLDER)/debugcommand.txt
@open -a terminal.app $(OBJFOLDER)/debugcommand.txt
size:
@if [ -d objs ];\
then\
$(SIZE) $(OBJFOLDER)/*.o $(OBJFOLDER)/*.elf; \
fi
# Print a variable
##########################################################################
print:
@echo "INCLUDE DIRS $(INCLUDEDIRS)\n"
@echo "OBJS $(OBJS)\n"
@echo "VPATH $(VPATH)\n"
-include ${wildcard ${OBJFOLDER}/*.d} __dummy__