aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/MSP430-MSP430x1611-GCC/Makefile151
-rw-r--r--demos/MSP430-MSP430x1611-GCC/board.c29
-rw-r--r--demos/MSP430-MSP430x1611-GCC/board.h29
-rw-r--r--demos/MSP430-MSP430x1611-GCC/chconf.h170
-rw-r--r--demos/MSP430-MSP430x1611-GCC/main.c67
-rw-r--r--demos/MSP430-MSP430x1611-GCC/mspgcc/msp430x1611.x201
-rw-r--r--demos/MSP430-MSP430x1611-GCC/readme.txt22
-rw-r--r--docs/index.html4
-rw-r--r--ports/ARM7/chcore.h2
-rw-r--r--ports/ARMCM3/chcore.h2
-rw-r--r--ports/AVR/chcore.h2
-rw-r--r--ports/MSP430/chcore.c84
-rw-r--r--ports/MSP430/chcore.h98
-rw-r--r--ports/MSP430/chtypes.h51
-rw-r--r--readme.txt23
-rw-r--r--src/templates/chcore.h5
16 files changed, 932 insertions, 8 deletions
diff --git a/demos/MSP430-MSP430x1611-GCC/Makefile b/demos/MSP430-MSP430x1611-GCC/Makefile
new file mode 100644
index 000000000..637a26456
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/Makefile
@@ -0,0 +1,151 @@
+#
+# !!!! 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.
+#
+# To rebuild project do "make clean" and "make all".
+#
+
+##############################################################################################
+# Start of default section
+#
+
+TRGT = msp430-
+CC = $(TRGT)gcc
+CP = $(TRGT)objcopy
+AS = $(TRGT)gcc -x assembler-with-cpp
+OD = $(TRGT)objdump
+HEX = $(CP) -O ihex
+BIN = $(CP) -O binary
+
+MCU = msp430x1611
+
+# List all default C defines here, like -D_DEBUG=1
+DDEFS =
+
+# List all default ASM defines here, like -D_DEBUG=1
+DADEFS =
+
+# List all default directories to look for include files here
+DINCDIR =
+
+# List the default directory to look for the libraries here
+DLIBDIR =
+
+# List all default libraries here
+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 =
+
+# List ARM-mode C source files here
+SRC = ../../ports/MSP430/chcore.c \
+ ../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \
+ ../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \
+ ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \
+ ../../src/chserial.c \
+ ../../src/lib/evtimer.c ../../test/test.c \
+ board.c main.c
+
+# List ASM source files here
+ASMSRC =
+
+# List all user directories here
+UINCDIR = ../../src/include ../../src/lib ../../test ../../ports/MSP430
+
+# List the user directory to look for the libraries here
+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
+
+#
+# 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)
+
+# *** EOF ***
diff --git a/demos/MSP430-MSP430x1611-GCC/board.c b/demos/MSP430-MSP430x1611-GCC/board.c
new file mode 100644
index 000000000..68131b345
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/board.c
@@ -0,0 +1,29 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <ch.h>
+
+#include "board.h"
+
+/*
+ * Hardware initialization goes here.
+ * NOTE: Interrupts are still disabled.
+ */
+void hwinit(void) {
+}
diff --git a/demos/MSP430-MSP430x1611-GCC/board.h b/demos/MSP430-MSP430x1611-GCC/board.h
new file mode 100644
index 000000000..38ebf3f60
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/board.h
@@ -0,0 +1,29 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _BOARD_H_
+#define _BOARD_H_
+
+#ifndef __msp430x16x
+#include <msp430x16x.h>
+#endif
+
+void hwinit(void);
+
+#endif /* _BOARD_H_ */
diff --git a/demos/MSP430-MSP430x1611-GCC/chconf.h b/demos/MSP430-MSP430x1611-GCC/chconf.h
new file mode 100644
index 000000000..4ca12304e
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/chconf.h
@@ -0,0 +1,170 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @addtogroup Config
+ * @{
+ */
+
+#ifndef _CHCONF_H_
+#define _CHCONF_H_
+
+/*
+ * NOTE: this is just documentation for doxigen, the real configuration file
+ * is the one into the project directories.
+ */
+
+/** Configuration option: if specified then time efficient rather than space
+ * efficient code is used when two possible implementations exist, note
+ * that this is not related to the compiler optimization options.*/
+#define CH_OPTIMIZE_SPEED
+
+/** Configuration option: if specified then the Virtual Timers subsystem is
+ * included in the kernel.*/
+#define CH_USE_VIRTUAL_TIMERS
+
+/** Configuration option: if specified then the System Timer subsystem is
+ * included in the kernel.*/
+#define CH_USE_SYSTEMTIME
+
+/** Configuration option: if specified then the \p chThdSleep() function is
+ * included in the kernel.
+ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
+#define CH_USE_SLEEP
+
+/** Configuration option: if specified then the \p chThdResume()
+ * function is included in the kernel.*/
+#define CH_USE_RESUME
+
+/** Configuration option: if specified then the \p chThdSuspend()
+ * function is included in the kernel.*/
+#define CH_USE_SUSPEND
+
+/** Configuration option: if specified then the \p chThdTerminate()
+ * and \p chThdShouldTerminate() functions are included in the kernel.*/
+#define CH_USE_TERMINATE
+
+/** Configuration option: if specified then the \p chThdWait() function
+ * is included in the kernel.*/
+#define CH_USE_WAITEXIT
+
+/** Configuration option: if specified then the Semaphores APIs are included
+ * in the kernel.*/
+#define CH_USE_SEMAPHORES
+
+/** Configuration option: if specified then the Semaphores atomic Signal+Wait
+ * APIs are included in the kernel.*/
+#define CH_USE_SEMSW
+
+/** Configuration option: if specified then the Semaphores with timeout APIs
+ * are included in the kernel.
+ * @note requires \p CH_USE_SEMAPHORES.
+ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
+#define CH_USE_SEMAPHORES_TIMEOUT
+
+/** Configuration option: if specified then the Mutexes APIs are included in
+ * the kernel.*/
+#define CH_USE_MUTEXES
+
+/** Configuration option: if specified then the Events APIs are included in
+ * the kernel.*/
+#define CH_USE_EVENTS
+
+/** Configuration option: if specified then the \p chEvtWaitTimeout()
+ * function is included in the kernel.
+ * @note requires \p CH_USE_EVENTS.
+ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
+#define CH_USE_EVENTS_TIMEOUT
+
+/** Configuration option: if specified then the Synchronous Messages APIs are
+ * included in the kernel.*/
+#define CH_USE_MESSAGES
+
+/** Configuration option: if specified then the \p chMsgSendWithEvent()
+ * function is included in the kernel.
+ * @note requires \p CH_USE_MESSAGES.
+ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
+#define CH_USE_MESSAGES_EVENT
+
+/** Configuration option: If enabled then the threads have an option to serve
+ * messages by priority instead of FIFO order.
+ * @note requires \p CH_USE_MESSAGES.*/
+#define CH_USE_MESSAGES_PRIORITY
+
+/** Configuration option: if specified then the
+ * \p chThdGetExitEventSource() function is included in the kernel.
+ * @note requires \p CH_USE_MESSAGES.
+ * @note requires \p CH_USE_EVENTS.*/
+#define CH_USE_EXIT_EVENT
+
+/** Configuration option: if specified then the I/O queues APIs are included
+ * in the kernel.*/
+#define CH_USE_QUEUES
+
+/** Configuration option: if specified then the halfduplex queue APIs are
+ * included in the kernel.*/
+#define CH_USE_QUEUES_HALFDUPLEX
+
+/** Configuration option: if specified then the I/O queues with timeout
+ * APIs are included in the kernel.
+ * @note requires \p CH_USE_SEMAPHORES_TIMEOUT.*/
+#define CH_USE_QUEUES_TIMEOUT
+
+/** Configuration option: if specified then the full duplex serial driver APIs
+ * are included in the kernel.*/
+#define CH_USE_SERIAL_FULLDUPLEX
+
+/** Configuration option: if specified then the half duplex serial driver APIs
+ * are included in the kernel.*/
+#define CH_USE_SERIAL_HALFDUPLEX
+
+/** Configuration option: Frequency of the system timer that drives the system
+ * ticks. This also defines the system time unit.*/
+#define CH_FREQUENCY 1000
+
+/** Configuration option: This constant is the number of ticks allowed for the
+ * threads before preemption occurs.*/
+#define CH_TIME_QUANTUM 20
+
+/** Configuration option: Defines a CPU register to be used as storage for the
+ * global \p currp variable. Caching this variable in a register can greatly
+ * improve both space and time efficiency of the generated code. Another side
+ * effect is that one less register has to be saved during the context switch
+ * resulting in lower RAM usage and faster code.
+ * @note This option is only useable with the GCC compiler and is only useful
+ * on processors with many registers like ARM cores.
+ * @note If this option is enabled then ALL the libraries linked to the
+ * ChibiOS/RT code <b>must</b> be recompiled with the GCC option \p
+ * -ffixed-\<reg\>.
+ */
+//#define CH_CURRP_REGISTER_CACHE "reg"
+
+/** Debug option: Includes basic debug support to the kernel.
+ * @note the debug support is port-dependent, it may be not present on some
+ * targets. In that case stub functions will be included.
+ */
+//#define CH_USE_DEBUG
+
+/** Debug option: Includes the threads context switch tracing feature.
+ */
+//#define CH_USE_TRACE
+
+#endif /* _CHCONF_H_ */
+
+/** @} */
diff --git a/demos/MSP430-MSP430x1611-GCC/main.c b/demos/MSP430-MSP430x1611-GCC/main.c
new file mode 100644
index 000000000..c1d9c86bb
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/main.c
@@ -0,0 +1,67 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <ch.h>
+#include <test.h>
+
+#include "board.h"
+
+/*
+ * Red LEDs blinker thread, times are in milliseconds.
+ */
+static WorkingArea(waThread1, 64);
+static msg_t Thread1(void *arg) {
+
+ while (TRUE) {
+ chThdSleep(500);
+ chThdSleep(500);
+ }
+ return 0;
+}
+
+/*
+ * Entry point, the interrupts are disabled on entry.
+ */
+int main(int argc, char **argv) {
+
+ /*
+ * Hardware initialization, see board.c.
+ */
+ hwinit();
+
+ /*
+ * The main() function becomes a thread here then the interrupts are
+ * enabled and ChibiOS/RT goes live.
+ */
+ chSysInit();
+
+ /*
+ * Creates the blinker threads.
+ */
+ chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
+
+ /*
+ * Normal main() thread activity, in this demo it does nothing except
+ * sleeping in a loop.
+ */
+ while (TRUE) {
+ chThdSleep(500);
+ }
+ return 0;
+}
diff --git a/demos/MSP430-MSP430x1611-GCC/mspgcc/msp430x1611.x b/demos/MSP430-MSP430x1611-GCC/mspgcc/msp430x1611.x
new file mode 100644
index 000000000..7d7c676c3
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/mspgcc/msp430x1611.x
@@ -0,0 +1,201 @@
+/* Default linker script, for normal executables */
+OUTPUT_FORMAT("elf32-msp430","elf32-msp430","elf32-msp430")
+OUTPUT_ARCH(msp:16)
+MEMORY
+{
+ text (rx) : ORIGIN = 0x4000, LENGTH = 0xbfe0
+ data (rwx) : ORIGIN = 0x1100, LENGTH = 0x2800
+ vectors (rw) : ORIGIN = 0xffe0 LENGTH = 32
+ bootloader(rx) : ORIGIN = 0x0c00, LENGTH = 1K
+ infomem(rx) : ORIGIN = 0x1000, LENGTH = 256
+ infomemnobits(rx) : ORIGIN = 0x1000, LENGTH = 256
+}
+SECTIONS
+{
+ /* Read-only sections, merged into text segment. */
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ /* Internal text space. */
+ .text :
+ {
+ . = ALIGN(2);
+ *(.init)
+ *(.init0) /* Start here after reset. */
+ *(.init1)
+ *(.init2) /* Copy data loop */
+ *(.init3)
+ *(.init4) /* Clear bss */
+ *(.init5)
+ *(.init6) /* C++ constructors. */
+ *(.init7)
+ *(.init8)
+ *(.init9) /* Call main(). */
+ __ctors_start = . ;
+ *(.ctors)
+ __ctors_end = . ;
+ __dtors_start = . ;
+ *(.dtors)
+ __dtors_end = . ;
+ . = ALIGN(2);
+ *(.text)
+ . = ALIGN(2);
+ *(.text.*)
+ . = ALIGN(2);
+ *(.fini9) /* */
+ *(.fini8)
+ *(.fini7)
+ *(.fini6) /* C++ destructors. */
+ *(.fini5)
+ *(.fini4)
+ *(.fini3)
+ *(.fini2)
+ *(.fini1)
+ *(.fini0) /* Infinite loop after program termination. */
+ *(.fini)
+ _etext = .;
+ } > text
+ .data : AT (ADDR (.text) + SIZEOF (.text))
+ {
+ PROVIDE (__data_start = .) ;
+ . = ALIGN(2);
+ *(.data)
+ . = ALIGN(2);
+ *(.gnu.linkonce.d*)
+ . = ALIGN(2);
+ _edata = . ;
+ } > data
+ /* Bootloader. */
+ .bootloader :
+ {
+ PROVIDE (__boot_start = .) ;
+ *(.bootloader)
+ . = ALIGN(2);
+ *(.bootloader.*)
+ } > bootloader
+ /* Information memory. */
+ .infomem :
+ {
+ *(.infomem)
+ . = ALIGN(2);
+ *(.infomem.*)
+ } > infomem
+ /* Information memory (not loaded into MPU). */
+ .infomemnobits :
+ {
+ *(.infomemnobits)
+ . = ALIGN(2);
+ *(.infomemnobits.*)
+ } > infomemnobits
+ .bss SIZEOF(.data) + ADDR(.data) :
+ {
+ PROVIDE (__bss_start = .) ;
+ *(.bss)
+ *(COMMON)
+ PROVIDE (__bss_end = .) ;
+ _end = . ;
+ } > data
+ .noinit SIZEOF(.bss) + ADDR(.bss) :
+ {
+ PROVIDE (__noinit_start = .) ;
+ *(.noinit)
+ *(COMMON)
+ PROVIDE (__noinit_end = .) ;
+ _end = . ;
+ } > data
+ .vectors :
+ {
+ PROVIDE (__vectors_start = .) ;
+ *(.vectors*)
+ _vectors_end = . ;
+ } > vectors
+ /* Stabs for profiling information*/
+ .profiler 0 : { *(.profiler) }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ PROVIDE (__stack = 0x3900) ;
+ PROVIDE (__data_start_rom = _etext) ;
+ PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ;
+ PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
+ PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
+ PROVIDE (__subdevice_has_heap = 0) ;
+}
diff --git a/demos/MSP430-MSP430x1611-GCC/readme.txt b/demos/MSP430-MSP430x1611-GCC/readme.txt
new file mode 100644
index 000000000..5533287ff
--- /dev/null
+++ b/demos/MSP430-MSP430x1611-GCC/readme.txt
@@ -0,0 +1,22 @@
+*****************************************************************************
+** ChibiOS/RT port for Texas Instruments MSP430. **
+*****************************************************************************
+
+** TARGET **
+
+This is an abstract demo. it is not tested on real hardware yet.
+
+** The Demo **
+
+Creates a thread that just sleeps in a continuous loop.
+
+** Build Procedure **
+
+The demo was built using the MSPGCC toolchain.
+
+** Notes **
+
+The demo requires include files from MSPGCC that are not part of the ChibiOS/RT
+distribution, please install MSPGCC.
+
+ http://mspgcc.sourceforge.net/
diff --git a/docs/index.html b/docs/index.html
index a7d34bc95..07d2e6a37 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -71,8 +71,10 @@ Currently the ChibiOS/RT is ported to the following architectures:<br>
should be trivial. Both ARM and THUMB modes are supported.</li>
<li>ARM7TDMI-AT91SAM7X256, this port also supports other Atmel
chips: SAM7XC, SAM7S and the various sizes (128, 256, 512) with
-minimal changes.</li><li>ARM Cortex-M3-STM32.</li>
+minimal changes.</li>
+ <li>ARM Cortex-M3, ST Microelectronics STM32.</li>
<li>Atmel AVR: AT90CAN128 and ATmega128 demos included.</li>
+ <li>Texas Instruments MSP430, complete but untested.</li>
<li>x86 as a Win32 process, this port allows to write
your application on the PC without the need of a development
board/simulator/emulator. Communication ports are simulated over
diff --git a/ports/ARM7/chcore.h b/ports/ARM7/chcore.h
index eed850266..4f8e187cc 100644
--- a/ports/ARM7/chcore.h
+++ b/ports/ARM7/chcore.h
@@ -20,6 +20,8 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
+#define CH_ARCHITECTURE_ARM7
+
typedef void *regarm;
/*
diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h
index 5b9a0915b..9a8f00bee 100644
--- a/ports/ARMCM3/chcore.h
+++ b/ports/ARMCM3/chcore.h
@@ -20,6 +20,8 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
+#define CH_ARCHITECTURE_ARMCM3
+
typedef void *regarm;
/*
diff --git a/ports/AVR/chcore.h b/ports/AVR/chcore.h
index eb7e334f6..cb2920a2d 100644
--- a/ports/AVR/chcore.h
+++ b/ports/AVR/chcore.h
@@ -20,6 +20,8 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
+#define CH_ARCHITECTURE_AVR
+
/*
* Interrupt saved context.
*/
diff --git a/ports/MSP430/chcore.c b/ports/MSP430/chcore.c
new file mode 100644
index 000000000..86765c675
--- /dev/null
+++ b/ports/MSP430/chcore.c
@@ -0,0 +1,84 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <ch.h>
+
+/**
+ * This function implements the idle thread infinite loop. The function should
+ * put the processor in the lowest power mode capable to serve interrupts.
+ * The priority is internally set to the minimum system value so that this
+ * thread is executed only if there are no other ready threads in the system.
+ */
+void _IdleThread(void *p) {
+
+ while (TRUE)
+ ;
+}
+
+/**
+ * Abonormal system termination handler. Invoked by the ChibiOS/RT when an
+ * abnormal unrecoverable condition is met.
+ */
+void chSysHalt(void) {
+
+ chSysLock();
+
+ while (TRUE)
+ ;
+}
+
+/**
+ * Context switch.
+ */
+void chSysSwitchI(Thread *otp, Thread *ntp) {
+ register struct intctx *sp asm("r1");
+
+ asm volatile ("push r11 \n\t" \
+ "push r10 \n\t" \
+ "push r9 \n\t" \
+ "push r8 \n\t" \
+ "push r7 \n\t" \
+ "push r6 \n\t" \
+ "push r6 \n\t" \
+ "push r4");
+ otp->p_ctx.sp = sp;
+ sp = ntp->p_ctx.sp;
+ asm volatile ("pop r4 \n\t" \
+ "pop r5 \n\t" \
+ "pop r6 \n\t" \
+ "pop r7 \n\t" \
+ "pop r8 \n\t" \
+ "pop r9 \n\t" \
+ "pop r10 \n\t" \
+ "pop r11" : : "r" (sp));
+}
+
+/**
+ * Prints a message on the system console (if any).
+ */
+void chSysPuts(char *msg) {
+}
+
+void threadstart(void) {
+
+ asm volatile ("eint \n\t" \
+ "mov r11, r15 \n\t" \
+ "call r10 \n\t" \
+ "call #chThdExit");
+}
diff --git a/ports/MSP430/chcore.h b/ports/MSP430/chcore.h
new file mode 100644
index 000000000..b67e90d26
--- /dev/null
+++ b/ports/MSP430/chcore.h
@@ -0,0 +1,98 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _CHCORE_H_
+#define _CHCORE_H_
+
+#define CH_ARCHITECTURE_MSP430
+
+typedef void *regmsp;
+
+/*
+ * Interrupt saved context.
+ */
+struct extctx {
+ regmsp r12;
+ regmsp r13;
+ regmsp r14;
+ regmsp r15;
+ regmsp sr;
+ regmsp pc;
+};
+
+/*
+ * System saved context.
+ */
+struct intctx {
+ regmsp r4;
+ regmsp r5;
+ regmsp r6;
+ regmsp r7;
+ regmsp r8;
+ regmsp r9;
+ regmsp r10;
+ regmsp r11;
+ regmsp pc;
+};
+
+typedef struct {
+ struct intctx *sp;
+} Context;
+
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
+ tp->p_ctx.sp = (struct intctx *)((uint8_t *)workspace + \
+ wsize - \
+ sizeof(struct intctx)); \
+ tp->p_ctx.sp->r10 = pf; \
+ tp->p_ctx.sp->r11 = arg; \
+ tp->p_ctx.sp->pc = threadstart; \
+}
+
+#define IDLE_THREAD_STACK_SIZE 0
+
+#define INT_REQUIRED_STACK 16
+#define StackAlign(n) ((((n) - 1) | 1) + 1)
+#define UserStackSize(n) StackAlign(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + (INT_REQUIRED_STACK))
+#define WorkingArea(s, n) uint16_t s[UserStackSize(n >> 1)];
+
+#define chSysLock() asm volatile ("dint")
+#define chSysUnlock() asm volatile ("eint")
+
+#define chSysIRQEnterI()
+#define chSysIRQExitI() { \
+ if (chSchRescRequiredI1()) \
+ chSchDoRescheduleI(); \
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void _IdleThread(void *p);
+ void chSysHalt(void);
+ void chSysSwitchI(Thread *otp, Thread *ntp);
+ void chSysPuts(char *msg);
+ void threadstart(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CHCORE_H_ */
diff --git a/ports/MSP430/chtypes.h b/ports/MSP430/chtypes.h
new file mode 100644
index 000000000..e1fc14ef6
--- /dev/null
+++ b/ports/MSP430/chtypes.h
@@ -0,0 +1,51 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @addtogroup Core
+ * @{
+ */
+
+#ifndef _CHTYPES_H_
+#define _CHTYPES_H_
+
+#define __need_NULL
+#define __need_size_t
+#include <stddef.h>
+
+#if !defined(_STDINT_H) && !defined(__STDINT_H_)
+#include <stdint.h>
+#endif
+
+typedef int16_t bool_t; /* Signed boolean. */
+typedef uint8_t tmode_t; /* Thread mode flags, uint8_t is ok. */
+typedef uint8_t tstate_t; /* Thread state, uint8_t is ok. */
+typedef uint16_t tid_t; /* Thread id. */
+typedef uint16_t tprio_t; /* Priority, use the fastest unsigned type. */
+typedef int16_t msg_t; /* Message, use signed pointer equivalent.*/
+typedef int16_t eventid_t; /* Event Id, use fastest signed.*/
+typedef uint16_t eventmask_t;/* Event Mask, recommended fastest unsigned.*/
+typedef uint16_t systime_t; /* System Time, recommended fastest unsigned.*/
+typedef int16_t cnt_t; /* Counter, recommended fastest signed.*/
+
+#define INLINE inline
+
+#endif /* _CHTYPES_H_ */
+
+/** @} */
diff --git a/readme.txt b/readme.txt
index abb8ecb87..c7b2a8b39 100644
--- a/readme.txt
+++ b/readme.txt
@@ -43,6 +43,8 @@ AVR-AVRmega128-GCC - Port on AVRmega128. A special thanks to Vladimir for
the work done on the AVR port. The demo program
targets the Olimex AVR-MT-128 mini terminal board.
AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet.
+MSP430-MSP430x1611-GCC - Port on Texas Instruments MSP430F1611, not tested on
+ hardware yet, consider it work in progress.
Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
MinGW version.
@@ -63,15 +65,22 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*****************************************************************************
*** 0.6.4 ***
-- Modified the ARM demos makefiles in order to make them more compatible with
- GCC 4.3.0, it seems the new GCC assumes -mthumb-interworking and -mabi=apcs
- by default, at least the builds I tested did so, now the makefiles
+- NEW: Added a CH_ARCHITECTURE_xxx define to the various chcore.h files, it
+ allows to write port-dependent code.
+- FIX: In the ARM7 and ARMCM3 ports chanced the bool_t base type from int8_t
+ to int32_t, this produces a bit faster and smaller code.
+- FIX: Small fixes to the template files, there were some leftovers of the old
+ type names.
+- FIX: Modified the ARM demos makefiles in order to make them more compatible
+ with GCC 4.3.0, it seems the new GCC assumes -mthumb-interworking and
+ -mabi=apcs by default, at least the builds I tested did so, now the makefiles
explicitly assert -mno-thumb-interworking and -mabi=apcs-gnu in order to
produce better code.
-- In the ARM7 and ARMCM3 ports chanced the bool_t base type from int8_t to
- int32_t, this produces a bit faster and smaller code.
-- Small fixes to the template files, there were some leftovers of the old
- type names.
+- Work started on the MSP430 port, the port code compiles correctly but it is
+ not tested yet. The port requires the MSPGCC toolchain.
+- Added an Ethernet driver for AT91SAM7X EMAC, not tested yet, it will be
+ required by a uIP web server demo under ChibiOS/RT coming in some next
+ release.
*** 0.6.3 ***
- NEW: ARM Cortex-M3 port completed. The demo program targets the STM32F103
diff --git a/src/templates/chcore.h b/src/templates/chcore.h
index 879e2732c..491aa3fee 100644
--- a/src/templates/chcore.h
+++ b/src/templates/chcore.h
@@ -26,6 +26,11 @@
#define _CHCORE_H_
/**
+ * Unique macro for the implemented architecture.
+ */
+#define CH_ARCHITECTURE_XXX
+
+/**
* Interrupt saved context.
*/
struct extctx {