aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARMCM3-STM32F103-GCC
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-18 19:18:37 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-18 19:18:37 +0000
commitb8089f6eca64267329a3930da32e6447e616ee56 (patch)
tree2e45fa02470749269656bf60faad8814fe7470e7 /demos/ARMCM3-STM32F103-GCC
parenteb62dae46e986d9835534edf6f96a49ec02ee98b (diff)
downloadChibiOS-b8089f6eca64267329a3930da32e6447e616ee56.tar.gz
ChibiOS-b8089f6eca64267329a3930da32e6447e616ee56.tar.bz2
ChibiOS-b8089f6eca64267329a3930da32e6447e616ee56.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@784 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARMCM3-STM32F103-GCC')
-rw-r--r--demos/ARMCM3-STM32F103-GCC/Makefile215
1 files changed, 74 insertions, 141 deletions
diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile
index 12a819086..2fd02d7f5 100644
--- a/demos/ARMCM3-STM32F103-GCC/Makefile
+++ b/demos/ARMCM3-STM32F103-GCC/Makefile
@@ -1,44 +1,75 @@
+##############################################################################
+# Build global options
+# NOTE: Can be overridden externally.
#
-# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
-#
-##############################################################################################
-#
-# On command line:
-#
-# make all = Create project
-#
-# make clean = Clean project files.
+
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu -falign-functions=16
+endif
+
+# Enable this if you want the linker to remove unused code and data
+ifeq ($(LINK_GC),)
+ USE_LINK_GC = yes
+endif
+
+# Enable register caching optimization (read documentation).
+ifeq ($(USE_CURRP_CACHING),)
+ USE_CURRP_CACHING = no
+endif
+
+# Enable this if you really want to use the STM FWLib.
+ifeq ($(USE_FWLIB),)
+ USE_FWLIB = no
+endif
+
#
-# To rebuild project do "make clean" and "make all".
+# Build global options
+##############################################################################
+
+##############################################################################
+# Project, sources and paths
#
-##############################################################################################
-# OS, compiler and demo options
+# Define project name here
+PROJECT = ch
-# Compiler options here
-OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu -falign-functions=16
+# Define linker script file here
+LDSCRIPT= ch.ld
-# Enable this if you want the linker to remove unused code and data
-LINK_GC = yes
+# Imported source files
+include ../../src/kernel.mk
+include ../../test/test.mk
-# Enable this if you really want to use the STM FWLib. ChibiOS/RT does not
-# require it and does not support the library except for this Makefile option.
-USE_FWLIB = no
+# Sources that can be compiled in ARM or THUMB mode depending on the global
+# setting.
+SRC = ../../ports/ARMCM3/chcore.c \
+ ../../ports/ARMCM3/nvic.c \
+ ../../ports/ARMCM3-STM32F103/stm32_serial.c \
+ ${KERNSRC} \
+ ${TESTSRC} \
+ ../../src/lib/evtimer.c \
+ board.c main.c
-# Enable register caching optimization. This option greatly improves both
-# code size and execution speed but is incompatible with libraries compiled
-# without the very same options. The register R7 becomes a global variable
-# and MUST NOT be used anywhere in the code.
-USE_CURRP_CACHING = no
+# List ASM source files here
+ASMSRC = ../../ports/ARMCM3/crt0.s \
+ ../../ports/ARMCM3-STM32F103/vectors.s
+INCDIR = $(KERNINC) $(TESTINC) \
+ ../../src/lib \
+ ../../ports/ARMCM3 \
+ ../../ports/ARMCM3-STM32F103 \
+ ./stm32lib/inc
#
-# End of OS and demo options
-##############################################################################################
+# Project, sources and paths
+##############################################################################
-##############################################################################################
-# Start of default section
+##############################################################################
+# Compiler settings
#
+MCU = cortex-m3
+
#TRGT = arm-none-eabi-
#TRGT = arm-eabi-
TRGT = arm-elf-
@@ -49,7 +80,16 @@ OD = $(TRGT)objdump
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
-MCU = cortex-m3
+# Define warning options here
+WARN = -Wall -Wstrict-prototypes
+
+#
+# Compiler settings
+##############################################################################
+
+##############################################################################
+# Start of default section
+#
# List all default C defines here, like -D_DEBUG=1
DDEFS =
@@ -68,9 +108,9 @@ DLIBS =
#
# End of default section
-##############################################################################################
+##############################################################################
-##############################################################################################
+##############################################################################
# Start of user section
#
@@ -86,32 +126,8 @@ UDEFS =
# Define ASM defines here
UADEFS =
-# Imported source files
-include ../../src/kernel.mk
-include ../../test/test.mk
-ifeq ($(USE_FWLIB),yes)
-include ./stm32lib/stm32lib.mk
-endif
-
-# List ARM-mode C source files here
-SRC = ../../ports/ARMCM3/chcore.c ../../ports/ARMCM3/nvic.c \
- ../../ports/ARMCM3-STM32F103/stm32_serial.c \
- ${KERNSRC} \
- ${TESTSRC} \
- ../../src/lib/evtimer.c \
- board.c main.c
-
-ifeq ($(USE_FWLIB),yes)
-SRC += ${STM32SRC}
-endif
-
-# List ASM source files here
-ASMSRC = ../../ports/ARMCM3/crt0.s ../../ports/ARMCM3-STM32F103/vectors.s
-
# List all user directories here
-UINCDIR = ../../src/include ../../src/lib ../../test \
- ../../ports/ARMCM3 ../../ports/ARMCM3-STM32F103 \
- ./stm32lib/inc
+UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
@@ -119,91 +135,8 @@ ULIBDIR =
# List all user libraries here
ULIBS =
-# Define warning options here
-WARN = -Wall -Wstrict-prototypes
-
#
# End of user defines
-##############################################################################################
-
-ifeq ($(USE_CURRP_CACHING),yes)
-OPT += -ffixed-r7 -DCH_CURRP_REGISTER_CACHE='"r7"'
-endif
-
-ifeq ($(USE_FWLIB),yes)
-# 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
-
-ifeq ($(LINK_GC),yes)
- OPT += -ffunction-sections -fdata-sections
-endif
-
-INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
-LIBDIR = $(patsubst %,-L%,$(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 $(LIBDIR)
-else
- LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
-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 . $(INCDIR) $< -o $@
-
-$(ASMOBJS) : %.o : %.s
- @echo
- $(AS) -c $(ASFLAGS) -I . $(INCDIR) $< -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 ***
+include ../../ports/ARMCM3/rules.mk