diff --git a/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/index.rst b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/index.rst new file mode 100644 index 00000000000..a49d34868bd --- /dev/null +++ b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/index.rst @@ -0,0 +1,39 @@ +================ +ST STM32H735G-DK +================ + +.. tags:: chip:stm32, chip:stm32h7, chip:stm32h735 + +.. figure:: stm32h735g-dk-front.jpg + :align: center + :alt: STM32H735G-DK Front + + STM32H735G-DK Front + +.. figure:: stm32h735g-dk-back.jpg + :align: center + :alt: STM32H735G-DK Back + + STM32H735G-DK Back + +The STM32H735G-DK Discovery board features an STM32H735IGK6 Cortex-M7 +with 1 MiB flash, 564 KiB RAM and a 480 x 272 touchscreen. + +Configurations +============== + +nsh +--- + +Basic NuttShell configuration with procfs. + +jumbo +----- + +OS tests and LED/button drivers. Run ``ostest`` from NSH. + +lvgl +---- + +LVGL widgets demo with the on-board LCD and GT911 touchscreen. +Run ``lvgldemo widgets &`` from NSH. diff --git a/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-back.jpg b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-back.jpg new file mode 100644 index 00000000000..f17b609b0a6 Binary files /dev/null and b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-back.jpg differ diff --git a/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-front.jpg b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-front.jpg new file mode 100644 index 00000000000..938b8dc5fe3 Binary files /dev/null and b/Documentation/platforms/arm/stm32h7/boards/stm32h735g-dk/stm32h735g-dk-front.jpg differ diff --git a/boards/Kconfig b/boards/Kconfig index 11de7871d48..3df775a7ff6 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2136,6 +2136,15 @@ config ARCH_BOARD_NUCLEO_H745ZI ---help--- STMicro Nucleo H745ZI board based on the STMicro STM32H745ZI MCU. +config ARCH_BOARD_STM32H735G_DK + bool "STM32H735G-DK board" + depends on ARCH_CHIP_STM32H735IG + select ARCH_HAVE_LEDS + select ARCH_HAVE_BUTTONS + select ARCH_HAVE_IRQBUTTONS + ---help--- + STMicro STM32H735G-DK Discovery kit based on the STM32H735IG MCU. + config ARCH_BOARD_STM32H745I_DISCO bool "STM32H745I-DISCO board" depends on ARCH_CHIP_STM32H745XI @@ -4147,6 +4156,7 @@ config ARCH_BOARD default "nucleo-h743zi" if ARCH_BOARD_NUCLEO_H743ZI default "nucleo-h743zi2" if ARCH_BOARD_NUCLEO_H743ZI2 default "nucleo-h745zi" if ARCH_BOARD_NUCLEO_H745ZI + default "stm32h735g-dk" if ARCH_BOARD_STM32H735G_DK default "stm32h745i-disco" if ARCH_BOARD_STM32H745I_DISCO default "stm32h750b-dk" if ARCH_BOARD_STM32H750B_DK default "linum-stm32h753bi" if ARCH_BOARD_LINUM_STM32H753BI @@ -4970,6 +4980,9 @@ endif if ARCH_BOARD_NUCLEO_H745ZI source "boards/arm/stm32h7/nucleo-h745zi/Kconfig" endif +if ARCH_BOARD_STM32H735G_DK +source "boards/arm/stm32h7/stm32h735g-dk/Kconfig" +endif if ARCH_BOARD_STM32H745I_DISCO source "boards/arm/stm32h7/stm32h745i-disco/Kconfig" endif diff --git a/boards/arm/stm32h7/stm32h735g-dk/CMakeLists.txt b/boards/arm/stm32h7/stm32h735g-dk/CMakeLists.txt new file mode 100644 index 00000000000..b3a9f52dedc --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# boards/arm/stm32h7/stm32h735g-dk/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you 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. +# +# ############################################################################## + +add_subdirectory(src) diff --git a/boards/arm/stm32h7/stm32h735g-dk/Kconfig b/boards/arm/stm32h7/stm32h735g-dk/Kconfig new file mode 100644 index 00000000000..3f42cf6e180 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_STM32H735G_DK + +endif # ARCH_BOARD_STM32H735G_DK diff --git a/boards/arm/stm32h7/stm32h735g-dk/configs/jumbo/defconfig b/boards/arm/stm32h7/stm32h735g-dk/configs/jumbo/defconfig new file mode 100644 index 00000000000..af85e8cadde --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/configs/jumbo/defconfig @@ -0,0 +1,61 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32h735g-dk" +CONFIG_ARCH_BOARD_STM32H735G_DK=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_CHIP="stm32h7" +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32H735IG=y +CONFIG_ARCH_CHIP_STM32H7=y +CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_IRQBUTTONS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BOARD_LOOPSPERMSEC=66627 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FS_PROCFS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 +CONFIG_INPUT=y +CONFIG_INPUT_BUTTONS=y +CONFIG_INPUT_BUTTONS_LOWER=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_MM_REGIONS=3 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_RAM_SIZE=327680 +CONFIG_RAM_START=0x24000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_STM32_DTCMEXCLUDE=y +CONFIG_STM32_PWR_DIRECT_SMPS_SUPPLY=y +CONFIG_STM32_USART3=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_OSTEST=y +CONFIG_USART3_SERIAL_CONSOLE=y +CONFIG_USERLED=y +CONFIG_USERLED_LOWER=y diff --git a/boards/arm/stm32h7/stm32h735g-dk/configs/lvgl/defconfig b/boards/arm/stm32h7/stm32h735g-dk/configs/lvgl/defconfig new file mode 100644 index 00000000000..f3d2e634906 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/configs/lvgl/defconfig @@ -0,0 +1,75 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_STM32_FB_CMAP is not set +# CONFIG_STM32_LTDC_BACKLIGHT is not set +# CONFIG_STM32_LTDC_L1_CHROMAKEYEN is not set +# CONFIG_STM32_LTDC_L2 is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32h735g-dk" +CONFIG_ARCH_BOARD_STM32H735G_DK=y +CONFIG_ARCH_CHIP="stm32h7" +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32H735IG=y +CONFIG_ARCH_CHIP_STM32H7=y +CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BOARD_LOOPSPERMSEC=66627 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEV_URANDOM=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_LVGLDEMO=y +CONFIG_EXAMPLES_TOUCHSCREEN=y +CONFIG_FS_PROCFS=y +CONFIG_GRAPHICS_LVGL=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 +CONFIG_INPUT=y +CONFIG_INPUT_GT9XX=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_LV_FONT_MONTSERRAT_20=y +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y +CONFIG_LV_USE_DEMO_WIDGETS=y +CONFIG_LV_USE_LOG=y +CONFIG_LV_USE_NUTTX=y +CONFIG_LV_USE_NUTTX_TOUCHSCREEN=y +CONFIG_MM_HEAP_MEMPOOL_THRESHOLD=0 +CONFIG_MM_REGIONS=4 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=327680 +CONFIG_RAM_START=0x24000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_STM32_I2C4=y +CONFIG_STM32_LTDC=y +CONFIG_STM32_LTDC_FB_BASE=0x70000000 +CONFIG_STM32_LTDC_FB_SIZE=261120 +CONFIG_STM32_PWR_DIRECT_SMPS_SUPPLY=y +CONFIG_STM32_USART3=y +CONFIG_SYSTEM_NSH=y +CONFIG_USART3_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y diff --git a/boards/arm/stm32h7/stm32h735g-dk/configs/nsh/defconfig b/boards/arm/stm32h7/stm32h735g-dk/configs/nsh/defconfig new file mode 100644 index 00000000000..17a79ea3e0d --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/configs/nsh/defconfig @@ -0,0 +1,45 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32h735g-dk" +CONFIG_ARCH_BOARD_STM32H735G_DK=y +CONFIG_ARCH_CHIP="stm32h7" +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32H735IG=y +CONFIG_ARCH_CHIP_STM32H7=y +CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BOARD_LOOPSPERMSEC=66627 +CONFIG_BUILTIN=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FS_PROCFS=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_MM_REGIONS=3 +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=327680 +CONFIG_RAM_START=0x24000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_STM32_DTCMEXCLUDE=y +CONFIG_STM32_PWR_DIRECT_SMPS_SUPPLY=y +CONFIG_STM32_USART3=y +CONFIG_SYSTEM_NSH=y +CONFIG_USART3_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32h7/stm32h735g-dk/include/board.h b/boards/arm/stm32h7/stm32h735g-dk/include/board.h new file mode 100644 index 00000000000..432064d8567 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/include/board.h @@ -0,0 +1,259 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/include/board.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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 __BOARDS_ARM_STM32H7_STM32H735G_DK_INCLUDE_BOARD_H +#define __BOARDS_ARM_STM32H7_STM32H735G_DK_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#ifndef __ASSEMBLY__ +# include +#endif + +/* Do not include STM32 H7 header files here */ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* The board has a 25 MHz HSE oscillator and a 32.768 kHz LSE crystal. + * PLL1 supplies a 400 MHz CPU clock, 200 MHz AHB and 100 MHz APB clocks. + */ + +/* rcc_reset() leaves the 64 MHz HSI oscillator divided by four. */ + +#define STM32_HSI_FREQUENCY 16000000ul +#define STM32_LSI_FREQUENCY 32000 +#define STM32_HSE_FREQUENCY 25000000ul +#define STM32_LSE_FREQUENCY 32768 + +#define STM32_BOARD_USEHSE +#define STM32_HSEBYP_ENABLE + +#define STM32_PLLCFG_PLLSRC RCC_PLLCKSELR_PLLSRC_HSE + +/* PLL1, wide 4 - 8 MHz input, enable DIVP, DIVQ, DIVR + * + * PLL1_VCO = (25,000,000 / 5) * 160 = 800 MHz + * + * PLL1P = PLL1_VCO/2 = 800 MHz / 2 = 400 MHz + * PLL1Q = PLL1_VCO/4 = 800 MHz / 4 = 200 MHz + * PLL1R = PLL1_VCO/8 = 800 MHz / 8 = 100 MHz + */ + +#define STM32_PLLCFG_PLL1CFG (RCC_PLLCFGR_PLL1VCOSEL_WIDE | \ + RCC_PLLCFGR_PLL1RGE_4_8_MHZ | \ + RCC_PLLCFGR_DIVP1EN | \ + RCC_PLLCFGR_DIVQ1EN | \ + RCC_PLLCFGR_DIVR1EN) +#define STM32_PLLCFG_PLL1M RCC_PLLCKSELR_DIVM1(5) +#define STM32_PLLCFG_PLL1N RCC_PLL1DIVR_N1(160) +#define STM32_PLLCFG_PLL1P RCC_PLL1DIVR_P1(2) +#define STM32_PLLCFG_PLL1Q RCC_PLL1DIVR_Q1(4) +#define STM32_PLLCFG_PLL1R RCC_PLL1DIVR_R1(8) + +#define STM32_VCO1_FREQUENCY ((STM32_HSE_FREQUENCY / 5) * 160) +#define STM32_PLL1P_FREQUENCY (STM32_VCO1_FREQUENCY / 2) +#define STM32_PLL1Q_FREQUENCY (STM32_VCO1_FREQUENCY / 4) + +/* PLL2 is unused. */ + +#define STM32_PLLCFG_PLL2CFG 0 +#define STM32_PLLCFG_PLL2M 0 +#define STM32_PLLCFG_PLL2N 0 +#define STM32_PLLCFG_PLL2P 0 +#define STM32_PLLCFG_PLL2Q 0 +#define STM32_PLLCFG_PLL2R 0 +#ifdef CONFIG_STM32_LTDC +/* PLL3R supplies the LCD pixel clock: 800 MHz / 83 = 9.64 MHz. */ + +# define STM32_PLLCFG_PLL3CFG (RCC_PLLCFGR_PLL3VCOSEL_WIDE | \ + RCC_PLLCFGR_PLL3RGE_4_8_MHZ | \ + RCC_PLLCFGR_DIVR3EN) +# define STM32_PLLCFG_PLL3M RCC_PLLCKSELR_DIVM3(5) +# define STM32_PLLCFG_PLL3N RCC_PLL3DIVR_N3(160) +# define STM32_PLLCFG_PLL3P RCC_PLL3DIVR_P3(2) +# define STM32_PLLCFG_PLL3Q RCC_PLL3DIVR_Q3(2) +# define STM32_PLLCFG_PLL3R RCC_PLL3DIVR_R3(83) +#else +# define STM32_PLLCFG_PLL3CFG 0 +# define STM32_PLLCFG_PLL3M 0 +# define STM32_PLLCFG_PLL3N 0 +# define STM32_PLLCFG_PLL3P 0 +# define STM32_PLLCFG_PLL3Q 0 +# define STM32_PLLCFG_PLL3R 0 +#endif + +/* SYSCLK = PLL1P = 400 MHz + * CPUCLK = SYSCLK / 1 = 400 MHz + */ + +#define STM32_RCC_D1CFGR_D1CPRE (RCC_D1CFGR_D1CPRE_SYSCLK) +#define STM32_SYSCLK_FREQUENCY (STM32_PLL1P_FREQUENCY) +#define STM32_CPUCLK_FREQUENCY (STM32_SYSCLK_FREQUENCY / 1) + +/* Configure Clock Assignments */ + +/* AHB clock (HCLK) is SYSCLK/2 (200 MHz max) + * HCLK1 = HCLK2 = HCLK3 = HCLK4 + */ + +#define STM32_RCC_D1CFGR_HPRE RCC_D1CFGR_HPRE_SYSCLKd2 /* HCLK = SYSCLK / 2 */ +#define STM32_HCLK_FREQUENCY (STM32_SYSCLK_FREQUENCY / 2) /* HCLK in D2, HCLK4 in D3 */ + +/* APB1 clock (PCLK1) is HCLK/2 (100 MHz) */ + +#define STM32_RCC_D2CFGR_D2PPRE1 RCC_D2CFGR_D2PPRE1_HCLKd2 /* PCLK1 = HCLK / 2 */ +#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2) + +/* APB2 clock (PCLK2) is HCLK/2 (100 MHz) */ + +#define STM32_RCC_D2CFGR_D2PPRE2 RCC_D2CFGR_D2PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */ +#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2) + +/* APB3 clock (PCLK3) is HCLK/2 (100 MHz) */ + +#define STM32_RCC_D1CFGR_D1PPRE RCC_D1CFGR_D1PPRE_HCLKd2 /* PCLK3 = HCLK / 2 */ + +/* APB4 clock (PCLK4) is HCLK/2 (100 MHz) */ + +#define STM32_RCC_D3CFGR_D3PPRE RCC_D3CFGR_D3PPRE_HCLKd2 /* PCLK4 = HCLK / 2 */ +#define STM32_PCLK4_FREQUENCY (STM32_HCLK_FREQUENCY/2) + +/* Timer clock frequencies */ + +/* Timers driven from APB1 will be twice PCLK1 */ + +#define STM32_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY) +#define STM32_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY) + +/* Timers driven from APB2 will be twice PCLK2 */ + +#define STM32_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY) +#define STM32_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY) +#define STM32_TIM15_CLKIN (2*STM32_PCLK2_FREQUENCY) +#define STM32_TIM16_CLKIN (2*STM32_PCLK2_FREQUENCY) +#define STM32_TIM17_CLKIN (2*STM32_PCLK2_FREQUENCY) + +/* Four flash wait states at 200 MHz ACLK. */ + +#define BOARD_FLASH_WAITSTATES 4 + +/* ST-LINK virtual COM port: USART3 TX on PD8, RX on PD9. */ + +#define GPIO_USART3_RX (GPIO_USART3_RX_3 | GPIO_SPEED_100MHz) +#define GPIO_USART3_TX (GPIO_USART3_TX_3 | GPIO_SPEED_100MHz) + +/* I2C4: touchscreen on PF14/PF15. */ + +#define STM32_RCC_D3CCIPR_I2C4SRC RCC_D3CCIPR_I2C4SEL_HSI +#define GPIO_I2C4_SCL (GPIO_I2C4_SCL_2 | GPIO_SPEED_50MHz) +#define GPIO_I2C4_SDA (GPIO_I2C4_SDA_2 | GPIO_SPEED_50MHz) + +/* RK043FN48H 480x272 RGB panel. */ + +#define GPIO_LTDC_B0 (GPIO_LTDC_B0_2 | GPIO_SPEED_100MHz) /* PG14 */ +#define GPIO_LTDC_B1 (GPIO_LTDC_B1_4 | GPIO_SPEED_100MHz) /* PD0 */ +#define GPIO_LTDC_B2 (GPIO_LTDC_B2_2 | GPIO_SPEED_100MHz) /* PD6 */ +#define GPIO_LTDC_B3 (GPIO_LTDC_B3_1 | GPIO_SPEED_100MHz) /* PA8 */ +#define GPIO_LTDC_B4 (GPIO_LTDC_B4_2 | GPIO_SPEED_100MHz) /* PE12 */ +#define GPIO_LTDC_B5 (GPIO_LTDC_B5_1 | GPIO_SPEED_100MHz) /* PA3 */ +#define GPIO_LTDC_B6 (GPIO_LTDC_B6_1 | GPIO_SPEED_100MHz) /* PB8 */ +#define GPIO_LTDC_B7 (GPIO_LTDC_B7_1 | GPIO_SPEED_100MHz) /* PB9 */ +#define GPIO_LTDC_CLK (GPIO_LTDC_CLK_2 | GPIO_SPEED_100MHz) /* PG7 */ +#define GPIO_LTDC_G0 (GPIO_LTDC_G0_1 | GPIO_SPEED_100MHz) /* PB1 */ +#define GPIO_LTDC_G1 (GPIO_LTDC_G1_1 | GPIO_SPEED_100MHz) /* PB0 */ +#define GPIO_LTDC_G2 (GPIO_LTDC_G2_1 | GPIO_SPEED_100MHz) /* PA6 */ +#define GPIO_LTDC_G3 (GPIO_LTDC_G3_2 | GPIO_SPEED_100MHz) /* PE11 */ +#define GPIO_LTDC_G4 (GPIO_LTDC_G4_2 | GPIO_SPEED_100MHz) /* PH15 */ +#define GPIO_LTDC_G5 (GPIO_LTDC_G5_4 | GPIO_SPEED_100MHz) /* PH4 */ +#define GPIO_LTDC_G6 (GPIO_LTDC_G6_1 | GPIO_SPEED_100MHz) /* PC7 */ +#define GPIO_LTDC_G7 (GPIO_LTDC_G7_1 | GPIO_SPEED_100MHz) /* PD3 */ +#define GPIO_LTDC_HSYNC (GPIO_LTDC_HSYNC_1 | GPIO_SPEED_100MHz) /* PC6 */ +#define GPIO_LTDC_R0 (GPIO_LTDC_R0_4 | GPIO_SPEED_100MHz) /* PE0 */ +#define GPIO_LTDC_R1 (GPIO_LTDC_R1_2 | GPIO_SPEED_100MHz) /* PH3 */ +#define GPIO_LTDC_R2 (GPIO_LTDC_R2_3 | GPIO_SPEED_100MHz) /* PH8 */ +#define GPIO_LTDC_R3 (GPIO_LTDC_R3_1 | GPIO_SPEED_100MHz) /* PH9 */ +#define GPIO_LTDC_R4 (GPIO_LTDC_R4_3 | GPIO_SPEED_100MHz) /* PH10 */ +#define GPIO_LTDC_R5 (GPIO_LTDC_R5_4 | GPIO_SPEED_100MHz) /* PH11 */ +#define GPIO_LTDC_R6 (GPIO_LTDC_R6_5 | GPIO_SPEED_100MHz) /* PE1 */ +#define GPIO_LTDC_R7 (GPIO_LTDC_R7_1 | GPIO_SPEED_100MHz) /* PE15 */ +#define GPIO_LTDC_VSYNC (GPIO_LTDC_VSYNC_1 | GPIO_SPEED_100MHz) /* PA4 */ + +/* The panel uses HSYNC/VSYNC mode. Hold DE low as in the ST BSP. */ + +#define GPIO_LTDC_DE (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \ + GPIO_OUTPUT_CLEAR | GPIO_PORTE | GPIO_PIN13) + +#define BOARD_LTDC_WIDTH 480 +#define BOARD_LTDC_HEIGHT 272 +#define BOARD_LTDC_OUTPUT_BPP 24 +#define BOARD_LTDC_HFP 32 +#define BOARD_LTDC_HBP 13 +#define BOARD_LTDC_VFP 2 +#define BOARD_LTDC_VBP 2 +#define BOARD_LTDC_HSYNC 41 +#define BOARD_LTDC_VSYNC 10 +#define BOARD_LTDC_GCR_PCPOL 0 +#define BOARD_LTDC_GCR_DEPOL 0 +#define BOARD_LTDC_GCR_VSPOL 0 +#define BOARD_LTDC_GCR_HSPOL 0 + +/* User LEDs: LD1 green (PC3), LD2 red (PC2), both active low. */ + +#define BOARD_LED_GREEN 0 +#define BOARD_LED_RED 1 +#define BOARD_NLEDS 2 +#define BOARD_LED_GREEN_BIT (1 << BOARD_LED_GREEN) +#define BOARD_LED_RED_BIT (1 << BOARD_LED_RED) + +/* Green indicates successful startup; red blinks on a fatal error. */ + +#define LED_STARTED 0 +#define LED_HEAPALLOCATE 0 +#define LED_IRQSENABLED 0 +#define LED_STACKCREATED 1 +#define LED_INIRQ 2 +#define LED_SIGNAL 2 +#define LED_ASSERTION 2 +#define LED_PANIC 3 +#define LED_IDLE 2 + +/* User button B2 on PC13. */ + +#define BUTTON_USER 0 +#define BUTTON_USER_BIT (1 << BUTTON_USER) + +#endif /* __BOARDS_ARM_STM32H7_STM32H735G_DK_INCLUDE_BOARD_H */ diff --git a/boards/arm/stm32h7/stm32h735g-dk/scripts/Make.defs b/boards/arm/stm32h7/stm32h735g-dk/scripts/Make.defs new file mode 100644 index 00000000000..d2d4a6c4b9e --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/scripts/Make.defs @@ -0,0 +1,37 @@ +############################################################################ +# boards/arm/stm32h7/stm32h735g-dk/scripts/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you 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 $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs + +LDSCRIPT = flash.ld +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 diff --git a/boards/arm/stm32h7/stm32h735g-dk/scripts/flash.ld b/boards/arm/stm32h7/stm32h735g-dk/scripts/flash.ld new file mode 100644 index 00000000000..c7c976f9fa6 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/scripts/flash.ld @@ -0,0 +1,133 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/scripts/flash.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/* Boot from the 1 MiB internal flash at 0x08000000. Use the default + * option-byte memory split: 64 KiB ITCM and 320 KiB AXI SRAM. SRAM1/2 + * provide a contiguous 32 KiB region; SRAM4 provides another 16 KiB. + * The LCD framebuffer uses memory-mapped HyperRAM separately from the heap. + */ + +MEMORY +{ + itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 64K + flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + dtcm1 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K + dtcm2 (rwx) : ORIGIN = 0x20010000, LENGTH = 64K + sram (rwx) : ORIGIN = 0x24000000, LENGTH = 320K + sram1 (rwx) : ORIGIN = 0x30000000, LENGTH = 16K + sram2 (rwx) : ORIGIN = 0x30004000, LENGTH = 16K + sram4 (rwx) : ORIGIN = 0x38000000, LENGTH = 16K + bbram (rwx) : ORIGIN = 0x38800000, LENGTH = 4K +} + +OUTPUT_ARCH(arm) +EXTERN(_vectors) +ENTRY(_stext) +SECTIONS +{ + .text : + { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) + _einit = ABSOLUTE(.); + } > flash + + .ARM.extab : + { + *(.ARM.extab*) + } > flash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : + { + *(.ARM.exidx*) + } > flash + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > sram AT > flash + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(8); + _ebss = ABSOLUTE(.); + } > sram + + /* Emit the D3 power domain section for locating BDMA data + * + * Static data with locate_data(".sram4") will be located + * at start of SRAM4; the rest of SRAM4 will be added to the heap. + */ + + .sram4_reserve (NOLOAD) : + { + *(.sram4) + . = ALIGN(4); + _sram4_heap_start = ABSOLUTE(.); + } > sram4 + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/CMakeLists.txt b/boards/arm/stm32h7/stm32h735g-dk/src/CMakeLists.txt new file mode 100644 index 00000000000..991a3c05594 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/CMakeLists.txt @@ -0,0 +1,44 @@ +# ############################################################################## +# boards/arm/stm32h7/stm32h735g-dk/src/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you 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. +# +# ############################################################################## + +set(SRCS stm32_boot.c stm32_bringup.c) + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS stm32_autoleds.c) +else() + list(APPEND SRCS stm32_userleds.c) +endif() + +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS stm32_buttons.c) +endif() + +if(CONFIG_STM32_LTDC) + list(APPEND SRCS stm32_lcd.c stm32_hyperram.c) +endif() + +if(CONFIG_INPUT_GT9XX) + list(APPEND SRCS stm32_touchscreen.c) +endif() + +target_sources(board PRIVATE ${SRCS}) +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/Make.defs b/boards/arm/stm32h7/stm32h735g-dk/src/Make.defs new file mode 100644 index 00000000000..aff7f78e042 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/Make.defs @@ -0,0 +1,47 @@ +############################################################################ +# boards/arm/stm32h7/stm32h735g-dk/src/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you 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 $(TOPDIR)/Make.defs + +CSRCS = stm32_boot.c stm32_bringup.c + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += stm32_autoleds.c +else +CSRCS += stm32_userleds.c +endif + +ifeq ($(CONFIG_ARCH_BUTTONS),y) +CSRCS += stm32_buttons.c +endif + +ifeq ($(CONFIG_STM32_LTDC),y) +CSRCS += stm32_lcd.c stm32_hyperram.c +endif + +ifeq ($(CONFIG_INPUT_GT9XX),y) +CSRCS += stm32_touchscreen.c +endif + +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_autoleds.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_autoleds.c new file mode 100644 index 00000000000..f139bcf1213 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_autoleds.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_autoleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include "stm32h735g-dk.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + stm32_configgpio(GPIO_LED_GREEN); + stm32_configgpio(GPIO_LED_RED); +} + +void board_autoled_on(int led) +{ + if (led == LED_STACKCREATED) + { + stm32_gpiowrite(GPIO_LED_GREEN, false); + } + else if (led == LED_PANIC) + { + stm32_gpiowrite(GPIO_LED_RED, false); + } +} + +void board_autoled_off(int led) +{ + if (led == LED_PANIC) + { + stm32_gpiowrite(GPIO_LED_RED, true); + } +} diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_boot.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_boot.c new file mode 100644 index 00000000000..be141405459 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_boot.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_boot.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include + +#include "arm_internal.h" +#include "stm32_start.h" +#include "stm32h735g-dk.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_boardinitialize + * + * Description: + * All STM32 architectures must provide the following entry point. This + * entry point is called early in the initialization -- after all memory + * has been configured and mapped but before any devices have been + * initialized. + * + ****************************************************************************/ + +void stm32_boardinitialize(void) +{ +#ifdef CONFIG_ARCH_LEDS + board_autoled_initialize(); +#endif +} + +/**************************************************************************** + * Name: board_late_initialize + * + * Description: + * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional + * initialization call will be performed in the boot-up sequence to a + * function called board_late_initialize(). board_late_initialize() will + * be called immediately after up_initialize() is called and just before + * the initial application is started. This additional initialization + * phase may be used, for example, to initialize board-specific device + * drivers. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + stm32_bringup(); +} +#endif diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_bringup.c new file mode 100644 index 00000000000..92113053132 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_bringup.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_bringup.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "stm32h735g-dk.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int stm32_bringup(void) +{ + int ret = OK; + +#ifdef CONFIG_FS_PROCFS + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_USERLED_LOWER + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register LEDs: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_INPUT_BUTTONS_LOWER + ret = btn_lower_initialize("/dev/buttons"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register buttons: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_INPUT_GT9XX + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register touchscreen: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_VIDEO_FB + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register framebuffer: %d\n", ret); + } +#endif + + return ret; +} diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_buttons.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_buttons.c new file mode 100644 index 00000000000..12e587863ff --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_buttons.c @@ -0,0 +1,107 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_buttons.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "stm32_gpio.h" +#include "stm32h735g-dk.h" +#include + +#ifdef CONFIG_ARCH_BUTTONS + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_initialize + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + ****************************************************************************/ + +uint32_t board_button_initialize(void) +{ + stm32_configgpio(GPIO_BTN_USER); + return 1; +} + +/**************************************************************************** + * Name: board_buttons + ****************************************************************************/ + +uint32_t board_buttons(void) +{ + return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0; +} + +/**************************************************************************** + * Button support. + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns a + * 32-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT definitions in board.h for the meaning of each bit. + * + * board_button_irq() may be called to register an interrupt handler that + * will be called when a button is depressed or released. The ID value is + * a button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* definitions in board.h for the meaning of enumeration + * value. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_IRQBUTTONS +int board_button_irq(int id, xcpt_t irqhandler, void *arg) +{ + int ret = -EINVAL; + + if (id == BUTTON_USER) + { + ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, + irqhandler, arg); + } + + return ret; +} +#endif +#endif /* CONFIG_ARCH_BUTTONS */ diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_hyperram.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_hyperram.c new file mode 100644 index 00000000000..4c3ac7e7537 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_hyperram.c @@ -0,0 +1,140 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_hyperram.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include "arm_internal.h" +#include "stm32_gpio.h" +#include "hardware/stm32_octospi.h" +#include "hardware/stm32_rcc.h" +#include "stm32h735g-dk.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define HYPERRAM_GPIO (GPIO_ALT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const uint32_t g_hyperram_pins[] = +{ + HYPERRAM_GPIO | GPIO_AF3 | GPIO_PULLUP | GPIO_PORTG | GPIO_PIN12, /* NCS */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN4, /* CLK */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN12, /* RWDS */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN0, /* D0 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN1, /* D1 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN2, /* D2 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTF | GPIO_PIN3, /* D3 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTG | GPIO_PIN0, /* D4 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTG | GPIO_PIN1, /* D5 */ + HYPERRAM_GPIO | GPIO_AF3 | GPIO_PORTG | GPIO_PIN10, /* D6 */ + HYPERRAM_GPIO | GPIO_AF9 | GPIO_PORTG | GPIO_PIN11 /* D7 */ +}; + +static bool g_hyperram_initialized; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_hyperram_initialize + * + * Description: + * Map the S70KL1281 HyperRAM at 0x70000000 for the LCD framebuffer. Keep + * its reset configuration (six-clock fixed latency); use linear bursts. + * The HyperRAM RESET# signal is connected to the board reset. + * + ****************************************************************************/ + +int stm32_hyperram_initialize(void) +{ + uint32_t ccr; + unsigned int i; + + if (g_hyperram_initialized) + { + return OK; + } + + for (i = 0; i < nitems(g_hyperram_pins); i++) + { + stm32_configgpio(g_hyperram_pins[i]); + } + + /* OCTOSPI kernel clock is HCLK (200 MHz), divided by four for 50 MHz. + * The clock mux is shared with OCTOSPI1; neither NOR nor QSPI is used. + */ + + modifyreg32(STM32_RCC_D1CCIPR, RCC_D1CCIPR_QSPISEL_MASK, + RCC_D1CCIPR_QSPISEL_HCLK); + modifyreg32(STM32_RCC_AHB3ENR, 0, + RCC_AHB3ENR_OSPI2EN | RCC_AHB3ENR_IOMNGREN); + modifyreg32(STM32_RCC_AHB3RSTR, 0, RCC_AHB3RSTR_OSPI2RST); + modifyreg32(STM32_RCC_AHB3RSTR, RCC_AHB3RSTR_OSPI2RST, 0); + + putreg32(OCTOSPIM_PCR_CLKEN | OCTOSPIM_PCR_CLKSRC_OSPI2 | + OCTOSPIM_PCR_DQSEN | OCTOSPIM_PCR_DQSSRC_OSPI2 | + OCTOSPIM_PCR_NCSEN | OCTOSPIM_PCR_NCSSRC_OSPI2 | + OCTOSPIM_PCR_IOLEN | OCTOSPIM_PCR_IOLSRC_OSPI2 | + OCTOSPIM_PCR_IOHEN | OCTOSPIM_PCR_IOHSRC_OSPI2, + STM32_OCTOSPIM_P2CR); + + /* 16 MiB device, four-cycle CS high time, no delay-block calibration. + * Split transactions at each 8 MiB die boundary and every four us to + * allow the HyperRAM to refresh. + */ + + putreg32(OCTOSPI_DCR1_MTYP_HYPERBUS | OCTOSPI_DCR1_DEVSIZE(24) | + OCTOSPI_DCR1_CSHT(4), + STM32_OCTOSPI2_DCR1); + putreg32(OCTOSPI_DCR2_PRESCALER(4), STM32_OCTOSPI2_DCR2); + putreg32(OCTOSPI_DCR3_CSBOUND(23), STM32_OCTOSPI2_DCR3); + putreg32(200, STM32_OCTOSPI2_DCR4); + putreg32(OCTOSPI_TCR_DHQC, STM32_OCTOSPI2_TCR); + putreg32(OCTOSPI_HLCR_LM | OCTOSPI_HLCR_TACC(6) | + OCTOSPI_HLCR_TRWR(4), STM32_OCTOSPI2_HLCR); + + ccr = OCTOSPI_CCR_DQSE | OCTOSPI_CCR_DDTR | + OCTOSPI_CCR_DMODE_8LINES | OCTOSPI_CCR_ADSIZE_32BITS | + OCTOSPI_CCR_ADDTR | OCTOSPI_CCR_ADMODE_8LINES; + putreg32(ccr, STM32_OCTOSPI2_CCR); + putreg32(ccr, STM32_OCTOSPI2_WCCR); + putreg32(OCTOSPI_CR_EN | OCTOSPI_CR_FTHRES(4) | + OCTOSPI_CR_FMODE_MEMORYMAP, STM32_OCTOSPI2_CR); + + g_hyperram_initialized = true; + return OK; +} diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_lcd.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_lcd.c new file mode 100644 index 00000000000..29680d5e216 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_lcd.c @@ -0,0 +1,140 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_lcd.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include + +#include "stm32_gpio.h" +#include "stm32_ltdc.h" + +#include "stm32h735g-dk.h" + +#ifdef CONFIG_STM32_LTDC + +#if CONFIG_STM32_LTDC_FB_BASE < 0x70000000 || \ + CONFIG_STM32_LTDC_FB_BASE + CONFIG_STM32_LTDC_FB_SIZE > 0x71000000 +# error "The LCD framebuffer must reside in HyperRAM" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_fbinitialize + * + * Description: + * Initialize the framebuffer video hardware associated with the display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ + +int up_fbinitialize(int display) +{ + int ret; + + ret = stm32_hyperram_initialize(); + if (ret < 0) + { + return ret; + } + + /* Custom LCD display with RGB interface */ + + stm32_configgpio(GPIO_LCD_DISP); + stm32_configgpio(GPIO_LCD_BL); + + ret = stm32_ltdcinitialize(); + if (ret == OK) + { + stm32_gpiowrite(GPIO_LCD_DISP, true); + stm32_gpiowrite(GPIO_LCD_BL, true); + } + + return ret; +} + +/**************************************************************************** + * Name: up_fbgetvplane + * + * Description: + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. + * Many OSDs support multiple planes of video. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. + * + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. + * + ****************************************************************************/ + +struct fb_vtable_s *up_fbgetvplane(int display, int vplane) +{ + return stm32_ltdcgetvplane(vplane); +} + +/**************************************************************************** + * Name: up_fbuninitialize + * + * Description: + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_fbuninitialize(int display) +{ + stm32_gpiowrite(GPIO_LCD_DISP, false); + stm32_gpiowrite(GPIO_LCD_BL, false); + + stm32_ltdcuninitialize(); +} +#endif /* CONFIG_STM32_LTDC */ diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_touchscreen.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_touchscreen.c new file mode 100644 index 00000000000..d62dab81707 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_touchscreen.c @@ -0,0 +1,160 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_touchscreen.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "stm32_gpio.h" +#include "stm32_i2c.h" +#include "stm32h735g-dk.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_STM32_I2C4 +# error "The touchscreen requires CONFIG_STM32_I2C4" +#endif + +#define TOUCH_I2C_PORT 4 +#define TOUCH_I2C_FREQUENCY 100000 +#define GT911_I2C_ADDRESS 0x5d + +/* The GT911 needs ~200 ms after power-on to report its ID */ + +#define GT911_PROBE_RETRIES 50 +#define GT911_PROBE_DELAY 10000 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static xcpt_t g_touch_handler; +static void *g_touch_arg; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int stm32_gt911_attach(const struct gt9xx_board_s *state, + xcpt_t handler, void *arg) +{ + g_touch_handler = handler; + g_touch_arg = arg; + return OK; +} + +static void stm32_gt911_enable(const struct gt9xx_board_s *state, + bool enable) +{ + stm32_gpiosetevent(GPIO_TOUCH_INT, false, true, true, + enable ? g_touch_handler : NULL, + enable ? g_touch_arg : NULL); +} + +static int stm32_gt911_power(const struct gt9xx_board_s *state, bool on) +{ + /* The touch panel supply and reset are not controlled by GPIOs. */ + + return OK; +} + +static const struct gt9xx_board_s g_gt911_config = +{ + .irq_attach = stm32_gt911_attach, + .irq_enable = stm32_gt911_enable, + .set_power = stm32_gt911_power +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_tsc_setup + * + * Description: + * Register the GT911 touchscreen on I2C4. + * + ****************************************************************************/ + +int stm32_tsc_setup(int minor) +{ + struct i2c_master_s *i2c; + struct i2c_config_s config = + { + .frequency = TOUCH_I2C_FREQUENCY, + .address = GT911_I2C_ADDRESS, + .addrlen = 7 + }; + + uint8_t reg[2]; + uint8_t id[4]; + char devpath[16]; + int ret; + int i; + + stm32_configgpio(GPIO_TOUCH_INT); + i2c = stm32_i2cbus_initialize(TOUCH_I2C_PORT); + if (i2c == NULL) + { + return -ENODEV; + } + + for (i = 0; i < GT911_PROBE_RETRIES; i++) + { + reg[0] = 0x81; + reg[1] = 0x40; + ret = i2c_writeread(i2c, &config, reg, 2, id, sizeof(id)); + if (ret >= 0 && id[0] == '9' && id[1] == '1' && id[2] == '1') + { + break; + } + + nxsig_usleep(GT911_PROBE_DELAY); + } + + if (i == GT911_PROBE_RETRIES) + { + stm32_i2cbus_uninitialize(i2c); + return -ENODEV; + } + + snprintf(devpath, sizeof(devpath), "/dev/input%d", minor); + ret = gt9xx_register(devpath, i2c, GT911_I2C_ADDRESS, &g_gt911_config); + if (ret < 0) + { + stm32_i2cbus_uninitialize(i2c); + } + + return ret; +} diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32_userleds.c b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_userleds.c new file mode 100644 index 00000000000..0386666a06d --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32_userleds.c @@ -0,0 +1,130 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32_userleds.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "stm32_gpio.h" + +#include "stm32h735g-dk.h" + +#ifndef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0])) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This array maps an LED number to GPIO pin configuration and is indexed by + * BOARD_LED_ + */ + +static const uint32_t g_ledcfg[BOARD_NLEDS] = +{ + GPIO_LED_GREEN, + GPIO_LED_RED, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + * + * Description: + * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board + * LEDs. If CONFIG_ARCH_LEDS is not defined, then the + * board_userled_initialize() is available to initialize the LED from user + * application logic. + * + ****************************************************************************/ + +uint32_t board_userled_initialize(void) +{ + int i; + + /* Configure LD1 and LD2 GPIOs for output */ + + for (i = 0; i < ARRAYSIZE(g_ledcfg); i++) + { + stm32_configgpio(g_ledcfg[i]); + } + + return BOARD_NLEDS; +} + +/**************************************************************************** + * Name: board_userled + * + * Description: + * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board + * LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled() is + * available to control the LED from user application logic. + * + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + if ((unsigned)led < ARRAYSIZE(g_ledcfg)) + { + stm32_gpiowrite(g_ledcfg[led], !ledon); + } +} + +/**************************************************************************** + * Name: board_userled_all + * + * Description: + * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board + * LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() + * is available to control the LED from user application logic. + * + ****************************************************************************/ + +void board_userled_all(uint32_t ledset) +{ + int i; + + /* Configure LD1 and LD2 GPIOs for output */ + + for (i = 0; i < ARRAYSIZE(g_ledcfg); i++) + { + stm32_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) == 0); + } +} + +#endif /* !CONFIG_ARCH_LEDS */ diff --git a/boards/arm/stm32h7/stm32h735g-dk/src/stm32h735g-dk.h b/boards/arm/stm32h7/stm32h735g-dk/src/stm32h735g-dk.h new file mode 100644 index 00000000000..3bf521893f7 --- /dev/null +++ b/boards/arm/stm32h7/stm32h735g-dk/src/stm32h735g-dk.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * boards/arm/stm32h7/stm32h735g-dk/src/stm32h735g-dk.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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 __BOARDS_ARM_STM32H7_STM32H735G_DK_SRC_STM32H735G_DK_H +#define __BOARDS_ARM_STM32H7_STM32H735G_DK_SRC_STM32H735G_DK_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include "stm32_gpio.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define GPIO_LED_GREEN (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \ + GPIO_OUTPUT_SET | GPIO_PORTC | GPIO_PIN3) +#define GPIO_LED_RED (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \ + GPIO_OUTPUT_SET | GPIO_PORTC | GPIO_PIN2) +#define GPIO_BTN_USER (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \ + GPIO_PORTC | GPIO_PIN13) + +/* Display control pins */ + +#define GPIO_LCD_DISP (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \ + GPIO_OUTPUT_CLEAR | GPIO_PORTD | GPIO_PIN10) +#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \ + GPIO_OUTPUT_CLEAR | GPIO_PORTG | GPIO_PIN15) +#define GPIO_TOUCH_INT (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | \ + GPIO_PORTG | GPIO_PIN2) + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_STM32_LTDC +int stm32_hyperram_initialize(void); +#endif + +int stm32_bringup(void); + +#ifdef CONFIG_INPUT_GT9XX +int stm32_tsc_setup(int minor); +#endif + +#endif /* __BOARDS_ARM_STM32H7_STM32H735G_DK_SRC_STM32H735G_DK_H */