From afcb1ae71fd857b1ed2c25bb81373e0d5f3ff10a Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Mon, 1 Jul 2019 16:54:34 +0200 Subject: [PATCH] boards: Add stm32h747i_disco, C-M7 target Add C-M7 target for board stm32h747i_disco. Signed-off-by: Erwan Gouriou --- boards/arm/stm32h747i_disco/CMakeLists.txt | 7 ++ boards/arm/stm32h747i_disco/Kconfig.board | 11 ++++ boards/arm/stm32h747i_disco/Kconfig.defconfig | 27 ++++++++ boards/arm/stm32h747i_disco/pinmux.c | 37 +++++++++++ .../stm32h747i_disco/stm32h747i_disco.dtsi | 66 +++++++++++++++++++ .../stm32h747i_disco/stm32h747i_disco_m7.dts | 56 ++++++++++++++++ .../stm32h747i_disco/stm32h747i_disco_m7.yaml | 12 ++++ .../stm32h747i_disco_m7_defconfig | 48 ++++++++++++++ 8 files changed, 264 insertions(+) create mode 100644 boards/arm/stm32h747i_disco/CMakeLists.txt create mode 100644 boards/arm/stm32h747i_disco/Kconfig.board create mode 100644 boards/arm/stm32h747i_disco/Kconfig.defconfig create mode 100644 boards/arm/stm32h747i_disco/pinmux.c create mode 100644 boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi create mode 100644 boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts create mode 100644 boards/arm/stm32h747i_disco/stm32h747i_disco_m7.yaml create mode 100644 boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig diff --git a/boards/arm/stm32h747i_disco/CMakeLists.txt b/boards/arm/stm32h747i_disco/CMakeLists.txt new file mode 100644 index 00000000000000..da3eb6885f53ee --- /dev/null +++ b/boards/arm/stm32h747i_disco/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_PINMUX) +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +endif() diff --git a/boards/arm/stm32h747i_disco/Kconfig.board b/boards/arm/stm32h747i_disco/Kconfig.board new file mode 100644 index 00000000000000..dc492c1c669c36 --- /dev/null +++ b/boards/arm/stm32h747i_disco/Kconfig.board @@ -0,0 +1,11 @@ +# Kconfig - STM32H747I Discovery board configuration +# +# Copyright (c) 2019 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 +# + +config BOARD_STM32H747I_DISCO_M7 + bool "STM32H747I Discovery Development Board" + depends on SOC_STM32H747XX + select CPU_CORTEX_M7 diff --git a/boards/arm/stm32h747i_disco/Kconfig.defconfig b/boards/arm/stm32h747i_disco/Kconfig.defconfig new file mode 100644 index 00000000000000..014a0e95906ff0 --- /dev/null +++ b/boards/arm/stm32h747i_disco/Kconfig.defconfig @@ -0,0 +1,27 @@ +# Kconfig - STM32H747I DISCOVERY board configuration +# +# Copyright (c) 2019 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 +# + +if BOARD_STM32H747I_DISCO_M7 + +config BOARD + default "stm32h747i_disco_m7" if BOARD_STM32H747I_DISCO_M7 + +if UART_CONSOLE + +config UART_1 + default y + +endif # UART_CONSOLE + +if SERIAL + +config UART_8 + default y + +endif # SERIAL + +endif # BOARD_STM32H747I_DISCO_M7 diff --git a/boards/arm/stm32h747i_disco/pinmux.c b/boards/arm/stm32h747i_disco/pinmux.c new file mode 100644 index 00000000000000..1b4408446c3227 --- /dev/null +++ b/boards/arm/stm32h747i_disco/pinmux.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include + +/* pin assignments for STM32H747I-DISCO board */ +static const struct pin_config pinconf[] = { +#ifdef CONFIG_UART_1 + {STM32_PIN_PA9, STM32H7_PINMUX_FUNC_PA9_USART1_TX}, + {STM32_PIN_PA10, STM32H7_PINMUX_FUNC_PA10_USART1_RX}, +#endif /* CONFIG_UART_1 */ +#ifdef CONFIG_UART_8 + {STM32_PIN_PJ8, STM32H7_PINMUX_FUNC_PJ8_UART8_TX}, + {STM32_PIN_PJ9, STM32H7_PINMUX_FUNC_PJ9_UART8_RX}, +#endif /* CONFIG_UART_8 */ +}; + +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); diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi b/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi new file mode 100644 index 00000000000000..89e87c45611efb --- /dev/null +++ b/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + leds { + compatible = "gpio-leds"; + green_led_1:led_1 { + gpios = <&gpioi 12 GPIO_INT_ACTIVE_HIGH>; + label = "User LD1"; + status = "disabled"; + }; + orange_led_2:led_2 { + gpios = <&gpioi 13 GPIO_INT_ACTIVE_HIGH>; + label = "User LD2"; + status = "disabled"; + }; + red_led_3:led_3 { + gpios = <&gpioi 14 GPIO_INT_ACTIVE_HIGH>; + label = "User LD3"; + status = "disabled"; + }; + blue_led_4:led_4 { + gpios = <&gpioi 15 GPIO_INT_ACTIVE_HIGH>; + label = "User LD4"; + status = "disabled"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + wake_up: button { + label = "Wakeup"; + gpios = <&gpioc 13 GPIO_INT_ACTIVE_HIGH>; + status = "disabled"; + }; + joy_center: joystick_center { + label = "joystick center"; + gpios = <&gpiok 2 GPIO_INT_ACTIVE_LOW>; + status = "disabled"; + }; + joy_down: joystick_down { + label = "joystick down"; + gpios = <&gpiok 3 GPIO_INT_ACTIVE_LOW>; + status = "disabled"; + }; + joy_up: joystick_up { + label = "joystick up"; + gpios = <&gpiok 6 GPIO_INT_ACTIVE_LOW>; + status = "disabled"; + }; + joy_left: joystick_left { + label = "joystick left"; + gpios = <&gpiok 4 GPIO_INT_ACTIVE_LOW>; + }; + joy_right: joystick_right { + label = "joystick right"; + gpios = <&gpiok 5 GPIO_INT_ACTIVE_LOW>; + status = "disabled"; + }; + }; +}; + +arduino_serial: &uart8 {}; diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts new file mode 100644 index 00000000000000..6968204608ab58 --- /dev/null +++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "stm32h747i_disco.dtsi" + +/ { + model = "STMicroelectronics STM32H747I DISCOVERY board"; + compatible = "st,stm32h747i-disco", "st,stm32h747"; + + /* HW resources are split between CM7 and CM4 */ + chosen { + zephyr,console = &usart1; + zephyr,shell-uart = &usart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + green_led_1:led_1 { + status = "okay"; + }; + orange_led_2:led_2 { + status = "okay"; + }; + }; + + gpio_keys { + wake_up: button { + status = "okay"; + }; + }; + + aliases { + led0 = &green_led_1; + led1 = &orange_led_2; + sw0 = &wake_up; + }; +}; + + +&usart1 { + current-speed = <115200>; + pinctrl-names = "default"; + status = "ok"; +}; + +&uart8 { + current-speed = <115200>; + pinctrl-names = "default"; + status = "ok"; +}; diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.yaml b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.yaml new file mode 100644 index 00000000000000..62da88000724ca --- /dev/null +++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.yaml @@ -0,0 +1,12 @@ +identifier: stm32h747i_disco_m7 +name: STM32H747IDISCOVERY +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 512 +flash: 1024 +supported: + - gpio diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig new file mode 100644 index 00000000000000..d993ed5b8990ed --- /dev/null +++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM=y +CONFIG_BOARD_STM32H747I_DISCO_M7=y +CONFIG_SOC_SERIES_STM32H7X=y +CONFIG_SOC_STM32H747XX=y +CONFIG_CORTEX_M_SYSTICK=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 + +# enable pinmux +CONFIG_PINMUX=y + +# enable GPIO +CONFIG_GPIO=y + +# clock configuration +CONFIG_CLOCK_CONTROL=y + +# Clock configuration for Cube Clock control driver +CONFIG_CLOCK_STM32_HSE_CLOCK=25000000 +CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y + +# use HSE (bypass) as PLL input +CONFIG_CLOCK_STM32_PLL_SRC_HSE=y +CONFIG_CLOCK_STM32_HSE_BYPASS=y + +# produce 400MHz clock at PLL output +CONFIG_CLOCK_STM32_PLL_M_DIVISOR=5 +CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=160 +CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2 +CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=4 +CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2 + +CONFIG_CLOCK_STM32_D1CPRE=1 +# HCLK: 200MHz +CONFIG_CLOCK_STM32_HPRE=2 +# APBX: 100MHz +CONFIG_CLOCK_STM32_D2PPRE1=2 +CONFIG_CLOCK_STM32_D2PPRE2=2 +CONFIG_CLOCK_STM32_D1PPRE=2 +CONFIG_CLOCK_STM32_D3PPRE=2 + +# enable uart driver +CONFIG_SERIAL=y + +# console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y