1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:52:44 +01:00

Merge pull request #446 from LudwigOrtmann/msp

fixes for msp430, msb-430 and msb-430-common
This commit is contained in:
Ludwig Ortmann 2013-12-19 06:20:10 -08:00
commit 825c0e614d
7 changed files with 60 additions and 12 deletions

View File

@ -14,13 +14,26 @@ export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py
export FLASHER = mspdebug
export HEXFILE = bin/$(PROJECT).hex
ifeq ($(strip $(FLASHER)),)
export FLASHER = mspdebug
endif
# set programmer port in FFLAGS manually if needed like this:
# FFLAGS="-d /dev/ttyUSB0" PROGRAMMER="uif" make flash
ifeq ($(strip $(PROGRAMMER)),)
export PROGRAMMER = olimex
endif
export FFLAGS += -j $(PROGRAMMER)
ifeq ($(strip $(PORT)),)
export PORT = /dev/ttyUSB0
endif
export HEXFILE = bin/$(PROJECT).hex
#export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)"
export FFLAGS = -j olimex "prog $(HEXFILE)"
export FFLAGS += "prog $(HEXFILE)"
export USEMODULE += msp430_common
export INCLUDES += -I $(RIOTCPU)/msp430-common/include/ -I$(RIOTBOARD)/msb-430-common/include

View File

@ -41,7 +41,7 @@ static void msb_ports_init(void)
{
/* Port 1: Free port, for energy saving all outputs are set to zero. */
P1SEL = 0x00; /* Port1 I/O Function */
P1OUT = 0x00; /* Port1 Ausgangsregister: 00000000 = 0x00 */
P1OUT = 0x00; /* Port1 Output register: 00000000 = 0x00 */
P1DIR = 0xFF; /* Port1 Direction: 11111111 = 0xFF */
P2SEL = 0x20; /* Port2 I/O Function */

View File

@ -44,6 +44,7 @@ void lpm_init(void);
/**
* @brief Switches the MCU to a new power mode
* @param[in] target Target power mode
* @return The previous power mode
*/
enum lpm_mode lpm_set(enum lpm_mode target);

View File

@ -14,6 +14,7 @@ See the file LICENSE in the top level directory for more details.
#include "kernel.h"
#include "kernel_internal.h"
#include "sched.h"
#include "thread.h"
volatile int __inISR = 0;
@ -39,12 +40,24 @@ void cpu_switch_context_exit(void)
__restore_context();
}
/**
* mspgcc handles main specially - it does not return but falls
* through to section .fini9.
* To "fix" this, we put a return in section .fini9 to make main
* behave like a regular function. This enables a common
* thread_stack_init behavior. */
__attribute__((section (".fini9"))) void __main_epilogue(void) { __asm__("ret"); }
//----------------------------------------------------------------------------
// Processor specific routine - here for MSP
//----------------------------------------------------------------------------
char *thread_stack_init(void (*task_func)(void), void *stack_start, int stack_size)
{
unsigned short *stk;
/* XXX: work around for misalignment, remove once solved properly in thread.c */
stack_size--;
stk = (unsigned short *)(stack_start + stack_size);
*stk = (unsigned short) sched_task_exit;

View File

@ -23,8 +23,8 @@ See the file LICENSE in the top level directory for more details.
#define KERNEL_CONF_STACKSIZE_DEFAULT (256)
#endif
#define KERNEL_CONF_STACKSIZE_IDLE 96
#define MSP430_ISR_STACK_SIZE 256
#define KERNEL_CONF_STACKSIZE_IDLE (96)
#define MSP430_ISR_STACK_SIZE (256)
#define RX_BUF_SIZE (3)
#define TRANSCEIVER_BUFFER_SIZE (3)

View File

@ -125,11 +125,6 @@ inline void dINT(void)
dint();
}
#define lpm_set(...)
void thread_yield(void);
int inISR(void);
void msp430_cpu_init(void);

View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include "lpm.h"
/* TODO: implement */
enum lpm_mode lpm_set(enum lpm_mode target)
{
enum lpm_mode last_mode;
/* dummy value as lpm is not currently implemented */
last_mode = LPM_ON;
return last_mode;
}
/* TODO: implement */
enum lpm_mode lpm_get()
{
enum lpm_mode current_mode;
/* dummy value as lpm is not currently implemented */
current_mode = LPM_ON;
return current_mode;
}