1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards: clean up MSP430 board configuration

Move common configuration for MSP430 based boards to
`boards/common/msp430` and make use of that.
This commit is contained in:
Marian Buschsieweke 2023-12-07 10:29:40 +01:00
parent e6154a04a1
commit b51ea4ca24
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6
14 changed files with 104 additions and 183 deletions

View File

@ -1,11 +1,3 @@
INCLUDES += -I$(RIOTBOARD)/common/msb-430/include
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup flash tool
PROGRAMMER ?= mspdebug
MSPDEBUG_PROGRAMMER ?= olimex
PROGRAMMERS_SUPPORTED += mspdebug
include $(RIOTBOARD)/common/msp430/Makefile.include

View File

@ -0,0 +1,11 @@
INCLUDES += -I$(RIOTBOARD)/common/msp430/include
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup flash tool
PROGRAMMER ?= mspdebug
MSPDEBUG_PROGRAMMER ?= olimex
PROGRAMMERS_SUPPORTED += mspdebug

View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup boards_common_msp430 Common Configuration Snippets for MSP430 boards
* @ingroup boards_common
* @brief Board configuration snippets for MSP430-based boards
*
* All boards using a CPU from the MSP430 family share certain parts of their
* configuration. This module provides a collection of fine grained
* configuration snippets that can be reused for different boards.
*/

View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2023 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_msp430
* @{
*
* @file
* @brief Common timer configuration for TIMER_A clocked by SMCLK and
* TIMER_B clocked by ACLK
*
* @author Marian Buschsieweke <marian.buschsieweke@posteo.net>
*/
#ifndef CFG_TIMER_A_SMCLK_B_ACLK_H
#define CFG_TIMER_A_SMCLK_B_ACLK_H
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Timer configuration
* @{
*/
/**
* @brief Timer configuration
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf) /**< Number of timers available */
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR) /**< IRQ vector for channel 0 of TIMER_DEV(0) */
#define TIMER0_ISR_CCX (TIMERA1_VECTOR) /**< IRQ vector for channels !=0 of TIMER_DEV(0) */
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR) /**< IRQ vector for channel 0 of TIMER_DEV(0) */
#define TIMER1_ISR_CCX (TIMERB1_VECTOR) /**< IRQ vector for channels !=0 of TIMER_DEV(1) */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* CFG_TIMER_A_SMCLK_B_ACLK_H */
/** @} */

View File

@ -23,6 +23,7 @@
#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -44,30 +45,6 @@ static const msp430_clock_params_t clock_params = {
.has_r_osc = true,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{

View File

@ -22,6 +22,7 @@
#define PERIPH_CONF_H
#include "periph_cpu.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -43,30 +44,6 @@ static const msp430_clock_params_t clock_params = {
.has_r_osc = true,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{

View File

@ -1,13 +1,3 @@
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial-MXV*)))
# flash tool configuration
PROGRAMMER ?= mspdebug
MSPDEBUG_PROGRAMMER ?= olimex
PROGRAMMERS_SUPPORTED += mspdebug
# When freshly plugged in the Olimex MSP430-JTAG-Tiny debugger provides a
# ttyACM interface, which is only available until the first flashing. A
# `make term` or even a `make flash term` may pick the JTAG debugger instead
@ -24,3 +14,5 @@ TTY_SELECT_CMD := $(RIOTTOOLS)/usb-serial/ttys.py \
$(RIOTTOOLS)/usb-serial/ttys.py \
--most-recent \
--format path serial
include $(RIOTBOARD)/common/msp430/Makefile.include

View File

@ -23,6 +23,7 @@
#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -43,30 +44,6 @@ static const msp430_clock_params_t clock_params = {
.auxiliary_clock_divier = AUXILIARY_CLOCK_DIVIDE_BY_1,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{

View File

@ -1,13 +1,3 @@
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial-MXV*)))
# flash tool configuration
PROGRAMMER ?= mspdebug
MSPDEBUG_PROGRAMMER ?= olimex
PROGRAMMERS_SUPPORTED += mspdebug
# When freshly plugged in the Olimex MSP430-JTAG-Tiny debugger provides a
# ttyACM interface, which is only available until the first flashing. A
# `make term` or even a `make flash term` may pick the JTAG debugger instead
@ -24,3 +14,5 @@ TTY_SELECT_CMD := $(RIOTTOOLS)/usb-serial/ttys.py \
$(RIOTTOOLS)/usb-serial/ttys.py \
--most-recent \
--format path serial
include $(RIOTBOARD)/common/msp430/Makefile.include

View File

@ -22,6 +22,7 @@
#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -42,30 +43,6 @@ static const msp430_clock_params_t clock_params = {
.auxiliary_clock_divier = AUXILIARY_CLOCK_DIVIDE_BY_1,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{

View File

@ -1,11 +1,7 @@
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial-MXV*)))
# setup serial terminal
BAUD ?= 9600
# flash tool configuration
PROGRAMMER ?= goodfet
GOODFET_FLAGS ?= --telosb
PROGRAMMERS_SUPPORTED += goodfet
include $(RIOTBOARD)/common/msp430/Makefile.include

View File

@ -23,6 +23,7 @@
#include "macros/units.h"
#include "periph_cpu.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -43,30 +44,6 @@ static const msp430_clock_params_t clock_params = {
.auxiliary_clock_divier = AUXILIARY_CLOCK_DIVIDE_BY_1,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{

View File

@ -1,9 +1,7 @@
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
# setup flash tool
PROGRAMMER ?= goodfet
GOODFET_FLAGS ?= --z1
PROGRAMMERS_SUPPORTED += goodfet
include $(RIOTBOARD)/common/msp430/Makefile.include

View File

@ -23,6 +23,7 @@
#include "macros/units.h"
#include "periph_cpu.h"
#include "cfg_timer_a_smclk_b_aclk.h"
#ifdef __cplusplus
extern "C" {
@ -43,30 +44,6 @@ static const msp430_clock_params_t clock_params = {
.auxiliary_clock_divier = AUXILIARY_CLOCK_DIVIDE_BY_1,
};
/**
* @name Timer configuration
* @{
*/
static const timer_conf_t timer_conf[] = {
{
.timer = &TIMER_A,
.irq_flags = &TIMER_A_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_SUBMAIN_CLOCK,
},
{
.timer = &TIMER_B,
.irq_flags = &TIMER_B_IRQFLAGS,
.clock_source = TIMER_CLOCK_SOURCE_AUXILIARY_CLOCK,
}
};
#define TIMER_NUMOF ARRAY_SIZE(timer_conf)
#define TIMER0_ISR_CC0 (TIMERA0_VECTOR)
#define TIMER0_ISR_CCX (TIMERA1_VECTOR)
#define TIMER1_ISR_CC0 (TIMERB0_VECTOR)
#define TIMER1_ISR_CCX (TIMERB1_VECTOR)
/** @} */
/**
* @name UART configuration
* @{