diff options
-rw-r--r-- | demos/ARMCM0-LPC1114-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM3-LPC1343-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F100-DISCOVERY-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-FATFS-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F107-GCC/Makefile | 2 | ||||
-rw-r--r-- | os/ports/GCC/ARM7/port.mk | 10 | ||||
-rw-r--r-- | os/ports/GCC/ARM7/rules.mk | 146 | ||||
-rw-r--r-- | os/ports/GCC/ARMCMx/rules.mk | 146 |
9 files changed, 303 insertions, 11 deletions
diff --git a/demos/ARMCM0-LPC1114-GCC/Makefile b/demos/ARMCM0-LPC1114-GCC/Makefile index 5c481ec20..ee2ca97bc 100644 --- a/demos/ARMCM0-LPC1114-GCC/Makefile +++ b/demos/ARMCM0-LPC1114-GCC/Makefile @@ -189,4 +189,4 @@ ULIBS = # End of user defines
##############################################################################
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/demos/ARMCM3-LPC1343-GCC/Makefile b/demos/ARMCM3-LPC1343-GCC/Makefile index 0bc5276b4..173685b26 100644 --- a/demos/ARMCM3-LPC1343-GCC/Makefile +++ b/demos/ARMCM3-LPC1343-GCC/Makefile @@ -190,4 +190,4 @@ ULIBS = # End of user defines
##############################################################################
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/Makefile b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/Makefile index f474b8b9d..ef033772f 100644 --- a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/Makefile +++ b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/Makefile @@ -201,4 +201,4 @@ ifeq ($(USE_FWLIB),yes) USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/demos/ARMCM3-STM32F103-FATFS-GCC/Makefile b/demos/ARMCM3-STM32F103-FATFS-GCC/Makefile index a90ae3ded..f8733c3ae 100644 --- a/demos/ARMCM3-STM32F103-FATFS-GCC/Makefile +++ b/demos/ARMCM3-STM32F103-FATFS-GCC/Makefile @@ -204,4 +204,4 @@ ifeq ($(USE_FWLIB),yes) USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile index 460f602ee..7b0e82f90 100644 --- a/demos/ARMCM3-STM32F103-GCC/Makefile +++ b/demos/ARMCM3-STM32F103-GCC/Makefile @@ -201,4 +201,4 @@ ifeq ($(USE_FWLIB),yes) USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/demos/ARMCM3-STM32F107-GCC/Makefile b/demos/ARMCM3-STM32F107-GCC/Makefile index c4e2a6a0a..bd265aef1 100644 --- a/demos/ARMCM3-STM32F107-GCC/Makefile +++ b/demos/ARMCM3-STM32F107-GCC/Makefile @@ -201,4 +201,4 @@ ifeq ($(USE_FWLIB),yes) USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
-include $(CHIBIOS)/os/ports/GCC/ARM/rules.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
diff --git a/os/ports/GCC/ARM7/port.mk b/os/ports/GCC/ARM7/port.mk index 7ed810a9a..fdad5f5e6 100644 --- a/os/ports/GCC/ARM7/port.mk +++ b/os/ports/GCC/ARM7/port.mk @@ -1,7 +1,7 @@ -# List of the ChibiOS/RT ARM7 port files.
-PORTSRC = ${CHIBIOS}/os/ports/GCC/ARM7/chcore.c
+# List of the ChibiOS/RT ARM7/9 port files.
+PORTSRC = ${CHIBIOS}/os/ports/GCC/ARM/chcore.c
-PORTASM = ${CHIBIOS}/os/ports/GCC/ARM7/crt0.s \
- ${CHIBIOS}/os/ports/GCC/ARM7/chcoreasm.s
+PORTASM = ${CHIBIOS}/os/ports/GCC/ARM/crt0.s \
+ ${CHIBIOS}/os/ports/GCC/ARM/chcoreasm.s
-PORTINC = ${CHIBIOS}/os/ports/GCC/ARM7
+PORTINC = ${CHIBIOS}/os/ports/GCC/ARM
diff --git a/os/ports/GCC/ARM7/rules.mk b/os/ports/GCC/ARM7/rules.mk new file mode 100644 index 000000000..81d9d54fa --- /dev/null +++ b/os/ports/GCC/ARM7/rules.mk @@ -0,0 +1,146 @@ +# ARM7/9 common makefile scripts and rules.
+
+# Output
+OUTFILES = $(BUILDDIR)/$(PROJECT).elf $(BUILDDIR)/$(PROJECT).hex $(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp
+ifeq ($(BUILDDIR),)
+ BUILDDIR = .
+ CLEANDIR =
+else
+ CLEANDIR = $(BUILDDIR)
+endif
+ENSUREBUILDDIR = $(shell test -d $(BUILDDIR) || mkdir $(BUILDDIR))
+
+# 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 ($(USE_LINK_GC),yes)
+ LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
+else
+ LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(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
+ CFLAGS += -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: $(ENSUREBUILDDIR) $(OBJS) $(OUTFILES)
+
+$(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 $(OUTFILES) $(BUILDDIR)/$(PROJECT).map
+ -rm -fR .dep $(CLEANDIR)
+
+#
+# Include the dependency files, should be the last of the makefile
+#
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+# *** EOF ***
diff --git a/os/ports/GCC/ARMCMx/rules.mk b/os/ports/GCC/ARMCMx/rules.mk new file mode 100644 index 000000000..a06963d43 --- /dev/null +++ b/os/ports/GCC/ARMCMx/rules.mk @@ -0,0 +1,146 @@ +# ARM Cortex-Mx common makefile scripts and rules.
+
+# Output
+OUTFILES = $(BUILDDIR)/$(PROJECT).elf $(BUILDDIR)/$(PROJECT).hex $(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp
+ifeq ($(BUILDDIR),)
+ BUILDDIR = .
+ CLEANDIR =
+else
+ CLEANDIR = $(BUILDDIR)
+endif
+ENSUREBUILDDIR = $(shell test -d $(BUILDDIR) || mkdir $(BUILDDIR))
+
+# 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 ($(USE_LINK_GC),yes)
+ LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
+else
+ LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(BUILDDIR)/$(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
+ CFLAGS += -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: $(ENSUREBUILDDIR) $(OBJS) $(OUTFILES)
+
+$(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 $(OUTFILES) $(BUILDDIR)/$(PROJECT).map
+ -rm -fR .dep $(CLEANDIR)
+
+#
+# Include the dependency files, should be the last of the makefile
+#
+-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
+
+# *** EOF ***
|