Makefile angepasst, Ausgabe von Speicherinformation
Dieser Commit ist enthalten in:
Ursprung
be90873faa
Commit
91de31a96a
@ -1,2 +1,2 @@
|
|||||||
:08000000550F008A02003200D6
|
:080000000032008A02000F55D6
|
||||||
:00000001FF
|
:00000001FF
|
||||||
|
@ -60,7 +60,7 @@ ASRC =
|
|||||||
# Optimization level, can be [0, 1, 2, 3, s].
|
# Optimization level, can be [0, 1, 2, 3, s].
|
||||||
# 0 = turn off optimization. s = optimize for size.
|
# 0 = turn off optimization. s = optimize for size.
|
||||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||||
OPT = 0
|
OPT = s
|
||||||
|
|
||||||
# Debugging format.
|
# Debugging format.
|
||||||
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
||||||
@ -201,12 +201,11 @@ AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
# Define directories, if needed.
|
# Define directories, if needed.
|
||||||
DIRAVR = c:/winavr
|
# DIRAVR = .
|
||||||
DIRAVRBIN = $(DIRAVR)/bin
|
# DIRAVRBIN = $(DIRAVR)/bin
|
||||||
DIRAVRUTILS = $(DIRAVR)/utils/bin
|
# DIRAVRUTILS = $(DIRAVR)/utils/bin
|
||||||
DIRINC = .
|
# DIRINC = .
|
||||||
DIRLIB = $(DIRAVR)/avr/lib
|
# DIRLIB = $(DIRAVR)/avr/lib
|
||||||
|
|
||||||
|
|
||||||
# Define programs and commands.
|
# Define programs and commands.
|
||||||
SHELL = sh
|
SHELL = sh
|
||||||
@ -219,9 +218,6 @@ AVRDUDE = avrdude
|
|||||||
REMOVE = rm -f
|
REMOVE = rm -f
|
||||||
COPY = cp
|
COPY = cp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define Messages
|
# Define Messages
|
||||||
# English
|
# English
|
||||||
MSG_ERRORS_NONE = Errors: none
|
MSG_ERRORS_NONE = Errors: none
|
||||||
@ -240,29 +236,20 @@ MSG_COMPILING = Compiling:
|
|||||||
MSG_ASSEMBLING = Assembling:
|
MSG_ASSEMBLING = Assembling:
|
||||||
MSG_CLEANING = Cleaning project:
|
MSG_CLEANING = Cleaning project:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define all object files.
|
# Define all object files.
|
||||||
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||||
|
|
||||||
# Define all listing files.
|
# Define all listing files.
|
||||||
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||||
|
|
||||||
|
|
||||||
# Compiler flags to generate dependency files.
|
# Compiler flags to generate dependency files.
|
||||||
GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||||
|
|
||||||
|
|
||||||
# Combine all necessary flags and optional flags.
|
# Combine all necessary flags and optional flags.
|
||||||
# Add target processor to flags.
|
# Add target processor to flags.
|
||||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Default target.
|
# Default target.
|
||||||
all: begin gccversion sizebefore build sizeafter finished end
|
all: begin gccversion sizebefore build sizeafter finished end
|
||||||
|
|
||||||
@ -274,8 +261,6 @@ eep: $(TARGET).eep
|
|||||||
lss: $(TARGET).lss
|
lss: $(TARGET).lss
|
||||||
sym: $(TARGET).sym
|
sym: $(TARGET).sym
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Eye candy.
|
# Eye candy.
|
||||||
# AVR Studio 3.x does not check make's exit code but relies on
|
# AVR Studio 3.x does not check make's exit code but relies on
|
||||||
# the following magic strings to be generated by the compile job.
|
# the following magic strings to be generated by the compile job.
|
||||||
@ -289,25 +274,19 @@ finished:
|
|||||||
end:
|
end:
|
||||||
@echo $(MSG_END)
|
@echo $(MSG_END)
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
|
||||||
# Display size of file.
|
# Display size of file.
|
||||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||||
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||||
sizebefore:
|
sizebefore:
|
||||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
sizeafter:
|
sizeafter:
|
||||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Display compiler version information.
|
# Display compiler version information.
|
||||||
gccversion :
|
gccversion :
|
||||||
@$(CC) --version
|
@$(CC) --version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Program the device.
|
# Program the device.
|
||||||
program: $(TARGET).hex $(TARGET).eep
|
program: $(TARGET).hex $(TARGET).eep
|
||||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||||
@ -319,20 +298,16 @@ COFFCONVERT=$(OBJCOPY) --debugging \
|
|||||||
--change-section-address .noinit-0x800000 \
|
--change-section-address .noinit-0x800000 \
|
||||||
--change-section-address .eeprom-0x810000
|
--change-section-address .eeprom-0x810000
|
||||||
|
|
||||||
|
|
||||||
coff: $(TARGET).elf
|
coff: $(TARGET).elf
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_COFF) $(TARGET).cof
|
@echo $(MSG_COFF) $(TARGET).cof
|
||||||
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
|
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
|
||||||
|
|
||||||
|
|
||||||
extcoff: $(TARGET).elf
|
extcoff: $(TARGET).elf
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
|
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
|
||||||
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
|
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create final output files (.hex, .eep) from ELF output file.
|
# Create final output files (.hex, .eep) from ELF output file.
|
||||||
%.hex: %.elf
|
%.hex: %.elf
|
||||||
@echo
|
@echo
|
||||||
@ -357,8 +332,6 @@ extcoff: $(TARGET).elf
|
|||||||
@echo $(MSG_SYMBOL_TABLE) $@
|
@echo $(MSG_SYMBOL_TABLE) $@
|
||||||
$(NM) -n $< > $@
|
$(NM) -n $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Link: create ELF output file from object files.
|
# Link: create ELF output file from object files.
|
||||||
.SECONDARY : $(TARGET).elf
|
.SECONDARY : $(TARGET).elf
|
||||||
.PRECIOUS : $(OBJ)
|
.PRECIOUS : $(OBJ)
|
||||||
@ -366,6 +339,8 @@ extcoff: $(TARGET).elf
|
|||||||
@echo
|
@echo
|
||||||
@echo $(MSG_LINKING) $@
|
@echo $(MSG_LINKING) $@
|
||||||
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||||
|
@echo
|
||||||
|
$(SIZE) -C --mcu=$(MCU) $(TARGET).elf
|
||||||
|
|
||||||
|
|
||||||
# Compile: create object files from C source files.
|
# Compile: create object files from C source files.
|
||||||
@ -374,23 +349,18 @@ extcoff: $(TARGET).elf
|
|||||||
@echo $(MSG_COMPILING) $<
|
@echo $(MSG_COMPILING) $<
|
||||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
# Compile: create assembler files from C source files.
|
# Compile: create assembler files from C source files.
|
||||||
%.s : %.c
|
%.s : %.c
|
||||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
# Assemble: create object files from assembler source files.
|
# Assemble: create object files from assembler source files.
|
||||||
%.o : %.S
|
%.o : %.S
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_ASSEMBLING) $<
|
@echo $(MSG_ASSEMBLING) $<
|
||||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Target: clean project.
|
# Target: clean project.
|
||||||
clean: begin clean_list finished end
|
clean: begin clean_list finished end
|
||||||
|
|
||||||
clean_list :
|
clean_list :
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_CLEANING)
|
@echo $(MSG_CLEANING)
|
||||||
@ -411,12 +381,9 @@ clean_list :
|
|||||||
$(REMOVE) $(SRC:.c=.d)
|
$(REMOVE) $(SRC:.c=.d)
|
||||||
$(REMOVE) .dep/*
|
$(REMOVE) .dep/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Include the dependency files.
|
# Include the dependency files.
|
||||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||||
|
|
||||||
|
|
||||||
# Listing of phony targets.
|
# Listing of phony targets.
|
||||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||||
build elf hex eep lss sym coff extcoff \
|
build elf hex eep lss sym coff extcoff \
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren