diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 19:35:04 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 19:35:04 +0000 |
commit | 22e3829249ff6b244fbb7b04f61c019c2cfe775e (patch) | |
tree | 01afb2e54427d4d94c417137142ca4aa9311044e /ports | |
parent | b8089f6eca64267329a3930da32e6447e616ee56 (diff) | |
download | ChibiOS-22e3829249ff6b244fbb7b04f61c019c2cfe775e.tar.gz ChibiOS-22e3829249ff6b244fbb7b04f61c019c2cfe775e.tar.bz2 ChibiOS-22e3829249ff6b244fbb7b04f61c019c2cfe775e.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@785 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r-- | ports/ARM7/rules.mk | 112 | ||||
-rw-r--r-- | ports/ARMCM3/rules.mk | 87 |
2 files changed, 199 insertions, 0 deletions
diff --git a/ports/ARM7/rules.mk b/ports/ARM7/rules.mk new file mode 100644 index 000000000..884fc50e9 --- /dev/null +++ b/ports/ARM7/rules.mk @@ -0,0 +1,112 @@ +# 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_THUMB),yes)
+ TSRC += $(SRC)
+else
+ ASRC += $(SRC)
+endif
+
+IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
+LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
+DEFS = $(DDEFS) $(UDEFS)
+ADEFS = $(DADEFS) $(UADEFS)
+AOBJS = $(ASRC:.c=.o)
+TOBJS = $(TSRC:.c=.o)
+OBJS = $(ASMOBJS) $(AOBJS) $(TOBJS)
+ASMOBJS = $(ASMSRC:.s=.o)
+LIBS = $(DLIBS) $(ULIBS)
+MCFLAGS = -mcpu=$(MCU)
+
+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 $(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),)
+ CPFLAGS += -DTHUMB_PRESENT
+ ASFLAGS += -DTHUMB_PRESENT
+ ifneq ($(ASRC),)
+ # Mixed ARM and THUMB case.
+ CPFLAGS += -mthumb-interwork
+ LDFLAGS += -mthumb-interwork
+ else
+ # Pure THUMB case, THUMB C code cannot be called by ARM asm code directly.
+ CPFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING
+ LDFLAGS += -mno-thumb-interwork -mthumb
+ ASFLAGS += -DTHUMB_NO_INTERWORKING
+ endif
+else
+ CPFLAGS += -mno-thumb-interwork
+ LDFLAGS += -mno-thumb-interwork
+endif
+
+# Generate dependency information
+CPFLAGS += -MD -MP -MF .dep/$(@F).d
+
+#
+# Makefile rules
+#
+
+all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp
+
+$(AOBJS) : %.o : %.c
+ @echo
+ $(CC) -c $(CPFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@
+
+$(TOBJS) : %.o : %.c
+ @echo
+ $(CC) -c $(CPFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@
+
+$(ASMOBJS) : %.o : %.s
+ @echo
+ $(AS) -c $(ASFLAGS) -I . $(IINCDIR) $< -o $@
+
+%elf: $(OBJS)
+ @echo
+ $(CC) $(ASMOBJS) $(AOBJS) $(TOBJS) $(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 $(ASRC:.c=.c.bak)
+ -rm -f $(ASRC:.c=.lst)
+ -rm -f $(TSRC:.c=.c.bak)
+ -rm -f $(TSRC:.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 ***
diff --git a/ports/ARMCM3/rules.mk b/ports/ARMCM3/rules.mk new file mode 100644 index 000000000..45f4d0129 --- /dev/null +++ b/ports/ARMCM3/rules.mk @@ -0,0 +1,87 @@ +# 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 ***
|