Skip to content

Commit 02df871

Browse files
committed
Merge pull request RIOT-OS#4949 from jia200x/nucleo-f072
board: added support for nucleo f072
2 parents ecf7b46 + cc0e94f commit 02df871

File tree

17 files changed

+6276
-7
lines changed

17 files changed

+6276
-7
lines changed

boards/nucleo-f072/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
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Put defined MCU peripherals here (in alphabetical order)
2+
FEATURES_PROVIDED += periph_cpuid
3+
FEATURES_PROVIDED += periph_gpio
4+
FEATURES_PROVIDED += periph_rtc
5+
FEATURES_PROVIDED += periph_timer
6+
FEATURES_PROVIDED += periph_uart
7+
8+
# Various other features (if any)
9+
FEATURES_PROVIDED += cpp
10+
11+
# The board MPU family (used for grouping by the CI system)
12+
FEATURES_MCU_GROUP = cortex_m0_1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## the cpu to build for
2+
export CPU = stm32f0
3+
export CPU_MODEL = stm32f072rb
4+
5+
#define the default port depending on the host OS
6+
PORT_LINUX ?= /dev/ttyACM0
7+
PORT_DARWIN ?= $(shell ls -1 /dev/tty.usbmodem* | head -n 1)
8+
9+
# setup serial terminal
10+
include $(RIOTBOARD)/Makefile.include.serial
11+
12+
# this board uses openocd
13+
include $(RIOTBOARD)/Makefile.include.openocd
14+
15+
include $(RIOTBOARD)/nucleo-common/Makefile.include

boards/nucleo-f072/board.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (C) 2015 Freie Universität Berlin
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_nucleo-f072
11+
* @{
12+
*
13+
* @file
14+
* @brief Board specific implementations for the nucleo-f072 board
15+
*
16+
* @author Hauke Petersen <[email protected]>
17+
* @author José Alamos <[email protected]>
18+
*
19+
* @}
20+
*/
21+
22+
#include "board.h"
23+
#include "periph/gpio.h"
24+
25+
26+
void board_init(void)
27+
{
28+
/* initialize the boards LED */
29+
gpio_init(LED0_PIN, GPIO_OUT);
30+
31+
/* initialize the CPU */
32+
cpu_init();
33+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source [find board/st_nucleo_f0.cfg]

boards/nucleo-f072/include/board.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2015 Freie Universität Berlin
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+
* @defgroup boards_nucleo-f072 Nucleo-F072
11+
* @ingroup boards
12+
* @brief Board specific files for the nucleo-f072 board
13+
* @{
14+
*
15+
* @file
16+
* @brief Board specific definitions for the nucleo-f072 board
17+
*
18+
* @author Hauke Petersen <[email protected]>
19+
* @author Mohmmad Ayman <[email protected]>
20+
* @author José Alamos <[email protected]>
21+
*/
22+
23+
#ifndef BOARD_H_
24+
#define BOARD_H_
25+
26+
#include <stdint.h>
27+
#include "board_common.h"
28+
29+
#include "cpu.h"
30+
#include "periph_conf.h"
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
37+
/**
38+
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
39+
*/
40+
void board_init(void);
41+
42+
#ifdef __cplusplus
43+
}
44+
#endif
45+
46+
#endif /* BOARD_H_ */
47+
/** @} */
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/*
2+
* Copyright (C) 2015 Freie Universität Berlin
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_nucleo-f072
11+
* @{
12+
*
13+
* @file
14+
* @brief Peripheral MCU configuration for the nucleo-f072 board
15+
*
16+
* @author Hauke Petersen <[email protected]>
17+
* @author José Ignacio Alamos <[email protected]>
18+
*/
19+
20+
#ifndef PERIPH_CONF_H_
21+
#define PERIPH_CONF_H_
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
/**
28+
* @name Clock system configuration
29+
* @{
30+
*/
31+
#define CLOCK_HSE (8000000U) /* external oscillator */
32+
#define CLOCK_CORECLOCK (48000000U) /* desired core clock frequency */
33+
34+
/* the actual PLL values are automatically generated */
35+
#define CLOCK_PLL_MUL (CLOCK_CORECLOCK / CLOCK_HSE)
36+
/** @} */
37+
38+
/**
39+
* @brief Timer configuration
40+
* @{
41+
*/
42+
#define TIMER_NUMOF (1U)
43+
#define TIMER_0_EN 1
44+
#define TIMER_IRQ_PRIO 1
45+
46+
/* Timer 0 configuration */
47+
#define TIMER_0_DEV TIM2
48+
#define TIMER_0_CHANNELS 4
49+
#define TIMER_0_FREQ (CLOCK_CORECLOCK)
50+
#define TIMER_0_MAX_VALUE (0xffffffff)
51+
#define TIMER_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_TIM2EN)
52+
#define TIMER_0_IRQ_CHAN TIM2_IRQn
53+
#define TIMER_0_ISR isr_tim2
54+
/** @} */
55+
56+
/**
57+
* @brief UART configuration
58+
* @}
59+
*/
60+
#define UART_NUMOF (2U)
61+
#define UART_0_EN 1
62+
#define UART_1_EN 1
63+
#define UART_IRQ_PRIO 1
64+
65+
/* UART 0 device configuration */
66+
#define UART_0_DEV USART2
67+
#define UART_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_USART2EN)
68+
#define UART_0_CLKDIS() (RCC->APB1ENR &= (~RCC_APB1ENR_USART2EN))
69+
#define UART_0_IRQ USART2_IRQn
70+
#define UART_0_ISR isr_usart2
71+
/* UART 0 pin configuration */
72+
#define UART_0_PORT GPIOA
73+
#define UART_0_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN)
74+
#define UART_0_RX_PIN 3
75+
#define UART_0_TX_PIN 2
76+
#define UART_0_AF 1
77+
78+
/* UART 1 device configuration */
79+
#define UART_1_DEV USART1
80+
#define UART_1_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_USART1EN)
81+
#define UART_1_CLKDIS() (RCC->APB2ENR &= (~RCC_APB2ENR_USART1EN))
82+
#define UART_1_IRQ USART1_IRQn
83+
#define UART_1_ISR isr_usart1
84+
/* UART 1 pin configuration */
85+
#define UART_1_PORT GPIOB
86+
#define UART_1_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOBEN)
87+
#define UART_1_RX_PIN 7
88+
#define UART_1_TX_PIN 6
89+
#define UART_1_AF 0
90+
/** @} */
91+
92+
93+
/**
94+
* @brief ADC configuration
95+
* @{
96+
*/
97+
#define ADC_CONFIG { \
98+
{ GPIO_PIN(PORT_A, 0), 0 },\
99+
{ GPIO_PIN(PORT_A, 1), 1 },\
100+
{ GPIO_PIN(PORT_A, 4), 4 },\
101+
{ GPIO_PIN(PORT_B, 0), 8 },\
102+
{ GPIO_PIN(PORT_C, 1), 11 },\
103+
{ GPIO_PIN(PORT_C, 0), 10 } \
104+
}
105+
106+
#define ADC_NUMOF (6)
107+
108+
/** @} */
109+
110+
111+
/**
112+
* @brief DAC configuration
113+
* @{
114+
*/
115+
#define DAC_NUMOF (0)
116+
/** @} */
117+
118+
/**
119+
* @name RTC configuration
120+
* @{
121+
*/
122+
/**
123+
* Nucleos with MB1136 C-02 or MB1136 C-03 -sticker on it have the required LSE
124+
* oscillator provided on the X2 slot.
125+
* See Nucleo User Manual UM1724 section 5.6.2.
126+
*/
127+
#define RTC_NUMOF (1U)
128+
/** @} */
129+
130+
#ifdef __cplusplus
131+
}
132+
#endif
133+
134+
#endif /* PERIPH_CONF_H_ */
135+
/** @} */

cpu/stm32f0/include/cpu_conf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#ifdef CPU_MODEL_STM32F091RC
3030
#include "stm32f091xc.h"
3131
#endif
32+
#ifdef CPU_MODEL_STM32F072RB
33+
#include "stm32f072xb.h"
34+
#endif
3235

3336
#ifdef __cplusplus
3437
extern "C" {

0 commit comments

Comments
 (0)