Skip to content

Commit

Permalink
add support for bluepill board
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeum committed Oct 17, 2017
1 parent b3ebdab commit 50bd71c
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 1 deletion.
3 changes: 3 additions & 0 deletions boards/bluepill/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = board

include $(RIOTBASE)/Makefile.base
3 changes: 3 additions & 0 deletions boards/bluepill/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
14 changes: 14 additions & 0 deletions boards/bluepill/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_adc

# Various other features (if any)
FEATURES_PROVIDED += cpp

# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m3_2
13 changes: 13 additions & 0 deletions boards/bluepill/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## the cpu to build for
export CPU = stm32f1
export CPU_MODEL = stm32f103c8

# define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))

# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
32 changes: 32 additions & 0 deletions boards/bluepill/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
*
* 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_bluepill
* @{
*
* @file
* @brief Board specific implementations for the bluepill board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
*
* @}
*/

#include "board.h"
#include "periph/gpio.h"

void board_init(void)
{
cpu_init();
gpio_init(LED0_PIN, GPIO_OUT);
}
7 changes: 7 additions & 0 deletions boards/bluepill/dist/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source [find interface/stlink-v2.cfg]
transport select hla_swd

source [find target/stm32f1x.cfg]
reset_config none separate

$_TARGETNAME configure -rtos auto
66 changes: 66 additions & 0 deletions boards/bluepill/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2015 TriaGnoSys GmbH
* 2017 Alexander Kurth, Sören Tempel, Tristan Bruns
*
* 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_bluepill
* @{
*
* @file
* @brief Peripheral MCU configuration for the bluepill board
*
* @author Víctor Ariño <victor.arino@triagnosys.com>
* @author Sören Tempel <tempel@uni-bremen.de>
* @author Tristan Bruns <tbruns@uni-bremen.de>
* @author Alexander Kurth <kurth1@uni-bremen.de>
*
*/

#ifndef BOARD_H
#define BOARD_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief LED pin definitions and handlers
* @{
*/
#define LED0_PORT GPIOC
#define LED0_PIN GPIO_PIN(PORT_C, 13)
#define LED0_MASK (1 << 13)

#define LED0_ON (LED0_PORT->BSRR = LED0_MASK)
#define LED0_OFF (LED0_PORT->BSRR = (LED0_MASK << 16))
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

/**
* @brief Use the 2nd UART for STDIO on this board
*/
#define UART_STDIO_DEV UART_DEV(1)

/**
* @name xtimer configuration
*/
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF 5
/** @} */

#ifdef __cplusplus
}
#endif

#endif /* BOARD_H */
/** @} */
46 changes: 46 additions & 0 deletions boards/bluepill/include/gpio_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2017 HAW Hamburg
*
* 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_stm32f130c8t6
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Sebastian Meiling <s@mlng.net>
*/

#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H

#include "board.h"
#include "saul/periph.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED",
.pin = LED0_PIN,
.mode = GPIO_OUT
},
};

#ifdef __cplusplus
}
#endif

#endif /* GPIO_PARAMS_H */
/** @} */
Loading

0 comments on commit 50bd71c

Please sign in to comment.