From 3674e55f833c382562116693389daa097a28a8fc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 Feb 2009 18:30:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@789 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- ports/ARM/rules.mk | 136 ++++++++++++++++++++++++++++++++++++++++++++++ ports/ARM7/rules.mk | 146 -------------------------------------------------- ports/ARMCM3/rules.mk | 87 ------------------------------ 3 files changed, 136 insertions(+), 233 deletions(-) create mode 100644 ports/ARM/rules.mk delete mode 100644 ports/ARM7/rules.mk delete mode 100644 ports/ARMCM3/rules.mk (limited to 'ports') diff --git a/ports/ARM/rules.mk b/ports/ARM/rules.mk new file mode 100644 index 000000000..5b7d5ae6f --- /dev/null +++ b/ports/ARM/rules.mk @@ -0,0 +1,136 @@ +# ARM7 common makefile scripts and rules. + +# Automatic compiler options +OPT = $(USE_OPT) +CPPOPT = $(USE_CPPOPT) +ifeq ($(USE_CURRP_CACHING),yes) + OPT += -ffixed-r7 -DCH_CURRP_REGISTER_CACHE='"r7"' +endif +ifeq ($(USE_LINK_GC),yes) + OPT += -ffunction-sections -fdata-sections +endif + +# Source files groups +ifeq ($(USE_THUMB),yes) + TCSRC += $(CSRC) + TCPPSRC += $(CPPSRC) +else + ACSRC += $(CSRC) + ACPPSRC += $(CPPSRC) +endif +ASRC = $(ACSRC)$(ACPPSRC) +TSRC = $(TCSRC)$(TCPPSRC) +SRC = $(ASRC)$(TSRC) + +# Object files groups +ACOBJS = $(ACSRC:.c=.o) +ACPPOBJS = $(ACPPSRC:.cpp=.o) +TCOBJS = $(TCSRC:.c=.o) +TCPPOBJS = $(TCPPSRC:.cpp=.o) +ASMOBJS = $(ASMSRC:.s=.o) +OBJS = $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS) + +# Paths +IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)) +LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) + +# Macros +DEFS = $(DDEFS) $(UDEFS) +ADEFS = $(DADEFS) $(UADEFS) + +# Libs +LIBS = $(DLIBS) $(ULIBS) + +# Various settings +MCFLAGS = -mcpu=$(MCU) +ODFLAGS = -x --syms +ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS) +CFLAGS = $(MCFLAGS) $(OPT) $(CWARN) -Wa,-alms=$(<:.c=.lst) $(DEFS) +CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(<:.cpp=.lst) $(DEFS) +ifeq ($(LINK_GC),yes) + LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) +else + LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) +endif + +# Thumb interwork enabled only if needed because it kills performance. +ifneq ($(TSRC),) + CFLAGS += -DTHUMB_PRESENT + CPPFLAGS += -DTHUMB_PRESENT + ASFLAGS += -DTHUMB_PRESENT + ifneq ($(ASRC),) + # Mixed ARM and THUMB mode. + CFLAGS += -mthumb-interwork + CPPFLAGS += -mthumb-interwork + ASFLAGS += -mthumb-interwork + LDFLAGS += -mthumb-interwork + else + # Pure THUMB mode, THUMB C code cannot be called by ARM asm code directly. + CFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING + CPPFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING + ASFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb + LDFLAGS += -mno-thumb-interwork -mthumb + endif +else + # Pure ARM mode + CPFLAGS += -mno-thumb-interwork + CPPFLAGS += -mno-thumb-interwork + ASFLAGS += -mno-thumb-interwork + LDFLAGS += -mno-thumb-interwork +endif + +# Generate dependency information +CFLAGS += -MD -MP -MF .dep/$(@F).d +CPPFLAGS += -MD -MP -MF .dep/$(@F).d + +# +# Makefile rules +# + +all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp + +$(ACPPOBJS) : %.o : %.cpp + @echo + $(CPPC) -c $(CPPFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@ + +$(TCPPOBJS) : %.o : %.cpp + @echo + $(CPPC) -c $(CPPFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@ + +$(ACOBJS) : %.o : %.c + @echo + $(CC) -c $(CFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@ + +$(TCOBJS) : %.o : %.c + @echo + $(CC) -c $(CFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@ + +$(ASMOBJS) : %.o : %.s + @echo + $(AS) -c $(ASFLAGS) -I . $(IINCDIR) $< -o $@ + +%elf: $(OBJS) + @echo + $(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ + +%hex: %elf + $(HEX) $< $@ + +%bin: %elf + $(BIN) $< $@ + +%dmp: %elf + $(OD) $(ODFLAGS) $< > $@ + +clean: + -rm -f $(OBJS) + -rm -f $(ACSRC:.c=.lst) $(TCSRC:.c=.lst) $(ACPPSRC:.cpp=.lst) $(TCPPSRC:.cpp=.lst) $(ASMSRC:.s=.lst) + -rm -f $(PROJECT).elf $(PROJECT).dmp $(PROJECT).map $(PROJECT).hex $(PROJECT).bin + -rm -fR .dep + +# +# Include the dependency files, should be the last of the makefile +# +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# *** EOF *** diff --git a/ports/ARM7/rules.mk b/ports/ARM7/rules.mk deleted file mode 100644 index d34c557e4..000000000 --- a/ports/ARM7/rules.mk +++ /dev/null @@ -1,146 +0,0 @@ -# ARM7 common makefile scripts and rules. - -# Automatic compiler options -OPT = $(USE_OPT) -CPPOPT = $(USE_CPPOPT) -ifeq ($(USE_CURRP_CACHING),yes) - OPT += -ffixed-r7 -DCH_CURRP_REGISTER_CACHE='"r7"' -endif -ifeq ($(USE_LINK_GC),yes) - OPT += -ffunction-sections -fdata-sections -endif - -# Source files groups -ifeq ($(USE_THUMB),yes) - TCSRC += $(CSRC) - TCPPSRC += $(CPPSRC) -else - ACSRC += $(CSRC) - ACPPSRC += $(CPPSRC) -endif -ASRC = $(ACSRC)$(ACPPSRC) -TSRC = $(TCSRC)$(TCPPSRC) -SRC = $(ASRC)$(TSRC) - -# Object files groups -ACOBJS = $(ACSRC:.c=.o) -ACPPOBJS = $(ACPPSRC:.cpp=.o) -TCOBJS = $(TCSRC:.c=.o) -TCPPOBJS = $(TCPPSRC:.cpp=.o) -ASMOBJS = $(ASMSRC:.s=.o) -OBJS = $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS) - -# Paths -IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)) -LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) - -# Macros -DEFS = $(DDEFS) $(UDEFS) -ADEFS = $(DADEFS) $(UADEFS) - -# Libs -LIBS = $(DLIBS) $(ULIBS) - -# Various settings -MCFLAGS = -mcpu=$(MCU) -ODFLAGS = -x --syms -ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CFLAGS = $(MCFLAGS) $(OPT) $(CWARN) -Wa,-alms=$(<:.c=.lst) $(DEFS) -CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(<:.cpp=.lst) $(DEFS) -ifeq ($(LINK_GC),yes) - LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR) -else - LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR) -endif - -# Thumb interwork enabled only if needed because it kills performance. -ifneq ($(TSRC),) - CFLAGS += -DTHUMB_PRESENT - CPPFLAGS += -DTHUMB_PRESENT - ASFLAGS += -DTHUMB_PRESENT - ifneq ($(ASRC),) - # Mixed ARM and THUMB case. - CFLAGS += -mthumb-interwork - CPPFLAGS += -mthumb-interwork - LDFLAGS += -mthumb-interwork - else - # Pure THUMB case, THUMB C code cannot be called by ARM asm code directly. - CFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING - CPPFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING - LDFLAGS += -mno-thumb-interwork -mthumb - ASFLAGS += -DTHUMB_NO_INTERWORKING - endif -else - CPFLAGS += -mno-thumb-interwork - CPPFLAGS += -mno-thumb-interwork - LDFLAGS += -mno-thumb-interwork -endif - -# Generate dependency information -CFLAGS += -MD -MP -MF .dep/$(@F).d -CPPFLAGS += -MD -MP -MF .dep/$(@F).d - -# -# Makefile rules -# - -all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp - -$(ACPPOBJS) : %.o : %.cpp - @echo - $(CPPC) -c $(CPPFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@ - -$(TCPPOBJS) : %.o : %.cpp - @echo - $(CPPC) -c $(CPPFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@ - -$(ACOBJS) : %.o : %.c - @echo - $(CC) -c $(CFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@ - -$(TCOBJS) : %.o : %.c - @echo - $(CC) -c $(CFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@ - -$(ASMOBJS) : %.o : %.s - @echo - $(AS) -c $(ASFLAGS) -I . $(IINCDIR) $< -o $@ - -%elf: $(OBJS) - @echo - $(LD) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ - -%hex: %elf - $(HEX) $< $@ - -%bin: %elf - $(BIN) $< $@ - -%dmp: %elf - $(OD) $(ODFLAGS) $< > $@ - -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).elf - -rm -f $(PROJECT).dmp - -rm -f $(PROJECT).map - -rm -f $(PROJECT).hex - -rm -f $(PROJECT).bin - -rm -f $(ACSRC:.c=.c.bak) - -rm -f $(ACSRC:.c=.lst) - -rm -f $(TCSRC:.c=.c.bak) - -rm -f $(TCSRC:.c=.lst) - -rm -f $(ACPPSRC:.cpp=.c.bak) - -rm -f $(ACPPSRC:.cpp=.lst) - -rm -f $(TCPPSRC:.cpp=.c.bak) - -rm -f $(TCPPSRC:.cpp=.lst) - -rm -f $(ASMSRC:.s=.s.bak) - -rm -f $(ASMSRC:.s=.lst) - -rm -fR .dep - -# -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - -# *** EOF *** diff --git a/ports/ARMCM3/rules.mk b/ports/ARMCM3/rules.mk deleted file mode 100644 index 45f4d0129..000000000 --- a/ports/ARMCM3/rules.mk +++ /dev/null @@ -1,87 +0,0 @@ -# ARM7 common makefile rules. - -OPT = $(USE_OPT) - -ifeq ($(USE_CURRP_CACHING),yes) -OPT += -ffixed-r7 -DCH_CURRP_REGISTER_CACHE='"r7"' -endif - -ifeq ($(USE_LINK_GC),yes) - OPT += -ffunction-sections -fdata-sections -endif - -ifeq ($(USE_FWLIB),yes) - include ./stm32lib/stm32lib.mk - SRC += ${STM32SRC} - # The thing generates a lot of aliasing warnings, this disables an - # optimization and the warning disappears, the code is a bit larger however. - OPT += -fno-strict-aliasing -endif - -XINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)) -XLIBDIR = $(patsubst %,-L%,$(LIBDIR) $(DLIBDIR) $(ULIBDIR)) -DEFS = $(DDEFS) $(UDEFS) -ADEFS = $(DADEFS) $(UADEFS) -COBJS = $(SRC:.c=.o) -ASMOBJS = $(ASMSRC:.s=.o) -OBJS = $(ASMOBJS) $(COBJS) -LIBS = $(DLIBS) $(ULIBS) -MCFLAGS = -mcpu=$(MCU) -mthumb - -ODFLAGS = -x --syms -ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS) -ifeq ($(LINK_GC),yes) - LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(XLIBDIR) -else - LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(XLIBDIR) -endif - -# Generate dependency information -CPFLAGS += -MD -MP -MF .dep/$(@F).d - -# -# Makefile rules -# -all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp - -$(COBJS) : %.o : %.c - @echo - $(CC) -c $(CPFLAGS) -I . $(XINCDIR) $< -o $@ - -$(ASMOBJS) : %.o : %.s - @echo - $(AS) -c $(ASFLAGS) -I . $(XINCDIR) $< -o $@ - -%elf: $(OBJS) - @echo - $(CC) $(ASMOBJS) $(COBJS) $(LDFLAGS) $(LIBS) -o $@ - -%hex: %elf - $(HEX) $< $@ - -%bin: %elf - $(BIN) $< $@ - -%dmp: %elf - $(OD) $(ODFLAGS) $< > $@ - -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).elf - -rm -f $(PROJECT).dmp - -rm -f $(PROJECT).map - -rm -f $(PROJECT).hex - -rm -f $(PROJECT).bin - -rm -f $(SRC:.c=.c.bak) - -rm -f $(SRC:.c=.lst) - -rm -f $(ASMSRC:.s=.s.bak) - -rm -f $(ASMSRC:.s=.lst) - -rm -fR .dep - -# -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - -# *** EOF *** -- cgit v1.2.3