3
3
# Author: Peter Fleury
4
4
# File: $Id: Makefile,v 1.7 2015/08/15 09:10:38 peter Exp $
5
5
#
6
- # Adjust MCU, F_CPU and BOOTLOADER_ADDRESS below to your AVR target
6
+ # Adjust MCU, F_CPU and BOOTLOADER_ADDRESS below to your AVR target
7
7
# ----------------------------------------------------------------------------
8
8
# usage:
9
9
#
13
13
# Please customize the avrdude settings below first!
14
14
#
15
15
# make filename.s = Just compile filename.c into the assembler code only.
16
- # make filename.i = Create a preprocessed source file
16
+ # make filename.i = Create a preprocessed source file
17
17
#
18
18
# To rebuild project do "make clean" then "make"
19
19
# ----------------------------------------------------------------------------
20
20
21
21
22
22
# MCU name
23
- MCU = atmega8
23
+ MCU ? = atmega8
24
24
25
25
26
26
# Processor frequency.
27
- # This will define a symbol, F_CPU, in all source code files equal to the
28
- # processor frequency. You can then use this symbol in your source code to
27
+ # This will define a symbol, F_CPU, in all source code files equal to the
28
+ # processor frequency. You can then use this symbol in your source code to
29
29
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
30
30
# automatically to create a 32-bit value in your source code.
31
- F_CPU = 7372800
31
+ F_CPU ? = 7372800
32
32
33
33
34
34
# Target file name (without extension).
@@ -40,7 +40,7 @@ TARGET = stk500boot
40
40
# BOOTLOADER_ADDRESS = 2 * ( (AVR-Flash size in words) - (boot-size in words) )
41
41
# e.g. for ATmega8 and 512 words boot size: 2 * ( 4096 - 512 ) or 2 * ( 0x1000 - 0x200 ) = 0x1C00
42
42
# for ATmega32 and 512 words boot size: 2 * ( 16384 - 512 ) or 2 * ( 0x4000 - 0x200 ) = 0x7C00
43
- BOOTLOADER_ADDRESS = 0x1C00
43
+ BOOTLOADER_ADDRESS ? = 0x1C00
44
44
45
45
46
46
# List C source files here. (C dependencies are automatically generated.)
@@ -68,7 +68,7 @@ EXTRAINCDIRS =
68
68
# (unlike VPATH= which is a search path for all prerequisites, not just source files)
69
69
70
70
71
- # Optimization level, can be [0, 1, 2, 3, s].
71
+ # Optimization level, can be [0, 1, 2, 3, s].
72
72
# 0 = turn off optimization. s = optimize for size.
73
73
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
74
74
OPT = s
@@ -99,7 +99,7 @@ CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
99
99
CFLAGS += -Wall -Wstrict-prototypes
100
100
CFLAGS += -Wa,-adhlns=$(<:.c=.lst )
101
101
CFLAGS += -save-temps
102
- CFLAGS += -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions -fno-jump-tables
102
+ CFLAGS += -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions -fno-jump-tables
103
103
104
104
105
105
# ---------------- Assembler Options ----------------
@@ -116,7 +116,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
116
116
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
117
117
118
118
# If this is left blank, then it will use the Standard printf version.
119
- PRINTF_LIB =
119
+ PRINTF_LIB =
120
120
# PRINTF_LIB = $(PRINTF_LIB_MIN)
121
121
# PRINTF_LIB = $(PRINTF_LIB_FLOAT)
122
122
@@ -128,7 +128,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
128
128
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
129
129
130
130
# If this is left blank, then it will use the Standard scanf version.
131
- SCANF_LIB =
131
+ SCANF_LIB =
132
132
# SCANF_LIB = $(SCANF_LIB_MIN)
133
133
# SCANF_LIB = $(SCANF_LIB_FLOAT)
134
134
@@ -163,15 +163,16 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
163
163
# --------------- bootloader linker Options -------
164
164
# BOOTLOADER_ADDRESS (=Start of Boot Loader section
165
165
# in bytes - not words) is defined above.
166
- LDFLAGS += -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS ) -nostartfiles -nodefaultlibs
166
+ LDFLAGS += -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS ) -nostartfiles
167
+ # LDFLAGS += -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS) -nostartfiles -nodefaultlibs
167
168
168
169
169
170
# ---------------- Programming Options (avrdude) ----------------
170
171
171
172
# Programming hardware: Type: avrdude -c ? to get a full listing.
172
173
AVRDUDE_PROGRAMMER = usbasp
173
174
174
- # usb, com1 = serial port, lpt1 = parallel port
175
+ # usb, com1 = serial port, lpt1 = parallel port
175
176
AVRDUDE_PORT = USB
176
177
177
178
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET ) .hex
@@ -187,7 +188,7 @@ AVRDUDE_NO_SAFEMODE = -u
187
188
# Note that this counter needs to be initialized first using -Yn,
188
189
# AVRDUDE_ERASE_COUNTER = -y
189
190
190
- # Increase verbosity level.
191
+ # Increase verbosity level.
191
192
# AVRDUDE_VERBOSE = -v -v
192
193
193
194
# Adjust programming speed of USBasp
@@ -199,11 +200,11 @@ AVRDUDE_NO_SAFEMODE = -u
199
200
# -B 125 8 khz
200
201
# -B 62 16khz
201
202
# -B 31 32khz * the cutoff for bit banged isp
202
- # -B 10 93.75 khz
203
+ # -B 10 93.75 khz
203
204
# -B 5 187.5 khz
204
205
# -B 2 375 khz
205
206
# -B 1 750 khz
206
- # -B .5 1.5mhz
207
+ # -B .5 1.5mhz
207
208
AVRDUDE_SPEED = -B .5
208
209
209
210
AVRDUDE_FLAGS = -p $(MCU ) -P $(AVRDUDE_PORT ) -c $(AVRDUDE_PROGRAMMER )
@@ -248,7 +249,7 @@ MSG_CLEANING = Cleaning project:
248
249
OBJ = $(SRC:.c=.o ) $(ASRC:.S=.o )
249
250
250
251
# Define all listing files.
251
- LST = $(SRC:.c=.lst ) $(ASRC:.S=.lst )
252
+ LST = $(SRC:.c=.lst ) $(ASRC:.S=.lst )
252
253
253
254
254
255
# Compiler flags to generate dependency files.
@@ -266,7 +267,7 @@ all: gccversion $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).lss $(TARGET
266
267
267
268
268
269
# Display compiler version information.
269
- gccversion :
270
+ gccversion :
270
271
@echo $(OBJ1 )
271
272
@$(CC ) --version
272
273
@@ -278,7 +279,7 @@ gccversion :
278
279
279
280
% .eep : % .elf
280
281
@echo $(MSG_EEPROM ) $@
281
- -$(OBJCOPY ) -j .eeprom --set-section-flags=.eeprom=" alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT ) $< $@
282
+ -$(OBJCOPY ) -j .eeprom --set-section-flags=.eeprom=" alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT ) $< $@
282
283
283
284
# Create extended listing file from ELF output file.
284
285
% .lss : % .elf
@@ -295,7 +296,7 @@ gccversion :
295
296
.PRECIOUS : $(OBJ )
296
297
% .elf : $(OBJ )
297
298
@echo $(MSG_LINKING ) $@
298
- $(CC ) -mmcu=$(MCU ) $(LDFLAGS ) $^ --output $(@F )
299
+ $(CC ) -mmcu=$(MCU ) $(LDFLAGS ) $^ --output $(@F )
299
300
300
301
# Compile: create object files from C source files.
301
302
% .o : % .c
@@ -313,15 +314,15 @@ gccversion :
313
314
314
315
# Create preprocessed source for use in sending a bug report.
315
316
% .i : % .c
316
- $(CC ) -E -mmcu=$(MCU ) -I. $(CFLAGS ) $< -o $(@F )
317
+ $(CC ) -E -mmcu=$(MCU ) -I. $(CFLAGS ) $< -o $(@F )
317
318
318
319
319
320
# Display size of file.
320
321
size : ${TARGET}.elf
321
322
@avr-size -C --mcu=${MCU} ${TARGET} .elf
322
323
323
324
324
- # Program the device.
325
+ # Program the device.
325
326
program : $(TARGET ) .hex $(TARGET ) .eep
326
327
$(AVRDUDE ) $(AVRDUDE_FLAGS ) $(AVRDUDE_WRITE_FLASH ) $(AVRDUDE_WRITE_EEPROM )
327
328
@@ -333,7 +334,7 @@ clean:
333
334
334
335
335
336
# Include the dependency files.
336
- # -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
337
+ # -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
337
338
-include $(shell mkdir .dep 2>NUL) $(wildcard .dep/* )
338
339
339
340
0 commit comments