Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | #-------------------------------------------------------------------- |
2 | # MCU name |
||
1561 | killagreg | 3 | #MCU = atmega1284p |
1171 | hbuss | 4 | MCU = atmega644p |
1 | ingob | 5 | F_CPU = 20000000 |
6 | #------------------------------------------------------------------- |
||
1051 | killagreg | 7 | VERSION_MAJOR = 0 |
1954 | holgerb | 8 | VERSION_MINOR = 86 |
1982 | holgerb | 9 | VERSION_PATCH = 3 |
1399 | killagreg | 10 | VERSION_SERIAL_MAJOR = 11 # Serial Protocol |
11 | VERSION_SERIAL_MINOR = 0 # Serial Protocol |
||
1972 | holgerb | 12 | NC_SPI_COMPATIBLE = 27 # Navi-Kompatibilität |
1 | ingob | 13 | #------------------------------------------------------------------- |
14 | |||
1419 | ingob | 15 | # get SVN revision |
16 | REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
||
17 | |||
1561 | killagreg | 18 | ifeq ($(MCU), atmega1284p) |
1 | ingob | 19 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
1561 | killagreg | 20 | HEX_NAME = MEGA1284P |
1571 | killagreg | 21 | LIBFC_EXT = 1284 |
595 | hbuss | 22 | endif |
1 | ingob | 23 | |
595 | hbuss | 24 | ifeq ($(MCU), atmega644p) |
25 | FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
||
1 | ingob | 26 | HEX_NAME = MEGA644 |
1571 | killagreg | 27 | LIBFC_EXT = 644 |
1 | ingob | 28 | endif |
29 | |||
30 | ifeq ($(F_CPU), 16000000) |
||
31 | QUARZ = 16MHZ |
||
32 | endif |
||
33 | |||
34 | ifeq ($(F_CPU), 20000000) |
||
35 | QUARZ = 20MHZ |
||
36 | endif |
||
37 | |||
38 | |||
39 | # Output format. (can be srec, ihex, binary) |
||
40 | FORMAT = ihex |
||
41 | |||
42 | # Target file name (without extension). |
||
43 | |||
1051 | killagreg | 44 | ifeq ($(VERSION_PATCH), 0) |
1419 | ingob | 45 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
297 | holgerb | 46 | endif |
1051 | killagreg | 47 | ifeq ($(VERSION_PATCH), 1) |
1419 | ingob | 48 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
297 | holgerb | 49 | endif |
1051 | killagreg | 50 | ifeq ($(VERSION_PATCH), 2) |
1419 | ingob | 51 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
297 | holgerb | 52 | endif |
1051 | killagreg | 53 | ifeq ($(VERSION_PATCH), 3) |
1419 | ingob | 54 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
297 | holgerb | 55 | endif |
1051 | killagreg | 56 | ifeq ($(VERSION_PATCH), 4) |
1419 | ingob | 57 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
297 | holgerb | 58 | endif |
1051 | killagreg | 59 | ifeq ($(VERSION_PATCH), 5) |
1419 | ingob | 60 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
297 | holgerb | 61 | endif |
1051 | killagreg | 62 | ifeq ($(VERSION_PATCH), 6) |
1419 | ingob | 63 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
469 | hbuss | 64 | endif |
1051 | killagreg | 65 | ifeq ($(VERSION_PATCH), 7) |
1419 | ingob | 66 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
469 | hbuss | 67 | endif |
1051 | killagreg | 68 | ifeq ($(VERSION_PATCH), 8) |
1419 | ingob | 69 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
855 | hbuss | 70 | endif |
1051 | killagreg | 71 | ifeq ($(VERSION_PATCH), 9) |
1419 | ingob | 72 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
855 | hbuss | 73 | endif |
1051 | killagreg | 74 | ifeq ($(VERSION_PATCH), 10) |
1419 | ingob | 75 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV) |
882 | hbuss | 76 | endif |
1166 | hbuss | 77 | ifeq ($(VERSION_PATCH), 11) |
1419 | ingob | 78 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)L_SVN$(REV) |
1166 | hbuss | 79 | endif |
80 | ifeq ($(VERSION_PATCH), 12) |
||
1419 | ingob | 81 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV) |
1166 | hbuss | 82 | endif |
83 | ifeq ($(VERSION_PATCH), 13) |
||
1419 | ingob | 84 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV) |
1166 | hbuss | 85 | endif |
1171 | hbuss | 86 | ifeq ($(VERSION_PATCH), 14) |
1419 | ingob | 87 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV) |
1171 | hbuss | 88 | endif |
89 | ifeq ($(VERSION_PATCH), 15) |
||
1419 | ingob | 90 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV) |
1171 | hbuss | 91 | endif |
92 | ifeq ($(VERSION_PATCH), 16) |
||
1419 | ingob | 93 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV) |
1171 | hbuss | 94 | endif |
1694 | holgerb | 95 | ifeq ($(VERSION_PATCH), 17) |
96 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV) |
||
97 | endif |
||
98 | ifeq ($(VERSION_PATCH), 18) |
||
99 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)s_SVN$(REV) |
||
100 | endif |
||
101 | ifeq ($(VERSION_PATCH), 19) |
||
1696 | holgerb | 102 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)t_SVN$(REV) |
1694 | holgerb | 103 | endif |
104 | ifeq ($(VERSION_PATCH), 20) |
||
1696 | holgerb | 105 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)u_SVN$(REV) |
1694 | holgerb | 106 | endif |
1951 | holgerb | 107 | ifeq ($(VERSION_PATCH), 21) |
108 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)v_SVN$(REV) |
||
109 | endif |
||
110 | ifeq ($(VERSION_PATCH), 22) |
||
111 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)w_SVN$(REV) |
||
112 | endif |
||
113 | ifeq ($(VERSION_PATCH), 23) |
||
114 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)x_SVN$(REV) |
||
115 | endif |
||
116 | ifeq ($(VERSION_PATCH), 24) |
||
117 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)y_SVN$(REV) |
||
118 | endif |
||
119 | ifeq ($(VERSION_PATCH), 25) |
||
120 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)z_SVN$(REV) |
||
121 | endif |
||
1 | ingob | 122 | |
1419 | ingob | 123 | |
1 | ingob | 124 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
125 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
||
1490 | killagreg | 126 | OPT = s |
1491 | killagreg | 127 | #OPT = 2 |
1 | ingob | 128 | |
129 | ########################################################################################################## |
||
130 | # List C source files here. (C dependencies are automatically generated.) |
||
1622 | killagreg | 131 | SRC = main.c uart.c timer0.c analog.c menu.c eeprom.c |
1426 | ingob | 132 | SRC += twimaster.c rc.c fc.c GPS.c spi.c led.c Spektrum.c |
1636 | ingob | 133 | SRC += mymath.c jetimenu.c capacity.c debug.c |
1917 | holgerb | 134 | SRC += hottmenu.c |
1 | ingob | 135 | |
136 | ########################################################################################################## |
||
137 | |||
138 | |||
139 | # List Assembler source files here. |
||
140 | # Make them always end in a capital .S. Files ending in a lowercase .s |
||
141 | # will not be considered source files but generated files (assembler |
||
142 | # output from the compiler), and will be deleted upon "make clean"! |
||
143 | # Even though the DOS/Win* filesystem matches both .s and .S the same, |
||
144 | # it will preserve the spelling of the filenames, and gcc itself does |
||
145 | # care about how the name is spelled on its command-line. |
||
1330 | killagreg | 146 | ASRC = isqrt.S |
1 | ingob | 147 | |
148 | |||
149 | |||
150 | # List any extra directories to look for include files here. |
||
151 | # Each directory must be seperated by a space. |
||
152 | EXTRAINCDIRS = |
||
153 | |||
154 | |||
155 | # Optional compiler flags. |
||
156 | # -g: generate debugging information (for GDB, or for COFF conversion) |
||
157 | # -O*: optimization level |
||
158 | # -f...: tuning, see gcc manual and avr-libc documentation |
||
159 | # -Wall...: warning level |
||
160 | # -Wa,...: tell GCC to pass this to the assembler. |
||
161 | # -ahlms: create assembler listing |
||
1444 | ingob | 162 | CFLAGS = -O$(OPT) -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=$(<:%.c=%.lst) $(patsubst %,-I%,$(EXTRAINCDIRS)) |
1 | ingob | 163 | |
1491 | killagreg | 164 | |
1 | ingob | 165 | # Set a "language standard" compiler flag. |
166 | # Unremark just one line below to set the language standard to use. |
||
167 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
||
168 | #CFLAGS += -std=c89 |
||
169 | #CFLAGS += -std=gnu89 |
||
170 | #CFLAGS += -std=c99 |
||
171 | CFLAGS += -std=gnu99 |
||
172 | |||
1491 | killagreg | 173 | # shrink code size |
174 | CFLAGS += -mtiny-stack |
||
175 | #CFLAGS += -fno-inline-functions |
||
176 | CFLAGS += -mcall-prologues |
||
177 | |||
1444 | ingob | 178 | CFLAGS += -DF_CPU=$(F_CPU) -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE) |
1 | ingob | 179 | |
180 | |||
181 | # Optional assembler flags. |
||
182 | # -Wa,...: tell GCC to pass this to the assembler. |
||
183 | # -ahlms: create listing |
||
184 | # -gstabs: have the assembler create line number information; note that |
||
185 | # for use in COFF files, additional information about filenames |
||
186 | # and function names needs to be present in the assembler source |
||
187 | # files -- see avr-libc docs [FIXME: not yet described there] |
||
188 | ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
||
189 | |||
190 | |||
191 | |||
192 | # Optional linker flags. |
||
193 | # -Wl,...: tell GCC to pass this to linker. |
||
194 | # -Map: create map file |
||
195 | # --cref: add cross reference to map file |
||
196 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
||
197 | |||
198 | # Additional libraries |
||
199 | |||
200 | # Minimalistic printf version |
||
201 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
||
202 | |||
203 | # Floating point printf version (requires -lm below) |
||
204 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
||
205 | |||
206 | # -lm = math library |
||
207 | LDFLAGS += -lm |
||
208 | |||
1571 | killagreg | 209 | LDFLAGS += libfc$(LIBFC_EXT).a |
1 | ingob | 210 | |
211 | ##LDFLAGS += -T./linkerfile/avr5.x |
||
212 | |||
213 | |||
214 | |||
215 | # Programming support using avrdude. Settings and variables. |
||
216 | |||
217 | # Programming hardware: alf avr910 avrisp bascom bsd |
||
218 | # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
||
219 | # |
||
220 | # Type: avrdude -c ? |
||
221 | # to get a full listing. |
||
222 | # |
||
595 | hbuss | 223 | #AVRDUDE_PROGRAMMER = dt006 |
1 | ingob | 224 | #AVRDUDE_PROGRAMMER = stk200 |
225 | #AVRDUDE_PROGRAMMER = ponyser |
||
595 | hbuss | 226 | AVRDUDE_PROGRAMMER = avrispv2 |
1 | ingob | 227 | #falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
228 | |||
595 | hbuss | 229 | #AVRDUDE_PORT = com1 # programmer connected to serial device |
230 | #AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
||
231 | AVRDUDE_PORT = usb # programmer connected to USB |
||
1 | ingob | 232 | |
233 | #AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
||
234 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
||
235 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
||
236 | |||
595 | hbuss | 237 | #avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex |
1 | ingob | 238 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
239 | |||
240 | # Uncomment the following if you want avrdude's erase cycle counter. |
||
241 | # Note that this counter needs to be initialized first using -Yn, |
||
242 | # see avrdude manual. |
||
243 | #AVRDUDE_ERASE += -y |
||
244 | |||
245 | # Uncomment the following if you do /not/ wish a verification to be |
||
246 | # performed after programming the device. |
||
247 | AVRDUDE_FLAGS += -V |
||
248 | |||
249 | # Increase verbosity level. Please use this when submitting bug |
||
250 | # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
||
251 | # to submit bug reports. |
||
252 | #AVRDUDE_FLAGS += -v -v |
||
253 | |||
254 | # --------------------------------------------------------------------------- |
||
255 | # Define directories, if needed. |
||
256 | DIRAVR = c:/winavr |
||
257 | DIRAVRBIN = $(DIRAVR)/bin |
||
258 | DIRAVRUTILS = $(DIRAVR)/utils/bin |
||
259 | DIRINC = . |
||
260 | DIRLIB = $(DIRAVR)/avr/lib |
||
261 | |||
262 | |||
263 | # Define programs and commands. |
||
264 | SHELL = sh |
||
265 | |||
266 | CC = avr-gcc |
||
267 | |||
268 | OBJCOPY = avr-objcopy |
||
269 | OBJDUMP = avr-objdump |
||
270 | SIZE = avr-size |
||
271 | |||
272 | # Programming support using avrdude. |
||
273 | AVRDUDE = avrdude |
||
274 | |||
275 | REMOVE = rm -f |
||
276 | COPY = cp |
||
277 | |||
278 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
||
1642 | killagreg | 279 | ELFSIZE = $(SIZE) -x -A $(TARGET).elf |
1561 | killagreg | 280 | LIMITS = $(SIZE) --mcu=$(MCU) -C $(TARGET).elf |
1 | ingob | 281 | |
1490 | killagreg | 282 | |
1 | ingob | 283 | # Define Messages |
284 | # English |
||
285 | MSG_ERRORS_NONE = Errors: none |
||
286 | MSG_BEGIN = -------- begin -------- |
||
287 | MSG_END = -------- end -------- |
||
288 | MSG_SIZE_BEFORE = Size before: |
||
289 | MSG_SIZE_AFTER = Size after: |
||
290 | MSG_COFF = Converting to AVR COFF: |
||
291 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
||
292 | MSG_FLASH = Creating load file for Flash: |
||
293 | MSG_EEPROM = Creating load file for EEPROM: |
||
294 | MSG_EXTENDED_LISTING = Creating Extended Listing: |
||
295 | MSG_SYMBOL_TABLE = Creating Symbol Table: |
||
296 | MSG_LINKING = Linking: |
||
297 | MSG_COMPILING = Compiling: |
||
298 | MSG_ASSEMBLING = Assembling: |
||
299 | MSG_CLEANING = Cleaning project: |
||
300 | |||
301 | |||
302 | # Define all object files. |
||
1424 | ingob | 303 | OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
1 | ingob | 304 | |
305 | # Define all listing files. |
||
306 | LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
||
307 | |||
308 | # Combine all necessary flags and optional flags. |
||
309 | # Add target processor to flags. |
||
310 | #ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
||
311 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
||
312 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
||
313 | |||
314 | |||
315 | # Default target. |
||
1444 | ingob | 316 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex sizeafter finished end |
1 | ingob | 317 | |
318 | |||
319 | # Eye candy. |
||
320 | # AVR Studio 3.x does not check make's exit code but relies on |
||
321 | # the following magic strings to be generated by the compile job. |
||
322 | begin: |
||
323 | @echo |
||
324 | @echo $(MSG_BEGIN) |
||
325 | |||
326 | finished: |
||
327 | @echo $(MSG_ERRORS_NONE) |
||
328 | |||
329 | end: |
||
330 | @echo $(MSG_END) |
||
331 | @echo |
||
332 | |||
333 | |||
334 | # Display size of file. |
||
335 | sizebefore: |
||
1490 | killagreg | 336 | @if [ -f $(TARGET).elf ]; then echo Size before:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
1 | ingob | 337 | sizeafter: |
1490 | killagreg | 338 | @if [ -f $(TARGET).elf ]; then echo Size after:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
1 | ingob | 339 | |
340 | |||
341 | # Display compiler version information. |
||
342 | gccversion : |
||
343 | @$(CC) --version |
||
344 | |||
345 | |||
346 | # Convert ELF to COFF for use in debugging / simulating in |
||
347 | # AVR Studio or VMLAB. |
||
348 | COFFCONVERT=$(OBJCOPY) --debugging \ |
||
349 | --change-section-address .data-0x800000 \ |
||
350 | --change-section-address .bss-0x800000 \ |
||
351 | --change-section-address .noinit-0x800000 \ |
||
352 | --change-section-address .eeprom-0x810000 |
||
353 | |||
354 | |||
355 | coff: $(TARGET).elf |
||
356 | @echo |
||
357 | @echo $(MSG_COFF) $(TARGET).cof |
||
358 | $(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
||
359 | |||
360 | |||
361 | extcoff: $(TARGET).elf |
||
362 | @echo |
||
363 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
||
364 | $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
||
365 | |||
366 | |||
367 | |||
368 | |||
369 | # Program the device. |
||
370 | program: $(TARGET).hex $(TARGET).eep |
||
371 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
||
372 | |||
373 | |||
374 | |||
375 | |||
376 | # Create final output files (.hex, .eep) from ELF output file. |
||
377 | %.hex: %.elf |
||
378 | @echo |
||
379 | @echo $(MSG_FLASH) $@ |
||
380 | $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
||
381 | |||
382 | %.eep: %.elf |
||
383 | @echo |
||
384 | @echo $(MSG_EEPROM) $@ |
||
385 | -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
||
386 | --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
||
387 | |||
388 | # Create extended listing file from ELF output file. |
||
389 | %.lss: %.elf |
||
390 | @echo |
||
391 | @echo $(MSG_EXTENDED_LISTING) $@ |
||
392 | $(OBJDUMP) -h -S $< > $@ |
||
393 | |||
394 | # Create a symbol table from ELF output file. |
||
395 | %.sym: %.elf |
||
396 | @echo |
||
397 | @echo $(MSG_SYMBOL_TABLE) $@ |
||
398 | avr-nm -n $< > $@ |
||
399 | |||
400 | |||
401 | |||
402 | # Link: create ELF output file from object files. |
||
403 | .SECONDARY : $(TARGET).elf |
||
404 | .PRECIOUS : $(OBJ) |
||
405 | %.elf: $(OBJ) |
||
406 | @echo |
||
407 | @echo $(MSG_LINKING) $@ |
||
408 | $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
||
409 | |||
410 | |||
411 | # Compile: create object files from C source files. |
||
412 | %.o : %.c |
||
413 | @echo |
||
414 | @echo $(MSG_COMPILING) $< |
||
415 | $(CC) -c $(ALL_CFLAGS) $< -o $@ |
||
416 | |||
417 | |||
418 | # Compile: create assembler files from C source files. |
||
419 | %.s : %.c |
||
420 | $(CC) -S $(ALL_CFLAGS) $< -o $@ |
||
421 | |||
422 | |||
423 | # Assemble: create object files from assembler source files. |
||
424 | %.o : %.S |
||
425 | @echo |
||
426 | @echo $(MSG_ASSEMBLING) $< |
||
427 | $(CC) -c $(ALL_ASFLAGS) $< -o $@ |
||
428 | |||
429 | |||
430 | |||
431 | |||
432 | |||
433 | |||
434 | # Target: clean project. |
||
435 | clean: begin clean_list finished end |
||
436 | |||
437 | clean_list : |
||
438 | @echo |
||
439 | @echo $(MSG_CLEANING) |
||
1431 | ingob | 440 | $(REMOVE) Flight-Ctrl_*.hex |
1444 | ingob | 441 | $(REMOVE) Flight-Ctrl_*.eep |
1 | ingob | 442 | $(REMOVE) $(TARGET).obj |
443 | $(REMOVE) $(TARGET).cof |
||
1444 | ingob | 444 | $(REMOVE) Flight-Ctrl_*.elf |
445 | $(REMOVE) Flight-Ctrl_*.map |
||
1 | ingob | 446 | $(REMOVE) $(TARGET).obj |
447 | $(REMOVE) $(TARGET).a90 |
||
1444 | ingob | 448 | $(REMOVE) Flight-Ctrl_*.sym |
1 | ingob | 449 | $(REMOVE) $(TARGET).lnk |
450 | $(REMOVE) $(TARGET).lss |
||
1431 | ingob | 451 | $(REMOVE) $(OBJ) |
1 | ingob | 452 | $(REMOVE) $(LST) |
453 | $(REMOVE) $(SRC:.c=.s) |
||
454 | $(REMOVE) $(SRC:.c=.d) |
||
1419 | ingob | 455 | $(REMOVE) $(SRC:.c=.o) |
1 | ingob | 456 | |
457 | |||
458 | # Automatically generate C source code dependencies. |
||
459 | # (Code originally taken from the GNU make user manual and modified |
||
460 | # (See README.txt Credits).) |
||
461 | # |
||
462 | # Note that this will work with sh (bash) and sed that is shipped with WinAVR |
||
463 | # (see the SHELL variable defined above). |
||
464 | # This may not work with other shells or other seds. |
||
465 | # |
||
466 | %.d: %.c |
||
467 | set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
||
468 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
||
469 | [ -s $@ ] || rm -f $@ |
||
470 | |||
471 | |||
472 | # Remove the '-' if you want to see the dependency files generated. |
||
1444 | ingob | 473 | -include $(SRC:%.c=%.d) |
1 | ingob | 474 | |
475 | |||
476 | |||
477 | # Listing of phony targets. |
||
478 | .PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
||
479 | clean clean_list program |
||
480 |