Merge pull request #446 from LudwigOrtmann/msp
fixes for msp430, msb-430 and msb-430-common
This commit is contained in:
commit
825c0e614d
@ -14,13 +14,26 @@ export SIZE = $(PREFIX)size
|
|||||||
export OBJCOPY = $(PREFIX)objcopy
|
export OBJCOPY = $(PREFIX)objcopy
|
||||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
||||||
TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py
|
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)),)
|
ifeq ($(strip $(PORT)),)
|
||||||
export PORT = /dev/ttyUSB0
|
export PORT = /dev/ttyUSB0
|
||||||
endif
|
endif
|
||||||
export HEXFILE = bin/$(PROJECT).hex
|
|
||||||
#export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)"
|
export FFLAGS += "prog $(HEXFILE)"
|
||||||
export FFLAGS = -j olimex "prog $(HEXFILE)"
|
|
||||||
|
|
||||||
export USEMODULE += msp430_common
|
export USEMODULE += msp430_common
|
||||||
export INCLUDES += -I $(RIOTCPU)/msp430-common/include/ -I$(RIOTBOARD)/msb-430-common/include
|
export INCLUDES += -I $(RIOTCPU)/msp430-common/include/ -I$(RIOTBOARD)/msb-430-common/include
|
||||||
|
|||||||
@ -41,7 +41,7 @@ static void msb_ports_init(void)
|
|||||||
{
|
{
|
||||||
/* Port 1: Free port, for energy saving all outputs are set to zero. */
|
/* Port 1: Free port, for energy saving all outputs are set to zero. */
|
||||||
P1SEL = 0x00; /* Port1 I/O Function */
|
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 */
|
P1DIR = 0xFF; /* Port1 Direction: 11111111 = 0xFF */
|
||||||
|
|
||||||
P2SEL = 0x20; /* Port2 I/O Function */
|
P2SEL = 0x20; /* Port2 I/O Function */
|
||||||
|
|||||||
@ -44,6 +44,7 @@ void lpm_init(void);
|
|||||||
/**
|
/**
|
||||||
* @brief Switches the MCU to a new power mode
|
* @brief Switches the MCU to a new power mode
|
||||||
* @param[in] target Target power mode
|
* @param[in] target Target power mode
|
||||||
|
* @return The previous power mode
|
||||||
*/
|
*/
|
||||||
enum lpm_mode lpm_set(enum lpm_mode target);
|
enum lpm_mode lpm_set(enum lpm_mode target);
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ See the file LICENSE in the top level directory for more details.
|
|||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "kernel_internal.h"
|
#include "kernel_internal.h"
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
|
#include "thread.h"
|
||||||
|
|
||||||
volatile int __inISR = 0;
|
volatile int __inISR = 0;
|
||||||
|
|
||||||
@ -39,12 +40,24 @@ void cpu_switch_context_exit(void)
|
|||||||
__restore_context();
|
__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
|
// Processor specific routine - here for MSP
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
char *thread_stack_init(void (*task_func)(void), void *stack_start, int stack_size)
|
char *thread_stack_init(void (*task_func)(void), void *stack_start, int stack_size)
|
||||||
{
|
{
|
||||||
unsigned short *stk;
|
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 *)(stack_start + stack_size);
|
||||||
|
|
||||||
*stk = (unsigned short) sched_task_exit;
|
*stk = (unsigned short) sched_task_exit;
|
||||||
|
|||||||
@ -23,8 +23,8 @@ See the file LICENSE in the top level directory for more details.
|
|||||||
#define KERNEL_CONF_STACKSIZE_DEFAULT (256)
|
#define KERNEL_CONF_STACKSIZE_DEFAULT (256)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KERNEL_CONF_STACKSIZE_IDLE 96
|
#define KERNEL_CONF_STACKSIZE_IDLE (96)
|
||||||
#define MSP430_ISR_STACK_SIZE 256
|
#define MSP430_ISR_STACK_SIZE (256)
|
||||||
|
|
||||||
#define RX_BUF_SIZE (3)
|
#define RX_BUF_SIZE (3)
|
||||||
#define TRANSCEIVER_BUFFER_SIZE (3)
|
#define TRANSCEIVER_BUFFER_SIZE (3)
|
||||||
|
|||||||
@ -125,11 +125,6 @@ inline void dINT(void)
|
|||||||
dint();
|
dint();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define lpm_set(...)
|
|
||||||
|
|
||||||
void thread_yield(void);
|
|
||||||
|
|
||||||
|
|
||||||
int inISR(void);
|
int inISR(void);
|
||||||
|
|
||||||
void msp430_cpu_init(void);
|
void msp430_cpu_init(void);
|
||||||
|
|||||||
26
cpu/msp430-common/lpm_cpu.c
Normal file
26
cpu/msp430-common/lpm_cpu.c
Normal 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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user