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