Rev 1378 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1378 | Rev 1550 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | # MCU name |
2 | # MCU name |
3 | MCU = atmega644p |
3 | MCU = atmega644p |
4 | F_CPU = 20000000 |
4 | F_CPU = 20000000 |
5 | #------------------------------------------------------------------- |
5 | #------------------------------------------------------------------- |
6 | VERSION_MAJOR = 0 |
6 | VERSION_MAJOR = 0 |
7 | VERSION_MINOR = 76 |
7 | VERSION_MINOR = 78 |
8 | VERSION_PATCH = 6 |
8 | VERSION_PATCH = 0 |
Line 9... | Line 9... | ||
9 | 9 | ||
10 | VERSION_SERIAL_MAJOR = 10 # Serial Protocol |
10 | VERSION_SERIAL_MAJOR = 11 # Serial Protocol |
11 | VERSION_SERIAL_MINOR = 1 # Serial Protocol |
11 | VERSION_SERIAL_MINOR = 0 # Serial Protocol |
12 | NC_SPI_COMPATIBLE = 10 # Navi-Kompatibilität |
12 | NC_SPI_COMPATIBLE = 12 # Navi-Kompatibilität |
Line -... | Line 13... | ||
- | 13 | #------------------------------------------------------------------- |
|
- | 14 | ||
- | 15 | # get SVN revision |
|
13 | #------------------------------------------------------------------- |
16 | REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
14 | 17 | ||
Line 15... | Line 18... | ||
15 | ifeq ($(MCU), atmega32) |
18 | ifeq ($(MCU), atmega32) |
16 | # FUSE_SETTINGS= -u -U lfuse:w:0xff:m -U hfuse:w:0xcf:m |
19 | # FUSE_SETTINGS= -u -U lfuse:w:0xff:m -U hfuse:w:0xcf:m |
Line 43... | Line 46... | ||
43 | FORMAT = ihex |
46 | FORMAT = ihex |
Line 44... | Line 47... | ||
44 | 47 | ||
Line 45... | Line 48... | ||
45 | # Target file name (without extension). |
48 | # Target file name (without extension). |
46 | 49 | ||
47 | ifeq ($(VERSION_PATCH), 0) |
50 | ifeq ($(VERSION_PATCH), 0) |
48 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a |
51 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
49 | endif |
52 | endif |
50 | ifeq ($(VERSION_PATCH), 1) |
53 | ifeq ($(VERSION_PATCH), 1) |
51 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b |
54 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
52 | endif |
55 | endif |
53 | ifeq ($(VERSION_PATCH), 2) |
56 | ifeq ($(VERSION_PATCH), 2) |
54 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c |
57 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
55 | endif |
58 | endif |
56 | ifeq ($(VERSION_PATCH), 3) |
59 | ifeq ($(VERSION_PATCH), 3) |
57 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d |
60 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
58 | endif |
61 | endif |
59 | ifeq ($(VERSION_PATCH), 4) |
62 | ifeq ($(VERSION_PATCH), 4) |
60 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e |
63 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
61 | endif |
64 | endif |
62 | ifeq ($(VERSION_PATCH), 5) |
65 | ifeq ($(VERSION_PATCH), 5) |
63 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f |
66 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
64 | endif |
67 | endif |
65 | ifeq ($(VERSION_PATCH), 6) |
68 | ifeq ($(VERSION_PATCH), 6) |
66 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g |
69 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
67 | endif |
70 | endif |
68 | ifeq ($(VERSION_PATCH), 7) |
71 | ifeq ($(VERSION_PATCH), 7) |
69 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h |
72 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
70 | endif |
73 | endif |
71 | ifeq ($(VERSION_PATCH), 8) |
74 | ifeq ($(VERSION_PATCH), 8) |
72 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i |
75 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
73 | endif |
76 | endif |
74 | ifeq ($(VERSION_PATCH), 9) |
77 | ifeq ($(VERSION_PATCH), 9) |
75 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j |
78 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
76 | endif |
79 | endif |
77 | ifeq ($(VERSION_PATCH), 10) |
80 | ifeq ($(VERSION_PATCH), 10) |
78 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k |
81 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV) |
79 | endif |
82 | endif |
80 | ifeq ($(VERSION_PATCH), 11) |
83 | ifeq ($(VERSION_PATCH), 11) |
81 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)L |
84 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)L_SVN$(REV) |
82 | endif |
85 | endif |
83 | ifeq ($(VERSION_PATCH), 12) |
86 | ifeq ($(VERSION_PATCH), 12) |
84 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m |
87 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV) |
85 | endif |
88 | endif |
86 | ifeq ($(VERSION_PATCH), 13) |
89 | ifeq ($(VERSION_PATCH), 13) |
87 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n |
90 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV) |
88 | endif |
91 | endif |
89 | ifeq ($(VERSION_PATCH), 14) |
92 | ifeq ($(VERSION_PATCH), 14) |
90 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o |
93 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV) |
91 | endif |
94 | endif |
92 | ifeq ($(VERSION_PATCH), 15) |
95 | ifeq ($(VERSION_PATCH), 15) |
93 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p |
96 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV) |
94 | endif |
97 | endif |
95 | ifeq ($(VERSION_PATCH), 16) |
98 | ifeq ($(VERSION_PATCH), 16) |
Line -... | Line 99... | ||
- | 99 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV) |
|
96 | TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q |
100 | endif |
97 | endif |
101 | |
- | 102 | ||
98 | 103 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
|
Line 99... | Line 104... | ||
99 | # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
104 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
100 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
105 | OPT = s |
101 | OPT = 2 |
106 | #OPT = 2 |
102 | 107 | ||
103 | ########################################################################################################## |
108 | ########################################################################################################## |
Line 104... | Line 109... | ||
104 | # List C source files here. (C dependencies are automatically generated.) |
109 | # List C source files here. (C dependencies are automatically generated.) |
Line 105... | Line 110... | ||
105 | SRC = main.c uart.c printf_P.c timer0.c analog.c menu.c |
110 | SRC = main.c uart.c timer0.c analog.c menu.c |
Line 130... | Line 135... | ||
130 | # -O*: optimization level |
135 | # -O*: optimization level |
131 | # -f...: tuning, see gcc manual and avr-libc documentation |
136 | # -f...: tuning, see gcc manual and avr-libc documentation |
132 | # -Wall...: warning level |
137 | # -Wall...: warning level |
133 | # -Wa,...: tell GCC to pass this to the assembler. |
138 | # -Wa,...: tell GCC to pass this to the assembler. |
134 | # -ahlms: create assembler listing |
139 | # -ahlms: create assembler listing |
135 | CFLAGS = -O$(OPT) \ |
- | |
136 | -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
140 | CFLAGS = -O$(OPT) -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=$(<:%.c=%.lst) $(patsubst %,-I%,$(EXTRAINCDIRS)) |
137 | -Wall -Wstrict-prototypes \ |
- | |
138 | -Wa,-adhlns=$(<:.c=.lst) \ |
- | |
139 | $(patsubst %,-I%,$(EXTRAINCDIRS)) |
- | |
Line 140... | Line 141... | ||
140 | 141 | ||
141 | 142 | ||
142 | # Set a "language standard" compiler flag. |
143 | # Set a "language standard" compiler flag. |
143 | # Unremark just one line below to set the language standard to use. |
144 | # Unremark just one line below to set the language standard to use. |
144 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
145 | # gnu99 = C99 + GNU extensions. See GCC manual for more information. |
145 | #CFLAGS += -std=c89 |
146 | #CFLAGS += -std=c89 |
146 | #CFLAGS += -std=gnu89 |
147 | #CFLAGS += -std=gnu89 |
Line -... | Line 148... | ||
- | 148 | #CFLAGS += -std=c99 |
|
- | 149 | CFLAGS += -std=gnu99 |
|
- | 150 | ||
- | 151 | # shrink code size |
|
- | 152 | CFLAGS += -mtiny-stack |
|
147 | #CFLAGS += -std=c99 |
153 | #CFLAGS += -fno-inline-functions |
Line 148... | Line 154... | ||
148 | CFLAGS += -std=gnu99 |
154 | CFLAGS += -mcall-prologues |
149 | 155 | ||
150 | CFLAGS += -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) |
156 | 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) |
Line 176... | Line 182... | ||
176 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
182 | #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
Line 177... | Line 183... | ||
177 | 183 | ||
178 | # -lm = math library |
184 | # -lm = math library |
Line -... | Line 185... | ||
- | 185 | LDFLAGS += -lm |
|
Line 179... | Line 186... | ||
179 | LDFLAGS += -lm |
186 | |
Line 246... | Line 253... | ||
246 | REMOVE = rm -f |
253 | REMOVE = rm -f |
247 | COPY = cp |
254 | COPY = cp |
Line 248... | Line 255... | ||
248 | 255 | ||
249 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
256 | HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
- | 257 | ELFSIZE = $(SIZE) -A $(TARGET).elf |
|
- | 258 | LIMITS = $(SIZE) --mcu=atmega644 -C $(TARGET).elf |
|
Line 250... | Line 259... | ||
250 | ELFSIZE = $(SIZE) -A $(TARGET).elf |
259 | |
251 | 260 | ||
252 | # Define Messages |
261 | # Define Messages |
253 | # English |
262 | # English |
Line 280... | Line 289... | ||
280 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
289 | ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
281 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
290 | ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
Line 282... | Line 291... | ||
282 | 291 | ||
283 | 292 | ||
284 | # Default target. |
- | |
Line 285... | Line 293... | ||
285 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
293 | # Default target. |
286 | $(TARGET).lss $(TARGET).sym sizeafter finished end |
294 | all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex sizeafter finished end |
287 | 295 | ||
Line 300... | Line 308... | ||
300 | @echo $(MSG_END) |
308 | @echo $(MSG_END) |
301 | @echo |
309 | @echo |
Line 302... | Line 310... | ||
302 | 310 | ||
303 | - | ||
304 | # Display size of file. |
311 | |
305 | # Display size of file. |
312 | # Display size of file. |
306 | sizebefore: |
313 | sizebefore: |
307 | @if [ -f $(TARGET).elf ]; then echo Size before:; $(ELFSIZE); $(HEXSIZE); echo; fi |
314 | @if [ -f $(TARGET).elf ]; then echo Size before:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
Line 308... | Line 315... | ||
308 | sizeafter: |
315 | sizeafter: |
309 | @if [ -f $(TARGET).elf ]; then echo Size after:; $(ELFSIZE); $(HEXSIZE); echo; fi |
316 | @if [ -f $(TARGET).elf ]; then echo Size after:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
310 | 317 | ||
Line 406... | Line 413... | ||
406 | clean: begin clean_list finished end |
413 | clean: begin clean_list finished end |
Line 407... | Line 414... | ||
407 | 414 | ||
408 | clean_list : |
415 | clean_list : |
409 | @echo |
416 | @echo |
410 | @echo $(MSG_CLEANING) |
417 | @echo $(MSG_CLEANING) |
411 | # $(REMOVE) $(TARGET).hex |
418 | $(REMOVE) Flight-Ctrl_*.hex |
412 | $(REMOVE) $(TARGET).eep |
419 | $(REMOVE) Flight-Ctrl_*.eep |
413 | $(REMOVE) $(TARGET).obj |
420 | $(REMOVE) $(TARGET).obj |
414 | $(REMOVE) $(TARGET).cof |
421 | $(REMOVE) $(TARGET).cof |
415 | $(REMOVE) $(TARGET).elf |
422 | $(REMOVE) Flight-Ctrl_*.elf |
416 | $(REMOVE) $(TARGET).map |
423 | $(REMOVE) Flight-Ctrl_*.map |
417 | $(REMOVE) $(TARGET).obj |
424 | $(REMOVE) $(TARGET).obj |
418 | $(REMOVE) $(TARGET).a90 |
425 | $(REMOVE) $(TARGET).a90 |
419 | $(REMOVE) $(TARGET).sym |
426 | $(REMOVE) Flight-Ctrl_*.sym |
420 | $(REMOVE) $(TARGET).lnk |
427 | $(REMOVE) $(TARGET).lnk |
421 | $(REMOVE) $(TARGET).lss |
428 | $(REMOVE) $(TARGET).lss |
422 | $(REMOVE) $(OBJ) |
429 | $(REMOVE) $(OBJ) |
423 | $(REMOVE) $(LST) |
430 | $(REMOVE) $(LST) |
424 | $(REMOVE) $(SRC:.c=.s) |
431 | $(REMOVE) $(SRC:.c=.s) |
- | 432 | $(REMOVE) $(SRC:.c=.d) |
|
Line 425... | Line 433... | ||
425 | $(REMOVE) $(SRC:.c=.d) |
433 | $(REMOVE) $(SRC:.c=.o) |
426 | 434 | ||
427 | 435 | ||
Line 438... | Line 446... | ||
438 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
446 | | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
439 | [ -s $@ ] || rm -f $@ |
447 | [ -s $@ ] || rm -f $@ |
Line 440... | Line 448... | ||
440 | 448 | ||
441 | 449 | ||
Line 442... | Line 450... | ||
442 | # Remove the '-' if you want to see the dependency files generated. |
450 | # Remove the '-' if you want to see the dependency files generated. |
443 | -include $(SRC:.c=.d) |
451 | -include $(SRC:%.c=%.d) |