From ffa67b77c6a5d7260ecc12bd6ebf8f66c8d0853a Mon Sep 17 00:00:00 2001 From: Matthias Boesl Date: Sat, 3 Dec 2016 09:22:00 +0100 Subject: [PATCH] board: add initial support for Nucleo-64 with Soc STM32F411RE Change-Id: I698693bccce1e9599c20e57f5d4172643ca38cc9 Signed-off-by: Matthias Boesl --- .../stm32f4/Kconfig.defconfig.stm32f411xe | 34 +++++++++++++ arch/arm/soc/st_stm32/stm32f4/Kconfig.soc | 3 ++ boards/arm/nucleo_f411re/Kconfig.board | 20 ++++++++ boards/arm/nucleo_f411re/Kconfig.defconfig | 23 +++++++++ boards/arm/nucleo_f411re/Makefile | 2 + boards/arm/nucleo_f411re/Makefile.board | 6 +++ boards/arm/nucleo_f411re/board.h | 22 +++++++++ .../arm/nucleo_f411re/nucleo_f411re_defconfig | 36 ++++++++++++++ boards/arm/nucleo_f411re/support/openocd.cfg | 12 +++++ drivers/pinmux/Makefile | 1 + .../pinmux/stm32/pinmux_board_nucleo_f411re.c | 48 +++++++++++++++++++ 11 files changed, 207 insertions(+) create mode 100644 arch/arm/soc/st_stm32/stm32f4/Kconfig.defconfig.stm32f411xe create mode 100644 boards/arm/nucleo_f411re/Kconfig.board create mode 100644 boards/arm/nucleo_f411re/Kconfig.defconfig create mode 100644 boards/arm/nucleo_f411re/Makefile create mode 100644 boards/arm/nucleo_f411re/Makefile.board create mode 100644 boards/arm/nucleo_f411re/board.h create mode 100644 boards/arm/nucleo_f411re/nucleo_f411re_defconfig create mode 100644 boards/arm/nucleo_f411re/support/openocd.cfg create mode 100644 drivers/pinmux/stm32/pinmux_board_nucleo_f411re.c diff --git a/arch/arm/soc/st_stm32/stm32f4/Kconfig.defconfig.stm32f411xe b/arch/arm/soc/st_stm32/stm32f4/Kconfig.defconfig.stm32f411xe new file mode 100644 index 00000000000..fc42c963273 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32f4/Kconfig.defconfig.stm32f411xe @@ -0,0 +1,34 @@ +# Kconfig - ST STM32F411CE MCU configuration options +# +# Copyright (c) 2016 Linaro Limited. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +if SOC_STM32F411XE + +config SOC + string + default stm32f411xe + +config SRAM_SIZE + default 128 + +config FLASH_SIZE + default 512 + +config NUM_IRQS + int + default 85 + +endif # SOC_STM32F411XE diff --git a/arch/arm/soc/st_stm32/stm32f4/Kconfig.soc b/arch/arm/soc/st_stm32/stm32f4/Kconfig.soc index 3947e3a45b0..d4076ffdeed 100644 --- a/arch/arm/soc/st_stm32/stm32f4/Kconfig.soc +++ b/arch/arm/soc/st_stm32/stm32f4/Kconfig.soc @@ -22,4 +22,7 @@ depends on SOC_SERIES_STM32F4X config SOC_STM32F401XE bool "STM32F401XE" +config SOC_STM32F411XE + bool "STM32F411XE" + endchoice diff --git a/boards/arm/nucleo_f411re/Kconfig.board b/boards/arm/nucleo_f411re/Kconfig.board new file mode 100644 index 00000000000..b8297f29862 --- /dev/null +++ b/boards/arm/nucleo_f411re/Kconfig.board @@ -0,0 +1,20 @@ +# Kconfig - NUCLEO-64 F411RE board configuration +# +# Copyright (c) 2016 Matthias Boesl +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +config BOARD_NUCLEO_F411RE + bool "NUCLEO-64 F411RE Development Board" + depends on SOC_STM32F411XE diff --git a/boards/arm/nucleo_f411re/Kconfig.defconfig b/boards/arm/nucleo_f411re/Kconfig.defconfig new file mode 100644 index 00000000000..f283f483ff2 --- /dev/null +++ b/boards/arm/nucleo_f411re/Kconfig.defconfig @@ -0,0 +1,23 @@ +# Kconfig - NUCLEO-64 F411RE board configuration +# +# Copyright (c) 2016 Matthias Boesl +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +if BOARD_NUCLEO_F411RE + +config BOARD + default nucleo_f411re + +endif # BOARD_NUCLEO_F411RE diff --git a/boards/arm/nucleo_f411re/Makefile b/boards/arm/nucleo_f411re/Makefile new file mode 100644 index 00000000000..c925263c43a --- /dev/null +++ b/boards/arm/nucleo_f411re/Makefile @@ -0,0 +1,2 @@ +# No C files (yet) +obj- += dummy.o diff --git a/boards/arm/nucleo_f411re/Makefile.board b/boards/arm/nucleo_f411re/Makefile.board new file mode 100644 index 00000000000..7d02aa38866 --- /dev/null +++ b/boards/arm/nucleo_f411re/Makefile.board @@ -0,0 +1,6 @@ +FLASH_SCRIPT = openocd.sh + +OPENOCD_LOAD_CMD = "flash write_image erase ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" +OPENOCD_VERIFY_CMD = "verify_image ${O}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + +export FLASH_SCRIPT OPENOCD_LOAD_CMD OPENOCD_VERIFY_CMD diff --git a/boards/arm/nucleo_f411re/board.h b/boards/arm/nucleo_f411re/board.h new file mode 100644 index 00000000000..10ecf80d7af --- /dev/null +++ b/boards/arm/nucleo_f411re/board.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2016 Matthias Boesl + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/nucleo_f411re/nucleo_f411re_defconfig b/boards/arm/nucleo_f411re/nucleo_f411re_defconfig new file mode 100644 index 00000000000..dd7e05d6c83 --- /dev/null +++ b/boards/arm/nucleo_f411re/nucleo_f411re_defconfig @@ -0,0 +1,36 @@ +CONFIG_ARM=y +CONFIG_BOARD_NUCLEO_F411RE=y +CONFIG_SOC_SERIES_STM32F4X=y +CONFIG_SOC_STM32F411XE=y +# 96MHz system clock (highest value to get a precise USB clock) +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000 +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 + +# enable USART2 - passthrough to STLINK v2 connector +CONFIG_UART_STM32_PORT_2=y +CONFIG_UART_STM32_PORT_2_BAUD_RATE=115200 +# enable console on this port by default +CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_2" + +# enable pinmux +CONFIG_PINMUX=y + +# enable GPIO ports A, B, C +CONFIG_GPIO=y + +# clock configuration +CONFIG_CLOCK_CONTROL=y +CONFIG_CLOCK_STM32F4X_SYSCLK_SRC_PLL=y +# use HSE as PLL input +CONFIG_CLOCK_STM32F4X_PLL_SRC_HSE=y +# however, the board does not have an external oscillator, so just use +# the 8MHz clock signal coming from integrated STLink +CONFIG_CLOCK_STM32F4X_HSE_BYPASS=y +# produce 96MHz clock at PLL output +CONFIG_CLOCK_STM32F4X_PLLM_DIV_FACTOR=8 +CONFIG_CLOCK_STM32F4X_PLLN_MULTIPLIER=384 +CONFIG_CLOCK_STM32F4X_PLLP_DIV_FACTOR=4 +CONFIG_CLOCK_STM32F4X_PLLQ_DIV_FACTOR=8 +CONFIG_CLOCK_STM32F4X_AHB_PRESCALER=0 +CONFIG_CLOCK_STM32F4X_APB1_PRESCALER=2 +CONFIG_CLOCK_STM32F4X_APB2_PRESCALER=0 \ No newline at end of file diff --git a/boards/arm/nucleo_f411re/support/openocd.cfg b/boards/arm/nucleo_f411re/support/openocd.cfg new file mode 100644 index 00000000000..9073ee6db09 --- /dev/null +++ b/boards/arm/nucleo_f411re/support/openocd.cfg @@ -0,0 +1,12 @@ +source [find board/st_nucleo_f4.cfg] + +$_TARGETNAME configure -event gdb-attach { + echo "Debugger attaching: halting execution" + reset halt + gdb_breakpoint_override hard +} + +$_TARGETNAME configure -event gdb-detach { + echo "Debugger detaching: resuming execution" + resume +} diff --git a/drivers/pinmux/Makefile b/drivers/pinmux/Makefile index e2ebc8942e1..1b2999f1c5d 100644 --- a/drivers/pinmux/Makefile +++ b/drivers/pinmux/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_PINMUX_STM32) += stm32/pinmux_stm32.o obj-$(CONFIG_PINMUX_BEETLE) += beetle/pinmux_board_v2m_beetle.o obj-$(CONFIG_BOARD_NUCLEO_F103RB) += stm32/pinmux_board_nucleo_f103rb.o obj-$(CONFIG_BOARD_NUCLEO_F401RE) += stm32/pinmux_board_nucleo_f401re.o +obj-$(CONFIG_BOARD_NUCLEO_F411RE) += stm32/pinmux_board_nucleo_f411re.o obj-$(CONFIG_BOARD_96B_CARBON) += stm32/pinmux_board_carbon.o obj-$(CONFIG_BOARD_NUCLEO_L476RG) += stm32/pinmux_board_nucleo_l476rg.o obj-$(CONFIG_BOARD_OLIMEXINO_STM32) += stm32/pinmux_board_olimexino_stm32.o diff --git a/drivers/pinmux/stm32/pinmux_board_nucleo_f411re.c b/drivers/pinmux/stm32/pinmux_board_nucleo_f411re.c new file mode 100644 index 00000000000..0124647dede --- /dev/null +++ b/drivers/pinmux/stm32/pinmux_board_nucleo_f411re.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Linaro Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include "pinmux/pinmux.h" + +#include "pinmux_stm32.h" + +/* pin assignments for NUCLEO-F411RE board */ +static const struct pin_config pinconf[] = { +#ifdef CONFIG_UART_STM32_PORT_1 + {STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_USART1_TX}, + {STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_USART1_RX}, +#endif /* CONFIG_UART_STM32_PORT_1 */ +#ifdef CONFIG_UART_STM32_PORT_2 + {STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX}, + {STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX}, +#endif /* CONFIG_UART_STM32_PORT_2 */ +}; + +static int pinmux_stm32_init(struct device *port) +{ + ARG_UNUSED(port); + + stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf)); + + return 0; +} + +SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, + CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);