mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards: add stm32mp157c-dk2 initial support
This board is based on a stm32mp157cac which has a dual architecture: * Dual core Cortex-A7 * Cortex-M4 Only Cortex-M4 is supported by RIOT-OS. Cortex-M4 can be used in Engineering mode if stm32mp1_eng_mode pseudomodule is used. By default the RIOT firmware can be loaded by Linux on the Cortex-M4 using remoteproc Linux framework. This the initial commit with a limited set of supported peripheral: * gpio * timer * uart Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
This commit is contained in:
parent
58f90c986f
commit
6d6fd5a975
17
boards/stm32mp157c-dk2/Kconfig
Normal file
17
boards/stm32mp157c-dk2/Kconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2020 Savoir-faire Linux
|
||||
#
|
||||
# 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.
|
||||
|
||||
config BOARD
|
||||
default "stm32mp157c-dk2" if BOARD_STM32MP157C_DK2
|
||||
|
||||
config BOARD_STM32MP157C_DK2
|
||||
bool
|
||||
default y
|
||||
select CPU_MODEL_STM32MP157CAC
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
select HAS_PERIPH_TIMER
|
||||
select HAS_PERIPH_UART
|
3
boards/stm32mp157c-dk2/Makefile
Normal file
3
boards/stm32mp157c-dk2/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
6
boards/stm32mp157c-dk2/Makefile.dep
Normal file
6
boards/stm32mp157c-dk2/Makefile.dep
Normal file
@ -0,0 +1,6 @@
|
||||
USEMODULE += mpu_stack_guard
|
||||
|
||||
# Uncomment this line to build firmware in Engineering mode (BOOT0 off and
|
||||
# BOOT2 on).
|
||||
# You can also add it in your application Makefile.
|
||||
# USEMODULE += stm32mp1_eng_mode
|
7
boards/stm32mp157c-dk2/Makefile.features
Normal file
7
boards/stm32mp157c-dk2/Makefile.features
Normal file
@ -0,0 +1,7 @@
|
||||
CPU = stm32
|
||||
CPU_MODEL = stm32mp157cac
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_gpio
|
||||
FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
20
boards/stm32mp157c-dk2/Makefile.include
Normal file
20
boards/stm32mp157c-dk2/Makefile.include
Normal file
@ -0,0 +1,20 @@
|
||||
# we use shared STM32 configuration snippets
|
||||
INCLUDES += -I$(RIOTBOARD)/common/stm32/include
|
||||
|
||||
# set default port depending on operating system
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
# this board has an on-board ST-link adapter
|
||||
DEBUG_ADAPTER = stlink-dap
|
||||
OPENOCD_CORE = stm32mp15x.cm4
|
||||
GDB_PORT_CORE_OFFSET = 1
|
||||
|
||||
FFLAGS ?= flashr $(FLASHFILE)
|
||||
DEBUGGER_FLAGS ?= debugr $(ELFFILE)
|
||||
|
||||
# Setup of programmer and serial is shared between STM32 based boards
|
||||
include $(RIOTMAKE)/boards/stm32.inc.mk
|
30
boards/stm32mp157c-dk2/board.c
Normal file
30
boards/stm32mp157c-dk2/board.c
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Savoir-faire Linux
|
||||
*
|
||||
* 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_stm32mp157c-dk2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the STM32MP157C-DK2 board
|
||||
*
|
||||
* @author Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
105
boards/stm32mp157c-dk2/doc.txt
Normal file
105
boards/stm32mp157c-dk2/doc.txt
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
@defgroup boards_stm32mp157c-dk2 STM32MP157C-DK2 board
|
||||
@ingroup boards
|
||||
@brief Support for the STM32MP157C-DK2 board
|
||||
|
||||
## Overview
|
||||
|
||||
The STM32MP157C-DK2 is a board from ST featuring a double architecture based on
|
||||
a dual Cortex-A7 and a Cortex-M4 STM32MP157C microcontroller with 384KB of SRAM
|
||||
and no ROM Flash.
|
||||
|
||||
## Hardware
|
||||
|
||||
![STM32MP157C-DK2]
|
||||
(https://www.st.com/bin/ecommerce/api/image.PF267415.en.feature-description-include-personalized-no-cpn-medium.jpg)
|
||||
|
||||
### MCU
|
||||
|
||||
| MCU | STM32MP157CAC |
|
||||
|:---------- |:----------------- |
|
||||
| Family | ARM Dual Cortex-A7 & Cortex-M4 |
|
||||
| Vendor | ST Microelectronics |
|
||||
| RAM | 384Kb for Cortex-M4 |
|
||||
| Flash | None but 64KB of RETRAM |
|
||||
| Frequency | up to 209MHz |
|
||||
| FPU | yes |
|
||||
| Timers | 32 (3x watchdog, 2x 4 Cortex-A7 system timers, 1x SysTick, 5x 16-bit Low-Power, 12x 16-bit, 2x 32-bit, 1 RTC) |
|
||||
| ADCs | 2x 12-bit (16 channels), 2x 16-bit (16 channels) |
|
||||
| UARTs | 4x UART + 4x USART |
|
||||
| SPIs | 6 |
|
||||
| I2Cs | 6 |
|
||||
| RTC | 1 |
|
||||
| CAN | 2 |
|
||||
| USB | 3 |
|
||||
| Vcc | 1.8V - 3.6V |
|
||||
| Datasheet | [Datasheet](https://www.st.com/resource/en/datasheet/stm32mp157c.pdf) |
|
||||
| Reference Manual | [Reference Manual](https://www.st.com/resource/en/reference_manual/dm00327659-stm32mp157-advanced-armbased-32bit-mpus-stmicroelectronics.pdf) |
|
||||
| Programming Manual | [Programming Manual](https://www.st.com/resource/en/programming_manual/dm00046982-stm32-cortexm4-mcus-and-mpus-programming-manual-stmicroelectronics.pdf) |
|
||||
| Board Manual | [Board Manual](https://www.st.com/resource/en/user_manual/dm00591354-discovery-kits-with-stm32mp157-mpus-stmicroelectronics.pdf)|
|
||||
|
||||
## Implementation Status
|
||||
|
||||
| Device | ID | Supported | Comments |
|
||||
|:------------- |:------------- |:------------- |:------------- |
|
||||
| MCU | STM32MP157CAC | partly | |
|
||||
| Low-level driver | GPIO | yes | |
|
||||
| | UART | 1 UART | USART3 on PB12(RX)/PB10(TX) |
|
||||
| | Timer | one 32 bit timer | TIM2 |
|
||||
|
||||
## Flashing the device
|
||||
|
||||
Note that the STM32MP157C-DK2 board has no ROM Flash, thus the firmware
|
||||
needs to be reflashed each time the board is rebooted.
|
||||
|
||||
### Boot selection jumper:
|
||||
|
||||
| BOOT mode | BOOT0 | BOOT2 |
|
||||
| :-------- |:----- |:----- |
|
||||
| Engineering | 1 | 1 |
|
||||
| SD Card (Linux) | 0 | 1 |
|
||||
|
||||
### Engineering mode
|
||||
|
||||
The STM32MP157C-DK2 board includes an on-board ST-LINK V2 programmer. The
|
||||
easiest way to program the board is to use OpenOCD. Once you have installed
|
||||
OpenOCD (look [here](https://github.com/RIOT-OS/RIOT/wiki/OpenOCD) for
|
||||
installation instructions), you can flash the board simply by typing inside
|
||||
your application directory:
|
||||
|
||||
```
|
||||
USEMODULE='stm32mp1_eng_mode' make BOARD=stm32mp157c-dk2 flash
|
||||
```
|
||||
and debug via GDB by simply typing
|
||||
```
|
||||
USEMODULE='stm32mp1_eng_mode' make BOARD=stm32mp157c-dk2 debug
|
||||
```
|
||||
### SD Card (Linux) mode
|
||||
|
||||
This assumes that Linux is booted and that your Linux kernel supports STM32
|
||||
remoteproc framework.
|
||||
|
||||
Build the firmware inside your application directory:
|
||||
```
|
||||
make BOARD=stm32mp157c-dk2
|
||||
```
|
||||
Copy your firmware firmware.elf in /lib/firmwares on the Linux system.
|
||||
(replace firmware.elf by your firmware filename)
|
||||
|
||||
Then simply launch this commands on the Linux system as root user:
|
||||
```
|
||||
echo firmware.elf > /sys/class/remoteproc/remoteproc0/firmware
|
||||
echo start > /sys/class/remoteproc/remoteproc0/state
|
||||
```
|
||||
|
||||
You can stop RIOT from Linux command line:
|
||||
```
|
||||
echo stop > /sys/class/remoteproc/remoteproc0/state
|
||||
```
|
||||
|
||||
## Supported Toolchains
|
||||
|
||||
For using the STM32MP157C-DK2 board we strongly recommend the usage of the
|
||||
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded)
|
||||
toolchain.
|
||||
*/
|
41
boards/stm32mp157c-dk2/include/board.h
Normal file
41
boards/stm32mp157c-dk2/include/board.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Savoir-faire Linux
|
||||
*
|
||||
* 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_stm32mp157c-dk2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the STM32MP157C-DK2 board
|
||||
*
|
||||
* @author Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph_conf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
78
boards/stm32mp157c-dk2/include/periph_conf.h
Normal file
78
boards/stm32mp157c-dk2/include/periph_conf.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Savoir-faire Linux
|
||||
*
|
||||
* 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_stm32mp157c-dk2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the STM32MP157C-DK2 board
|
||||
*
|
||||
* @author Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
|
||||
/* This board provides an LSE */
|
||||
#ifndef CONFIG_BOARD_HAS_LSE
|
||||
#define CONFIG_BOARD_HAS_LSE 1
|
||||
#endif
|
||||
|
||||
/* This board provides an HSE */
|
||||
#ifndef CONFIG_BOARD_HAS_HSE
|
||||
#define CONFIG_BOARD_HAS_HSE 1
|
||||
#endif
|
||||
|
||||
#include "periph_cpu.h"
|
||||
#include "clk_conf.h"
|
||||
#include "cfg_timer_tim2.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
static const uart_conf_t uart_config[] = {
|
||||
{
|
||||
.dev = USART3,
|
||||
.rcc_mask = RCC_MC_APB1ENSETR_USART3EN,
|
||||
.rx_pin = GPIO_PIN(PORT_B, 12),
|
||||
.tx_pin = GPIO_PIN(PORT_B, 10),
|
||||
.rx_af = GPIO_AF8,
|
||||
.tx_af = GPIO_AF7,
|
||||
.bus = APB1,
|
||||
.irqn = USART3_IRQn,
|
||||
.type = STM32_USART,
|
||||
#ifdef UART_USE_DMA
|
||||
.dma_stream = 4,
|
||||
.dma_chan = 4,
|
||||
#endif
|
||||
#if IS_USED(MODULE_STM32MP1_ENG_MODE)
|
||||
.clk_src = RCC_UART35CKSELR_UART35SRC_4, /* HSE clock source */
|
||||
#else
|
||||
.clk_src = RCC_UART35CKSELR_UART35SRC_2, /* HSI clock source */
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
#define UART_0_ISR (isr_usart3)
|
||||
#define UART_0_DMA_ISR (isr_dma1_stream4)
|
||||
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
||||
/** @} */
|
Loading…
Reference in New Issue
Block a user