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