Skip to content

Commit 89bab31

Browse files
boards/stm32c0316-dk: initial support
1 parent 5d99325 commit 89bab31

File tree

10 files changed

+206
-1
lines changed

10 files changed

+206
-1
lines changed

boards/stm32c0316-dk/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2024 BISSELL Homecare, Inc.
2+
#
3+
# This file is subject to the terms and conditions of the GNU Lesser
4+
# General Public License v2.1. See the file LICENSE in the top level
5+
# directory for more details.
6+
#
7+
8+
config BOARD
9+
default "stm32c0316-dk" if BOARD_STM32C0316_DK
10+
11+
config BOARD_STM32C0316_DK
12+
bool
13+
default y
14+
select CPU_MODEL_STM32C031C6

boards/stm32c0316-dk/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODULE = board
2+
3+
include $(RIOTBASE)/Makefile.base

boards/stm32c0316-dk/Makefile.dep

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CPU = stm32
2+
CPU_MODEL = stm32c031c6
3+
4+
# Put defined MCU peripherals here (in alphabetical order)
5+
FEATURES_PROVIDED += periph_timer
6+
FEATURES_PROVIDED += periph_uart
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# we use shared STM32 configuration snippets
2+
INCLUDES += -I$(RIOTBASE)/boards/common/stm32/include
3+
4+
# define the default port depending on the host OS
5+
PORT_LINUX ?= /dev/ttyACM0
6+
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
7+
8+
# setup serial terminal
9+
include $(RIOTMAKE)/tools/serial.inc.mk
10+
11+
PROGRAMMER ?= openocd
12+
OPENOCD_DEBUG_ADAPTER ?= stlink
13+
14+
# openocd programmer is supported
15+
PROGRAMMERS_SUPPORTED += openocd
16+
17+
# this board uses openocd
18+
include $(RIOTMAKE)/tools/openocd.inc.mk
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set WORKAREASIZE 0x2000
2+
source [find interface/stlink-v2.cfg]
3+
source [find target/stm32c0x.cfg]
4+
5+
#reset_config srst_only
6+
7+
#$_TARGETNAME configure -rtos auto

boards/stm32c0316-dk/doc.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @defgroup boards_stm32c0316-dk STM32C0316-DK
3+
* @ingroup boards
4+
* @brief Support for the STM32C0316-DK board.
5+
*
6+
* ### General information
7+
*
8+
* The ST [STM32C0316-DK](https://www.st.com/en/evaluation-tools/stm32c0316-dk.html)
9+
* is an evaluation board supporting a ARM Cortex-M0 STM32C031C6 microcontroller
10+
* with 8KB of RAM and 32KB of ROM Flash.
11+
*
12+
* ### Pinout
13+
*
14+
* See [this application note as reference](https://www.st.com/resource/en/application_note/an5673-getting-started-with-stm32c0-mcu-hardware-development-stmicroelectronics.pdf).
15+
* This means the responsibility is on the firmware configurer to take special care when configured IO, ensuring that
16+
* ports are not conflicting on each pin.
17+
*
18+
* ### Flash the board
19+
*
20+
* The STM32C0316-DK board includes an on-board ST-LINK programmer and can be
21+
* flashed using OpenOCD.
22+
*
23+
* To flash this board, just use the following command:
24+
*
25+
* ```
26+
* make BOARD=stm32c0316-dk flash -C examples/hello-world
27+
* ```
28+
*
29+
* ### UART Terminal Interaction
30+
*
31+
* Due to the limited number of pins, to get stdio UART traffic, use a USB->UART adapter
32+
* like the CP2104 from Adafruit (http://adafru.it/954). Connect the adapter's TX line
33+
* to the MCU RX pin (PB6, Pin 8) and the adapter's RX line to the MCU's TX pin -
34+
* (PB7, pin 1)
35+
*/
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (C) 2024 BISSELL Homecare, Inc.
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
/**
10+
* @ingroup boards_stm32c0316-dk
11+
* @{
12+
*
13+
* @file
14+
* @brief Board specific definitions for the STM32C0316-DK
15+
*
16+
* @author Jason Parker <[email protected]>
17+
*/
18+
19+
#ifndef BOARD_H
20+
#define BOARD_H
21+
22+
#include "cpu.h"
23+
#include "periph_conf.h"
24+
#include "periph_cpu.h"
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
#define LED0_PIN_NUM 5
31+
#define LED0_PORT GPIO_PORT_A /**< GPIO port of LED 0 */
32+
#define LED0_PORT_NUM PORT_A
33+
34+
#define BTN0_PIN GPIO_PIN(PORT_A, 4)
35+
#define BTN0_MODE GPIO_IN
36+
37+
#ifdef __cplusplus
38+
}
39+
#endif
40+
41+
#include "stm32_leds.h"
42+
43+
#endif /* BOARD_H */
44+
/** @} */
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (C) 2024 BISSELL Homecare, Inc.
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
/**
10+
* @ingroup boards_stm32c0316-dk
11+
* @{
12+
*
13+
* @file
14+
* @brief Configuration of CPU peripherals for STM32C0316-DK board
15+
*
16+
* @author Jason Parker <[email protected]>
17+
*/
18+
19+
#ifndef PERIPH_CONF_H
20+
#define PERIPH_CONF_H
21+
22+
#include <stdint.h>
23+
24+
#include "cpu.h"
25+
#include "periph_cpu.h"
26+
#include "clk_conf.h"
27+
#include "cfg_rtt_default.h"
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
/**
34+
* @name Timer configuration
35+
* @{
36+
*/
37+
static const timer_conf_t timer_config[] = {
38+
{
39+
.dev = TIM3,
40+
.max = 0x0000ffff,
41+
.rcc_mask = RCC_APBENR1_TIM3EN,
42+
.bus = APB1,
43+
.irqn = TIM3_IRQn
44+
}
45+
};
46+
47+
#define TIMER_0_ISR isr_tim3
48+
49+
#define TIMER_NUMOF ARRAY_SIZE(timer_config)
50+
/** @} */
51+
52+
/**
53+
* @name UART configuration
54+
* @{
55+
*/
56+
static const uart_conf_t uart_config[] = {
57+
{
58+
.dev = USART2,
59+
.rcc_mask = RCC_APBENR1_USART2EN,
60+
.rx_pin = GPIO_PIN(PORT_A, 3),
61+
.tx_pin = GPIO_PIN(PORT_A, 2),
62+
.rx_af = GPIO_AF1,
63+
.tx_af = GPIO_AF1,
64+
.bus = APB1,
65+
.irqn = USART2_IRQn,
66+
}
67+
};
68+
69+
#define UART_0_ISR (isr_usart2)
70+
71+
#define UART_NUMOF ARRAY_SIZE(uart_config)
72+
/** @} */
73+
74+
#ifdef __cplusplus
75+
}
76+
#endif
77+
78+
#endif /* PERIPH_CONF_H */
79+
/** @} */

boards/stm32g0316-disco/include/board.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
extern "C" {
2828
#endif
2929

30-
3130
#define LED0_PIN_NUM 12
3231
#define LED0_PORT GPIO_PORT_A /**< GPIO port of LED 0 */
3332
#define LED0_PORT_NUM PORT_A

0 commit comments

Comments
 (0)