1 | ####################################################################
|
2 | # Platform..: TI-MSP430
|
3 | # Date......: 07.07.2009
|
4 | # Input.....: The following commandline parameters are required for the
|
5 | # compile and build jobs. The examples use variables (%var%) as
|
6 | # they are provided by PsPad programming editor. This
|
7 | # commandline must be provided for build operations:
|
8 | #
|
9 | # make JOB=%Ext% SOURCE=%Name%%Ext% TOOLS="D:\Program Files\MspGcc"
|
10 | #
|
11 | # make.exe JOB=%Ext% SOURCE=%Name%%Ext% TOOLS=<MspGccPath>
|
12 | # [DLAUTO=yes]
|
13 | #
|
14 | # EXT=%Ext% Is used for build operations. It is the
|
15 | # file extension of the active file in the
|
16 | # editor.
|
17 | #
|
18 | # SOURCE=%Name%%Ext% Is the name and extension of the active
|
19 | # file in the editor. It is used for single
|
20 | # file compilations.
|
21 | #
|
22 | # TOOLS=<MspGccPath> Root directory of MspGcc installation.
|
23 | # Must be enclosed in quotes if the path
|
24 | # contains spaces.
|
25 | #
|
26 | # DLAUTO=yes Tells the make job if the object file
|
27 | # shall be downloaded immediately after a
|
28 | # a successful build.
|
29 | #
|
30 | # For non-compile or build jobs (makehex, makelst, download,
|
31 | # debug and clean) the syntax is
|
32 | #
|
33 | # make.exe [makehex | makelst | download | debug | clean]
|
34 | #
|
35 | # Note that these jobs can also perform a build operation,
|
36 | # depending on the job settings.
|
37 | #
|
38 | # Remarks...: The current path when executing this makefile has to be in
|
39 | # the folder, where the objects go (e.g. ./Obj). In PsPad, it
|
40 | # can be set in the compiler dialog, e.g. %ProjectDir%\Obj.
|
41 | #############################################################################
|
42 |
|
43 | #===================================================== customizable section
|
44 | #-------------------project name, will also be the name of the output file
|
45 | PROJECT = 13_stoppuhr_Dev3
|
46 |
|
47 | #--------------------------- paths relative to object path (%ProjectDir%\Obj)
|
48 | SRCPATH = ../Src/
|
49 | BINPATH = ../Bin/
|
50 | LSTPATH = ../Lst/
|
51 | LIBPATH = ../../Library/
|
52 | #---------------------------------- list of all main and library source files
|
53 | MAINSOURCES = 13_Stoppuhr.c
|
54 | LIBSOURCES = Lib_v2.c fat.c ff.c diskio.c LibLcd.c
|
55 |
|
56 | #---------------------------------- paths for executables and system includes
|
57 | MSPINST = $(TOOLS)/
|
58 | MSPINC = "$(MSPINST)msp430/include"
|
59 | MSPEXE = $(MSPINST)Bin/
|
60 | CC = "$(MSPEXE)msp430-gcc"
|
61 | RM = rm.exe
|
62 |
|
63 | #------------------------------------ COM port for iProg FTDI chip (COMx - 1)
|
64 | BSLPORT = 4
|
65 |
|
66 | #------------------------------------- automatic download on successful build
|
67 | DLAUTO = no
|
68 |
|
69 | #================================================ end of customizable section
|
70 |
|
71 | #------------------------------------------------------- environment settings
|
72 | SOURCES = $(MAINSOURCES) $(LIBSOURCES)
|
73 |
|
74 | DEPSSRC = $(addprefix $(SRCPATH), $(MAINSOURCES)) \
|
75 | $(addprefix $(LIBPATH), $(LIBSOURCES))
|
76 |
|
77 | INCLUDES = -I $(SRCPATH) -I $(LIBPATH) -I $(MSPINC)
|
78 |
|
79 | VPATH = $(SRCPATH) $(LIBPATH)
|
80 |
|
81 | #---------------------------------------------------------- compiler settings
|
82 | MCU = msp430x1611
|
83 | LDFLAGS = -mmcu=$(MCU)
|
84 | CFLAGS = -mmcu=$(MCU) $(INCLUDES) -g -O0 -Wall
|
85 |
|
86 | #======================================================== command line parser
|
87 | # Call job depending on filename on commandline
|
88 | #============================================================================
|
89 | ifeq "$(suffix $(JOB))" ".c"
|
90 | EXEC = compile
|
91 |
|
92 | endif
|
93 |
|
94 | ifeq "$(basename $(JOB))" "makefile"
|
95 |
|
96 | ifeq "$(DLAUTO)" "yes"
|
97 | EXEC = download
|
98 | else
|
99 | EXEC = build
|
100 | endif
|
101 |
|
102 | endif
|
103 |
|
104 | job: $(EXEC)
|
105 | # Debug @echo $(SOURCE): successJOB
|
106 | #============================================================================
|
107 |
|
108 | #============================================================== job 'compile'
|
109 | # A single file gets compiled. The file is the active file in the editor.
|
110 | #============================================================================
|
111 | OBJECT = $(SOURCE:.c=.o)
|
112 |
|
113 | compile: $(SOURCE)
|
114 | $(CC) $(CFLAGS) -c -o $(OBJECT) $<
|
115 | @echo $(SOURCE): success1 compile
|
116 | #============================================================================
|
117 |
|
118 | #================================================================ job 'build'
|
119 | # The whole project gets compiled and linked
|
120 | # Syntax: Either 'make.exe build' or 'make.exe job=%Ext%' with 'makefile'
|
121 | # as active file in the editor
|
122 | #============================================================================
|
123 | OBJECTS = $(SOURCES:.c=.o)
|
124 |
|
125 | $(PROJECT): $(OBJECTS)
|
126 | $(CC) $(LDFLAGS) $(OBJECTS) -o $(BINPATH)$(PROJECT).elf
|
127 | "$(MSPEXE)msp430-size" $(BINPATH)$(PROJECT).elf
|
128 |
|
129 | $(SOURCES):
|
130 | $(CC) $(CFLAGS) $< -o $@
|
131 |
|
132 | build: $(SOURCES) $(PROJECT)
|
133 | @echo $(PROJECT): success2 Build
|
134 | #============================================================================
|
135 |
|
136 | #============================================================= job 'download'
|
137 | # Download .elf file onto target. A successful build has to be done before.
|
138 | # To check for this automatically, add 'build' to download: line.
|
139 | # Syntax: make.exe download
|
140 | #============================================================================
|
141 | download: build
|
142 | "$(MSPEXE)msp430-bsl" -c $(BSLPORT) -e --invert-test --invert-reset \
|
143 | $(BINPATH)$(PROJECT).elf
|
144 | # Debug: rma wenn an dieser Stelle = Fehler. @echo $(PROJECT): success3 Download build
|
145 | #============================================================================
|
146 |
|
147 | #============================================================== job 'makehex'
|
148 | # Create .HEX file out of .ELF
|
149 | # Syntax: make.exe makehex
|
150 | #============================================================================
|
151 | makehex: build
|
152 | "$(MSPEXE)msp430-objcopy" -O ihex $(BINPATH)$(PROJECT).elf \
|
153 | $(BINPATH)$(PROJECT).hex
|
154 | @echo $(PROJECT).hex created success6
|
155 | #============================================================================
|
156 |
|
157 | #============================================================== job 'makelst'
|
158 | # Create .LST file out of .ELF
|
159 | # Syntax: make.exe makelst
|
160 | #============================================================================
|
161 | LSTOBJ = $(SOURCES:.c=.o)
|
162 |
|
163 | makelst: build
|
164 | "$(MSPEXE)msp430-objdump" -dSt $(LSTOBJ) >$(LSTPATH)$(PROJECT).lst
|
165 | @echo $(PROJECT).lst created
|
166 | #============================================================================
|
167 |
|
168 | #================================================================ job 'debug'
|
169 | # Start Insight debugger
|
170 | # Syntax: make.exe debug
|
171 | #============================================================================
|
172 | debug: build
|
173 | @echo loading...
|
174 | @cmd.exe /C start "gdbproxy" /MIN $(MSPEXE)Msp430-gdbproxy msp430 TIUSB
|
175 | @echo target remote localhost:2000 >gdb.ini
|
176 | @echo erase all >>gdb.ini
|
177 | @echo file $(BINPATH)$(PROJECT).elf >>gdb.ini
|
178 | @echo load $(BINPATH)$(PROJECT).elf >>gdb.ini
|
179 | @echo break main >>gdb.ini
|
180 | @echo continue >>gdb.ini
|
181 | "$(MSPEXE)Msp430-insight" --command=gdb.ini
|
182 | @del gdb.ini
|
183 | @taskkill /F /IM msp430-gdbproxy.exe
|
184 |
|
185 | #================================================================ job 'clean'
|
186 | # Delete all auto-generated files
|
187 | # Syntax: make.exe clean
|
188 | #============================================================================
|
189 | clean:
|
190 | $(RM) *.o *.a43 dependencies.in \
|
191 | $(BINPATH)*.elf \
|
192 | $(BINPATH)*.hex \
|
193 | $(LSTPATH)*.lst
|
194 | @echo clean success4
|
195 | #============================================================================
|
196 |
|
197 | #=============================================================== dependencies
|
198 | -include dependencies.in
|
199 | dependencies.in:
|
200 | $(CC) -MM $(CFLAGS) $(DEPSSRC) >$@
|
201 | @echo dependencies update complete
|
202 | #============================================================================
|
203 |
|
204 | ############################################################ EOF makefile
|