1 | # MCU name
|
2 | MCU = atmega16
|
3 |
|
4 |
|
5 | # Processor frequency.
|
6 | # This will define a symbol, F_CPU, in all source code files equal
|
7 | to the
|
8 | # processor frequency. You can then use this symbol in your source
|
9 | code to
|
10 | # calculate timings. Do NOT tack on a 'UL' at the end, this will
|
11 | be done
|
12 | # automatically to create a 32-bit value in your source code.
|
13 | # Typical values are:
|
14 | # F_CPU = 1000000
|
15 | # F_CPU = 1843200
|
16 | # F_CPU = 2000000
|
17 | # F_CPU = 3686400
|
18 | # F_CPU = 4000000
|
19 | # F_CPU = 7372800
|
20 | # F_CPU = 8000000
|
21 | # F_CPU = 11059200
|
22 | # F_CPU = 14745600
|
23 | # F_CPU = 16000000
|
24 | # F_CPU = 18432000
|
25 | # F_CPU = 20000000
|
26 | F_CPU = 8000000
|
27 |
|
28 |
|
29 | # Output format. (can be srec, ihex, binary)
|
30 | FORMAT = ihex
|
31 |
|
32 |
|
33 | # Target file name (without extension).
|
34 | TARGET = robosapien
|
35 |
|
36 |
|
37 | # Object files directory
|
38 | OBJDIR = obj
|
39 |
|
40 |
|
41 | # List C source files here. (C dependencies are automatically
|
42 | generated.)
|
43 | SRC =
|
44 |
|
45 |
|
46 | # List C++ source files here. (C dependencies are automatically
|
47 | generated.)
|
48 | CPPSRC = main.cpp
|
49 |
|
50 |
|
51 | # List Assembler source files here.
|
52 | # Make them always end in a capital .S. Files ending in a
|
53 | lowercase .s
|
54 | # will not be considered source files but generated files
|
55 | (assembler
|
56 | # output from the compiler), and will be deleted upon "make
|
57 | clean"!
|
58 | # Even though the DOS/Win* filesystem matches both .s and .S the
|
59 | same,
|
60 | # it will preserve the spelling of the filenames, and gcc itself
|
61 | does
|
62 | # care about how the name is spelled on its command-line.
|
63 | ASRC =
|
64 |
|
65 |
|
66 | # Optimization level, can be [0, 1, 2, 3, s].
|
67 | # 0 = turn off optimization. s = optimize for size.
|
68 | # (Note: 3 is not always the best optimization level. See avr-libc
|
69 | FAQ.)
|
70 | OPT = s
|
71 |
|
72 |
|
73 | # Debugging format.
|
74 | # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
|
75 | # AVR Studio 4.10 requires dwarf-2.
|
76 | # AVR [Extended] COFF format requires stabs, plus an avr-objcopy
|
77 | run.
|
78 | DEBUG = stabs
|
79 |
|
80 |
|
81 | # List any extra directories to look for include files here.
|
82 | # Each directory must be seperated by a space.
|
83 | # Use forward slashes for directory separators.
|
84 | # For a directory that has spaces, enclose it in quotes.
|
85 | EXTRAINCDIRS =
|
86 |
|
87 |
|
88 | # Compiler flag to set the C Standard level.
|
89 | # c89 = "ANSI" C
|
90 | # gnu89 = c89 plus GCC extensions
|
91 | # c99 = ISO C99 standard (not yet fully implemented)
|
92 | # gnu99 = c99 plus GCC extensions
|
93 | CSTANDARD = -std=gnu99
|
94 |
|
95 |
|
96 | # Place -D or -U options here for C sources
|
97 | CDEFS = -DF_CPU=$(F_CPU)UL
|
98 |
|
99 |
|
100 | # Place -D or -U options here for C++ sources
|
101 | CPPDEFS = -DF_CPU=$(F_CPU)UL
|
102 | #CPPDEFS += -D__STDC_LIMIT_MACROS
|
103 | #CPPDEFS += -D__STDC_CONSTANT_MACROS
|
104 |
|
105 |
|
106 |
|
107 | #---------------- Compiler Options C ----------------
|
108 | # -g*: generate debugging information
|
109 | # -O*: optimization level
|
110 | # -f...: tuning, see GCC manual and avr-libc documentation
|
111 | # -Wall...: warning level
|
112 | # -Wa,...: tell GCC to pass this to the assembler.
|
113 | # -adhlns...: create assembler listing
|
114 | CFLAGS = -g$(DEBUG)
|
115 | CFLAGS += $(CDEFS)
|
116 | CFLAGS += -O$(OPT)
|
117 | #CFLAGS += -mint8
|
118 | #CFLAGS += -mshort-calls
|
119 | CFLAGS += -funsigned-char
|
120 | CFLAGS += -funsigned-bitfields
|
121 | CFLAGS += -fpack-struct
|
122 | CFLAGS += -fshort-enums
|
123 | #CFLAGS += -fno-unit-at-a-time
|
124 | CFLAGS += -Wall
|
125 | CFLAGS += -Wstrict-prototypes
|
126 | CFLAGS += -Wundef
|
127 | #CFLAGS += -Wunreachable-code
|
128 | #CFLAGS += -Wsign-compare
|
129 | CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
130 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
131 | CFLAGS += $(CSTANDARD)
|
132 |
|
133 |
|
134 | #---------------- Compiler Options C++ ----------------
|
135 | # -g*: generate debugging information
|
136 | # -O*: optimization level
|
137 | # -f...: tuning, see GCC manual and avr-libc documentation
|
138 | # -Wall...: warning level
|
139 | # -Wa,...: tell GCC to pass this to the assembler.
|
140 | # -adhlns...: create assembler listing
|
141 | CPPFLAGS = -g$(DEBUG)
|
142 | CPPFLAGS += $(CPPDEFS)
|
143 | CPPFLAGS += -O$(OPT)
|
144 | #CPPFLAGS += -mint8
|
145 | #CPPFLAGS += -mshort-calls
|
146 | CPPFLAGS += -funsigned-char
|
147 | CPPFLAGS += -funsigned-bitfields
|
148 | CPPFLAGS += -fpack-struct
|
149 | CPPFLAGS += -fshort-enums
|
150 | CPPFLAGS += -fno-exceptions
|
151 | #CPPFLAGS += -fno-unit-at-a-time
|
152 | CPPFLAGS += -Wall
|
153 | #CPPFLAGS += -Wstrict-prototypes
|
154 | CFLAGS += -Wundef
|
155 | #CPPFLAGS += -Wunreachable-code
|
156 | #CPPFLAGS += -Wsign-compare
|
157 | CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
|
158 | CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
159 | #CPPFLAGS += $(CSTANDARD)
|
160 |
|
161 |
|
162 | #---------------- Assembler Options ----------------
|
163 | # -Wa,...: tell GCC to pass this to the assembler.
|
164 | # -ahlms: create listing
|
165 | # -gstabs: have the assembler create line number information; note
|
166 | that
|
167 | # for use in COFF files, additional information about
|
168 | filenames
|
169 | # and function names needs to be present in the assembler
|
170 | source
|
171 | # files -- see avr-libc docs [FIXME: not yet described
|
172 | there]
|
173 | ASFLAGS = -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs
|
174 |
|
175 |
|
176 | #---------------- Library Options ----------------
|
177 | # Minimalistic printf version
|
178 | PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
|
179 |
|
180 | # Floating point printf version (requires MATH_LIB = -lm below)
|
181 | PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
|
182 |
|
183 | # If this is left blank, then it will use the Standard printf version.
|
184 | PRINTF_LIB =
|
185 | #PRINTF_LIB = $(PRINTF_LIB_MIN)
|
186 | #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
|
187 |
|
188 |
|
189 | # Minimalistic scanf version
|
190 | SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
|
191 |
|
192 | # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
|
193 | SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
|
194 |
|
195 | # If this is left blank, then it will use the Standard scanf version.
|
196 | SCANF_LIB =
|
197 | #SCANF_LIB = $(SCANF_LIB_MIN)
|
198 | #SCANF_LIB = $(SCANF_LIB_FLOAT)
|
199 |
|
200 |
|
201 | MATH_LIB = -lm
|
202 |
|
203 |
|
204 |
|
205 | #---------------- External Memory Options ----------------
|
206 |
|
207 | # 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
208 | # used for variables (.data/.bss) and heap (malloc()).
|
209 | #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
|
210 |
|
211 | # 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
212 | # only used for heap (malloc()).
|
213 | #EXTMEMOPTS =
|
214 | -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
|
215 |
|
216 | EXTMEMOPTS =
|
217 |
|
218 |
|
219 |
|
220 | #---------------- Linker Options ----------------
|
221 | # -Wl,...: tell GCC to pass this to linker.
|
222 | # -Map: create map file
|
223 | # --cref: add cross reference to map file
|
224 | LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
225 | LDFLAGS += $(EXTMEMOPTS)
|
226 | LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
|
227 | #LDFLAGS += -T linker_script.x
|
228 |
|
229 |
|
230 |
|
231 | #---------------- Programming Options (avrdude) ----------------
|
232 |
|
233 | # Programming hardware: alf avr910 avrisp bascom bsd
|
234 | # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
|
235 | #
|
236 | # Type: avrdude -c ?
|
237 | # to get a full listing.
|
238 | #
|
239 | AVRDUDE_PROGRAMMER = pony-stk200
|
240 |
|
241 | # com1 = serial port. Use lpt1 to connect to parallel port.
|
242 | AVRDUDE_PORT = lpt1
|
243 |
|
244 | AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
245 | #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
246 |
|
247 |
|
248 | # Uncomment the following if you want avrdude's erase cycle counter.
|
249 | # Note that this counter needs to be initialized first using -Yn,
|
250 | # see avrdude manual.
|
251 | #AVRDUDE_ERASE_COUNTER = -y
|
252 |
|
253 | # Uncomment the following if you do /not/ wish a verification to be
|
254 | # performed after programming the device.
|
255 | #AVRDUDE_NO_VERIFY = -V
|
256 |
|
257 | # Increase verbosity level. Please use this when submitting bug
|
258 | # reports about avrdude. See
|
259 | <http://savannah.nongnu.org/projects/avrdude>
|
260 | # to submit bug reports.
|
261 | #AVRDUDE_VERBOSE = -v -v
|
262 |
|
263 | AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
264 | AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
265 | AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
266 | AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
267 |
|
268 |
|
269 |
|
270 | #---------------- Debugging Options ----------------
|
271 |
|
272 | # For simulavr only - target MCU frequency.
|
273 | DEBUG_MFREQ = $(F_CPU)
|
274 |
|
275 | # Set the DEBUG_UI to either gdb or insight.
|
276 | # DEBUG_UI = gdb
|
277 | DEBUG_UI = insight
|
278 |
|
279 | # Set the debugging back-end to either avarice, simulavr.
|
280 | DEBUG_BACKEND = avarice
|
281 | #DEBUG_BACKEND = simulavr
|
282 |
|
283 | # GDB Init Filename.
|
284 | GDBINIT_FILE = __avr_gdbinit
|
285 |
|
286 | # When using avarice settings for the JTAG
|
287 | JTAG_DEV = /dev/com1
|
288 |
|
289 | # Debugging port used to communicate between GDB / avarice / simulavr.
|
290 | DEBUG_PORT = 4242
|
291 |
|
292 | # Debugging host used to communicate between GDB / avarice / simulavr,
|
293 | normally
|
294 | # just set to localhost unless doing some sort of crazy debugging
|
295 | when
|
296 | # avarice is running on a different computer.
|
297 | DEBUG_HOST = localhost
|
298 |
|
299 |
|
300 |
|
301 | #============================================================================
|
302 |
|
303 |
|
304 | # Define programs and commands.
|
305 | SHELL = sh
|
306 | CC = avr-gcc
|
307 | OBJCOPY = avr-objcopy
|
308 | OBJDUMP = avr-objdump
|
309 | SIZE = avr-size
|
310 | NM = avr-nm
|
311 | AVRDUDE = avrdude
|
312 | REMOVE = rm -f
|
313 | REMOVEDIR = rm -rf
|
314 | COPY = cp
|
315 | WINSHELL = cmd
|
316 |
|
317 |
|
318 | # Define Messages
|
319 | # English
|
320 | MSG_ERRORS_NONE = Errors: none
|
321 | MSG_BEGIN = -------- begin --------
|
322 | MSG_END = -------- end --------
|
323 | MSG_SIZE_BEFORE = Size before:
|
324 | MSG_SIZE_AFTER = Size after:
|
325 | MSG_COFF = Converting to AVR COFF:
|
326 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
327 | MSG_FLASH = Creating load file for Flash:
|
328 | MSG_EEPROM = Creating load file for EEPROM:
|
329 | MSG_EXTENDED_LISTING = Creating Extended Listing:
|
330 | MSG_SYMBOL_TABLE = Creating Symbol Table:
|
331 | MSG_LINKING = Linking:
|
332 | MSG_COMPILING = Compiling C:
|
333 | MSG_COMPILING_CPP = Compiling C++:
|
334 | MSG_ASSEMBLING = Assembling:
|
335 | MSG_CLEANING = Cleaning project:
|
336 | MSG_CREATING_LIBRARY = Creating library:
|
337 |
|
338 |
|
339 |
|
340 |
|
341 | # Define all object files.
|
342 | OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o)
|
343 | $(ASRC:%.S=$(OBJDIR)/%.o)
|
344 |
|
345 | # Define all listing files.
|
346 | LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst)
|
347 | $(ASRC:%.S=$(OBJDIR)/%.lst)
|
348 |
|
349 |
|
350 | # Compiler flags to generate dependency files.
|
351 | GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
352 |
|
353 |
|
354 | # Combine all necessary flags and optional flags.
|
355 | # Add target processor to flags.
|
356 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
357 | ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
358 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 | # Default target.
|
365 | all: begin gccversion sizebefore build sizeafter end
|
366 |
|
367 | # Change the build target to build a HEX file or a library.
|
368 | build: elf hex eep lss sym extcoff
|
369 | #build: lib
|
370 |
|
371 |
|
372 | elf: $(TARGET).elf
|
373 | hex: $(TARGET).hex
|
374 | eep: $(TARGET).eep
|
375 | lss: $(TARGET).lss
|
376 | sym: $(TARGET).sym
|
377 | LIBNAME=lib$(TARGET).a
|
378 | lib: $(LIBNAME)
|
379 |
|
380 |
|
381 |
|
382 | # Eye candy.
|
383 | # AVR Studio 3.x does not check make's exit code but relies on
|
384 | # the following magic strings to be generated by the compile job.
|
385 | begin:
|
386 | @echo
|
387 | @echo $(MSG_BEGIN)
|
388 |
|
389 | end:
|
390 | @echo $(MSG_END)
|
391 | @echo
|
392 |
|
393 |
|
394 | # Display size of file.
|
395 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
396 | ELFSIZE = $(SIZE) -A $(TARGET).elf
|
397 | AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
|
398 |
|
399 | sizebefore:
|
400 | @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE);
|
401 | $(ELFSIZE); \
|
402 | $(AVRMEM) 2>/dev/null; echo; fi
|
403 |
|
404 | sizeafter:
|
405 | @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER);
|
406 | $(ELFSIZE); \
|
407 | $(AVRMEM) 2>/dev/null; echo; fi
|
408 |
|
409 |
|
410 |
|
411 | # Display compiler version information.
|
412 | gccversion :
|
413 | @$(CC) --version
|
414 |
|
415 |
|
416 |
|
417 | # Program the device.
|
418 | program: $(TARGET).hex $(TARGET).eep
|
419 | $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
|
420 | $(AVRDUDE_WRITE_EEPROM)
|
421 |
|
422 |
|
423 | # Generate avr-gdb config/init file which does the following:
|
424 | # define the reset signal, load the target file, connect to target,
|
425 | and set
|
426 | # a breakpoint at main().
|
427 | gdb-config:
|
428 | @$(REMOVE) $(GDBINIT_FILE)
|
429 | @echo define reset >> $(GDBINIT_FILE)
|
430 | @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
|
431 | @echo end >> $(GDBINIT_FILE)
|
432 | @echo file $(TARGET).elf >> $(GDBINIT_FILE)
|
433 | @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
|
434 | ifeq ($(DEBUG_BACKEND),simulavr)
|
435 | @echo load >> $(GDBINIT_FILE)
|
436 | endif
|
437 | @echo break main >> $(GDBINIT_FILE)
|
438 |
|
439 | debug: gdb-config $(TARGET).elf
|
440 | ifeq ($(DEBUG_BACKEND), avarice)
|
441 | @echo Starting AVaRICE - Press enter when "waiting to connect"
|
442 | message displays.
|
443 | @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program
|
444 | --file \
|
445 | $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
|
446 | @$(WINSHELL) /c pause
|
447 |
|
448 | else
|
449 | @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU)
|
450 | --clock-freq \
|
451 | $(DEBUG_MFREQ) --port $(DEBUG_PORT)
|
452 | endif
|
453 | @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
|
454 |
|
455 |
|
456 |
|
457 |
|
458 | # Convert ELF to COFF for use in debugging / simulating in AVR Studio
|
459 | or VMLAB.
|
460 | COFFCONVERT = $(OBJCOPY) --debugging
|
461 | COFFCONVERT += --change-section-address .data-0x800000
|
462 | COFFCONVERT += --change-section-address .bss-0x800000
|
463 | COFFCONVERT += --change-section-address .noinit-0x800000
|
464 | COFFCONVERT += --change-section-address .eeprom-0x810000
|
465 |
|
466 |
|
467 |
|
468 | coff: $(TARGET).elf
|
469 | @echo
|
470 | @echo $(MSG_COFF) $(TARGET).cof
|
471 | $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
|
472 |
|
473 |
|
474 | extcoff: $(TARGET).elf
|
475 | @echo
|
476 | @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
|
477 | $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
|
478 |
|
479 |
|
480 |
|
481 | # Create final output files (.hex, .eep) from ELF output file.
|
482 | %.hex: %.elf
|
483 | @echo
|
484 | @echo $(MSG_FLASH) $@
|
485 | $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
486 |
|
487 | %.eep: %.elf
|
488 | @echo
|
489 | @echo $(MSG_EEPROM) $@
|
490 | -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
491 | --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
492 |
|
493 | # Create extended listing file from ELF output file.
|
494 | %.lss: %.elf
|
495 | @echo
|
496 | @echo $(MSG_EXTENDED_LISTING) $@
|
497 | $(OBJDUMP) -h -S $< > $@
|
498 |
|
499 | # Create a symbol table from ELF output file.
|
500 | %.sym: %.elf
|
501 | @echo
|
502 | @echo $(MSG_SYMBOL_TABLE) $@
|
503 | $(NM) -n $< > $@
|
504 |
|
505 |
|
506 |
|
507 | # Create library from object files.
|
508 | .SECONDARY : $(TARGET).a
|
509 | .PRECIOUS : $(OBJ)
|
510 | %.a: $(OBJ)
|
511 | @echo
|
512 | @echo $(MSG_CREATING_LIBRARY) $@
|
513 | $(AR) $@ $(OBJ)
|
514 |
|
515 |
|
516 | # Link: create ELF output file from object files.
|
517 | .SECONDARY : $(TARGET).elf
|
518 | .PRECIOUS : $(OBJ)
|
519 | %.elf: $(OBJ)
|
520 | @echo
|
521 | @echo $(MSG_LINKING) $@
|
522 | $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
|
523 |
|
524 |
|
525 | # Compile: create object files from C source files.
|
526 | $(OBJDIR)/%.o : %.c
|
527 | @echo
|
528 | @echo $(MSG_COMPILING) $<
|
529 | $(CC) -c $(ALL_CFLAGS) $< -o $@
|
530 |
|
531 |
|
532 | # Compile: create object files from C++ source files.
|
533 | $(OBJDIR)/%.o : %.cpp
|
534 | @echo
|
535 | @echo $(MSG_COMPILING_CPP) $<
|
536 | $(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
537 |
|
538 |
|
539 | # Compile: create assembler files from C source files.
|
540 | %.s : %.c
|
541 | $(CC) -S $(ALL_CFLAGS) $< -o $@
|
542 |
|
543 |
|
544 | # Compile: create assembler files from C++ source files.
|
545 | %.s : %.cpp
|
546 | $(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
547 |
|
548 |
|
549 | # Assemble: create object files from assembler source files.
|
550 | $(OBJDIR)/%.o : %.S
|
551 | @echo
|
552 | @echo $(MSG_ASSEMBLING) $<
|
553 | $(CC) -c $(ALL_ASFLAGS) $< -o $@
|
554 |
|
555 |
|
556 | # Create preprocessed source for use in sending a bug report.
|
557 | %.i : %.c
|
558 | $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
|
559 |
|
560 |
|
561 | # Target: clean project.
|
562 | clean: begin clean_list end
|
563 |
|
564 | clean_list :
|
565 | @echo
|
566 | @echo $(MSG_CLEANING)
|
567 | $(REMOVE) $(TARGET).hex
|
568 | $(REMOVE) $(TARGET).eep
|
569 | $(REMOVE) $(TARGET).cof
|
570 | $(REMOVE) $(TARGET).elf
|
571 | $(REMOVE) $(TARGET).map
|
572 | $(REMOVE) $(TARGET).sym
|
573 | $(REMOVE) $(TARGET).lss
|
574 | $(REMOVEDIR) $(OBJDIR)
|
575 | $(REMOVE) $(SRC:.c=.s)
|
576 | $(REMOVE) $(SRC:.c=.d)
|
577 | $(REMOVEDIR) .dep
|
578 |
|
579 |
|
580 | # Create object files directory
|
581 | $(shell mkdir $(OBJDIR) 2>/dev/null)
|
582 |
|
583 |
|
584 | # Include the dependency files.
|
585 | -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
586 |
|
587 |
|
588 | # Listing of phony targets.
|
589 | .PHONY : all begin finish end sizebefore sizeafter gccversion \
|
590 | build elf hex eep lss sym coff extcoff \
|
591 | clean clean_list program debug gdb-config
|