Skip to content

Commit

Permalink
boards: clean up MSP430 board configuration
Browse files Browse the repository at this point in the history
Move common configuration for MSP430 based boards to
`boards/common/msp430` and make use of that.
  • Loading branch information
maribu committed Dec 10, 2023
1 parent e6154a0 commit b51ea4c
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 183 deletions.
10 changes: 1 addition & 9 deletions boards/common/msb-430/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions boards/common/msp430/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions boards/common/msp430/doc.txt
Original file line number Diff line number Diff line change
@@ -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.
*/
61 changes: 61 additions & 0 deletions boards/common/msp430/include/cfg_timer_a_smclk_b_aclk.h
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
*/

#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) */

Check warning on line 51 in boards/common/msp430/include/cfg_timer_a_smclk_b_aclk.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
#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) */

Check warning on line 53 in boards/common/msp430/include/cfg_timer_a_smclk_b_aclk.h

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
/** @} */

#ifdef __cplusplus
}
#endif

#endif /* CFG_TIMER_A_SMCLK_B_ACLK_H */
/** @} */
25 changes: 1 addition & 24 deletions boards/msb-430/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
* @{
Expand Down
25 changes: 1 addition & 24 deletions boards/msb-430h/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "cfg_timer_a_smclk_b_aclk.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
* @{
Expand Down
12 changes: 2 additions & 10 deletions boards/olimex-msp430-h1611/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
25 changes: 1 addition & 24 deletions boards/olimex-msp430-h1611/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
* @{
Expand Down
12 changes: 2 additions & 10 deletions boards/olimex-msp430-h2618/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
25 changes: 1 addition & 24 deletions boards/olimex-msp430-h2618/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "periph_cpu.h"
#include "macros/units.h"
#include "cfg_timer_a_smclk_b_aclk.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
* @{
Expand Down
8 changes: 2 additions & 6 deletions boards/telosb/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
25 changes: 1 addition & 24 deletions boards/telosb/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "macros/units.h"
#include "periph_cpu.h"
#include "cfg_timer_a_smclk_b_aclk.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
* @{
Expand Down
6 changes: 2 additions & 4 deletions boards/z1/Makefile.include
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit b51ea4c

Please sign in to comment.