add assemly compilation capabililty
This commit is contained in:
parent
3cfd7ce7b6
commit
b583481c4f
|
@ -24,9 +24,12 @@ SIZE = avr-size
|
||||||
|
|
||||||
# library directories, compiler, and linker flags
|
# library directories, compiler, and linker flags
|
||||||
LIBS = lib
|
LIBS = lib
|
||||||
CFLAGS = -g -Wall -Werror -O3 -std=c99
|
CFLAGS = -g -Wall -Werror -Os -mcall-prologues -std=c99
|
||||||
CFLAGS += -I. $(patsubst %,-I%,$(LIBS))
|
CFLAGS += -I. $(patsubst %,-I%,$(LIBS))
|
||||||
CFLAGS += -mmcu=$(DEVICE) -DF_CPU=$(F_CPU)
|
CFLAGS += -mmcu=$(DEVICE) -DF_CPU=$(F_CPU)
|
||||||
|
AFLAGS = -Wall -Werror -x assembler-with-cpp
|
||||||
|
AFLAGS += -I. $(patsubst %,-I%,$(LIBS))
|
||||||
|
AFLAGS += -mmcu=$(DEVICE)
|
||||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||||
LDFLAGS += -I. $(patsubst %,-I%,$(LIBS))
|
LDFLAGS += -I. $(patsubst %,-I%,$(LIBS))
|
||||||
LDFLAGS += -mmcu=$(DEVICE)
|
LDFLAGS += -mmcu=$(DEVICE)
|
||||||
|
@ -36,14 +39,16 @@ LDFLAGS += -mmcu=$(DEVICE)
|
||||||
#LDFLAGS += -lm
|
#LDFLAGS += -lm
|
||||||
|
|
||||||
# source files to compile
|
# source files to compile
|
||||||
SRC = $(wildcard *.c)
|
CSRC = $(wildcard *.c) $(foreach LIB,$(LIBS),$(wildcard $(LIB)/*.c))
|
||||||
SRC += $(foreach LIB,$(LIBS),$(wildcard $(LIB)/*.c))
|
ASRC = $(wildcard *.S) $(foreach LIB,$(LIBS),$(wildcard $(LIB)/*.S))
|
||||||
# header files
|
# header files
|
||||||
HEADER = $(SRC:.c=.h)
|
HEADER = $(SRC:.c=.h)
|
||||||
# object files
|
# object files
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(patsubst %.c,%.o,$(CSRC)) $(patsubst %.S,%.o,$(ASRC))
|
||||||
# listing files.
|
# listing files
|
||||||
LST = $(SRC:.c=.lst)
|
LST = $(patsubst %.c,%.lst,$(CSRC)) $(patsubst %.S,%.lst,$(ASRC))
|
||||||
|
|
||||||
|
$(info $(OBJ))
|
||||||
|
|
||||||
all: compile flash
|
all: compile flash
|
||||||
$(info EEPROM has to be programmed separately)
|
$(info EEPROM has to be programmed separately)
|
||||||
|
@ -84,11 +89,15 @@ lst: $(TARGET).lst
|
||||||
map: $(TARGET).map
|
map: $(TARGET).map
|
||||||
|
|
||||||
# compile source files
|
# compile source files
|
||||||
%.o: %.c %.h
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.S
|
||||||
|
$(CC) $(AFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
# link compiled files
|
# link compiled files
|
||||||
%.elf: $(OBJ)
|
%.elf: $(OBJ)
|
||||||
|
$(info elf)
|
||||||
$(CC) $(LDFLAGS) -o $@ $^
|
$(CC) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
$(TARGET).map: $(OBJ)
|
$(TARGET).map: $(OBJ)
|
||||||
|
|
Loading…
Reference in New Issue