aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/MSP430-MSP430x1611-GCC/Makefile198
-rw-r--r--ports/MSP430/rules.mk87
-rw-r--r--readme.txt2
-rw-r--r--todo.txt6
4 files changed, 180 insertions, 113 deletions
diff --git a/demos/MSP430-MSP430x1611-GCC/Makefile b/demos/MSP430-MSP430x1611-GCC/Makefile
index b42da1da3..4f9d159c3 100644
--- a/demos/MSP430-MSP430x1611-GCC/Makefile
+++ b/demos/MSP430-MSP430x1611-GCC/Makefile
@@ -1,30 +1,102 @@
+##############################################################################
+# 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
+
+# Compiler options here.
+ifeq ($(USE_OPT),)
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer
+endif
+
+# C++ specific options here (added to USE_OPT).
+ifeq ($(USE_CPPOPT),)
+ USE_CPPOPT = -fno-rtti
+endif
+
+# Enable this if you want the linker to remove unused code and data
+ifeq ($(USE_LINK_GC),)
+ USE_LINK_GC = no
+endif
+
+# Enable register caching optimization (read documentation).
+# Option not tested on MSP430, DO NOT USE.
+ifeq ($(USE_CURRP_CACHING),)
+ USE_CURRP_CACHING = no
+endif
+
#
-# make clean = Clean project files.
+# Build global options
+##############################################################################
+
+##############################################################################
+# Project, sources and paths
#
-# To rebuild project do "make clean" and "make all".
+
+# Define project name here
+PROJECT = ch
+
+# Define linker script file here
+LDSCRIPT= mspgcc/msp430x1611.x
+
+# Imported source files
+include ../../src/kernel.mk
+include ../../test/test.mk
+
+# C sources here.
+CSRC = ../../ports/MSP430/chcore.c \
+ ../../ports/MSP430/msp430_serial.c \
+ ${KERNSRC} \
+ ${TESTSRC} \
+ ../../src/lib/evtimer.c \
+ board.c main.c
+
+# C++ sources here.
+CPPSRC =
+
+# List ASM source files here
+ASMSRC =
+
+INCDIR = $(KERNINC) $(TESTINC) \
+ ../../src/lib \
+ ../../ports/MSP430
+
#
+# Project, sources and paths
+##############################################################################
-##############################################################################################
-# Start of default section
+##############################################################################
+# Compiler settings
#
+MCU = msp430x1611
+
TRGT = msp430-
CC = $(TRGT)gcc
+CPPC = $(TRGT)g++
+# Enable loading with g++ only if you need C++ runtime support.
+# NOTE: You can use C++ even without C++ support if you are careful. C++
+# runtime support makes code size explode.
+LD = $(TRGT)gcc
+#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
-MCU = msp430x1611
+# Define C warning options here
+CWARN = -Wall -Wstrict-prototypes
+
+# Define C++ warning options here
+CPPWARN = -Wall
+
+#
+# Compiler settings
+##############################################################################
+
+##############################################################################
+# Start of default section
+#
# List all default C defines here, like -D_DEBUG=1
DDEFS =
@@ -43,41 +115,20 @@ DLIBS =
#
# End of default section
-##############################################################################################
+##############################################################################
-##############################################################################################
+##############################################################################
# Start of user section
#
-# Define project name here
-PROJECT = ch
-
-# Define linker script file here
-LDSCRIPT= mspgcc/msp430x1611.x
-
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
-# Imported source files
-include ../../src/kernel.mk
-include ../../test/test.mk
-
-# List ARM-mode C source files here
-SRC = ../../ports/MSP430/chcore.c \
- ../../ports/MSP430/msp430_serial.c \
- ${KERNSRC} \
- ${TESTSRC} \
- ../../src/lib/evtimer.c \
- board.c main.c
-
-# List ASM source files here
-ASMSRC =
-
# List all user directories here
-UINCDIR = ../../src/include ../../src/lib ../../test ../../ports/MSP430
+UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
@@ -85,79 +136,8 @@ ULIBDIR =
# List all user libraries here
ULIBS =
-# Common options here
-# NOTE: -ffixed-r7 is only needed if you enabled CH_CURRP_REGISTER_CACHE in
-# chconf.h.
-OPT = -O2 -ggdb -fomit-frame-pointer
-#OPT += -ffixed-r7
-
-# Define warning options here
-WARN = -Wall -Wstrict-prototypes
-
#
# End of user defines
-##############################################################################################
-
-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 = -mmcu=$(MCU)
-
-ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
-CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
-LDFLAGS = $(MCFLAGS) -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
-ODFLAGS = -x --syms
-
-# 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/MSP430/rules.mk
diff --git a/ports/MSP430/rules.mk b/ports/MSP430/rules.mk
new file mode 100644
index 000000000..7509ca662
--- /dev/null
+++ b/ports/MSP430/rules.mk
@@ -0,0 +1,87 @@
+# MSP430 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
+SRC = $(CSRC)$(CPPSRC)
+
+# Object files groups
+COBJS = $(CSRC:.c=.o)
+CPPOBJS = $(CPPSRC:.cpp=.o)
+ASMOBJS = $(ASMSRC:.s=.o)
+OBJS = $(ASMOBJS) $(COBJS) $(CPPOBJS)
+
+# Paths
+IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
+LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
+
+# Macros
+DEFS = $(DDEFS) $(UDEFS)
+ADEFS = $(DADEFS) $(UADEFS)
+
+# Libs
+LIBS = $(DLIBS) $(ULIBS)
+
+MCFLAGS = -mmcu=$(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) -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
+else
+ LDFLAGS = $(MCFLAGS) -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
+endif
+
+# Generate dependency information
+CPFLAGS += -MD -MP -MF .dep/$(@F).d
+
+#
+# Makefile rules
+#
+all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp
+
+$(CPPOBJS) : %.o : %.cpp
+ @echo
+ $(CPPC) -c $(CPPFLAGS) -I . $(IINCDIR) $< -o $@
+
+$(COBJS) : %.o : %.c
+ @echo
+ $(CC) -c $(CPFLAGS) -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/readme.txt b/readme.txt
index c5b66d8f0..4ab964c0c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -92,7 +92,7 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
- NEW: Added a debug option CH_DBG_ENABLE_STACK_CHECK for stack overflow
checking. The check is not performed in the kernel but in the port code.
Currently only the ARM7 and ARMCM3 ports implements it.
-- NEW: Unified makefiles for ARM7 and ARMCM3 projects, the new makefiles
+- NEW: Unified makefiles for ARM7, ARMCM3 MSP430 projects, the new makefiles
share a common part making them easier to maintain. Also reorganized the
demo-specific part of the makefile, now it is easier to configure and the
option can be overriden from outside.
diff --git a/todo.txt b/todo.txt
index 876a5d58c..aed98175a 100644
--- a/todo.txt
+++ b/todo.txt
@@ -9,8 +9,8 @@ After 1.0.0:
* Queues macros should not refer to the semaphore counters directly.
* Priority ordering option for semaphores.
* chSysLock() and chSysUnlock() with counter (option).
-* OSEK-style chSysSuspendAll()/chSysResumeAll()/chSysEnable()/chSysDisable(),
- implemented this as the new Suspended and Disabled states in 1.1.
+* OSEK-style chSysSuspendAll()/chSysResumeAll()/chSysEnable()/chSysDisable()
+ (implemented this as the new Suspended and Disabled states in 1.1).
* Mailboxes subsystem (lwIP requires them).
* Multiple debug switches.
* Split asserts from parameters checks.
@@ -19,7 +19,7 @@ After 1.0.0:
* Threads profiling option.
* Idle loop hook macro.
* Switch the configuration options to TRUE/FALSE rather than def/undef.
-X Remove port_puts() from all the ports.
+* Remove port_puts() from all the ports.
After 1.2.0:
- Threads Pools manager in the library.