mirror of
https://github.com/apache/nuttx.git
synced 2026-10-08 06:45:19 +00:00
boards/arm: add stm32h7s8-dk support
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Add stm32h7s8-dk board support for nsh running out of internal flash, including LEDs and user button. Signed-off-by: Peter Barada <peter.barada@gmail.com>
This commit is contained in:
parent
e26d467fab
commit
e24a16207f
19 changed files with 1247 additions and 0 deletions
|
|
@ -0,0 +1,63 @@
|
|||
===============
|
||||
ST STM32H7S8-DK
|
||||
===============
|
||||
|
||||
.. tags:: chip:stm32, chip:stm32h7, chip:stm32h7s3
|
||||
|
||||
.. figure:: stm32h7s8-dk-front.jpg
|
||||
:align: center
|
||||
:alt: STM32H7S8-DK Front
|
||||
|
||||
STM32H8S8-DK Front
|
||||
|
||||
.. figure:: stm32h7s8-dk-back.jpg
|
||||
:align: center
|
||||
:alt: STM32H7S8-DK Back
|
||||
|
||||
STM32H8S8-DK Back
|
||||
|
||||
This page describes the NuttX port for the `STMicro SMT32H7S8-DK <https://www.st.com/en/evaluation-tools/stm32h7s78-dk.html>`_
|
||||
Discovery kit. The board is based on the 600 MHz STM32H7S3L8
|
||||
Cortex-M7 microcontroller.
|
||||
|
||||
Flashing NSH image
|
||||
==================
|
||||
|
||||
.. note::
|
||||
nsh image is restricted in size to fit in and execute from
|
||||
internal 64 KB flash.
|
||||
|
||||
Build the internal nsh image::
|
||||
|
||||
cmake -B build/nsh -DBOARD_CONFIG=stm32h7s8-dk:nsh -GNinja
|
||||
cmake --build build/nsh
|
||||
|
||||
Install STM32CubeProgrammer and set ``CUBE_PROGRAMMER`` to the path of its
|
||||
command-line executable.::
|
||||
|
||||
CUBE_PROGRAMMER=/path/to/STM32_Programmer_CLI
|
||||
|
||||
Program and verify the internal image, then reset the board::
|
||||
|
||||
"$CUBE_PROGRAMMER" --connect port=SWD reset=HWrst \
|
||||
--download build/nsh/nuttx.bin 0x08000000 --verify --rst
|
||||
|
||||
The internal nsh image presents a shell on the ST-link console on startup.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Each configuration is maintained in a subdirectory of ``configs`` and can be
|
||||
selected as follows::
|
||||
|
||||
tools/configure.sh stm32h7s8-dk:<subdir>
|
||||
|
||||
Where ``<subdir>`` is one of the following:
|
||||
|
||||
nsh
|
||||
---
|
||||
|
||||
Provides a basic NuttShell configuration in internal flash and
|
||||
includes support for on-board LEDs and user button. The default
|
||||
console is the ST-LINK virtual COM port on USART4.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 899 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 759 KiB |
|
|
@ -210,6 +210,7 @@ config ARCH_CHIP_STM32H7S3L8
|
|||
bool "STM32H7S3L8"
|
||||
select STM32_STM32H7RSXX
|
||||
select STM32H7_IO_CONFIG_L
|
||||
select STM32_HAVE_SMPS
|
||||
---help---
|
||||
STM32 H7 Cortex-M7, 64 KiB FLASH, 620 KiB SRAM, TFBGA225.
|
||||
|
||||
|
|
@ -629,6 +630,8 @@ config STM32_PWR_DIRECT_SMPS_SUPPLY
|
|||
bool "Use direct SMPS supply mode"
|
||||
depends on STM32_HAVE_SMPS
|
||||
default n
|
||||
---help---
|
||||
Select this option for using the swich-mode step down converter.
|
||||
|
||||
config STM32_PWR_EXTERNAL_SOURCE_SUPPLY
|
||||
bool "Use external source as power supply"
|
||||
|
|
|
|||
|
|
@ -2177,6 +2177,16 @@ config ARCH_BOARD_NUCLEO_H7S3L8
|
|||
---help---
|
||||
STMicro Nucleo H7S3L8 board based on the STM32H7S3L8 MCU.
|
||||
|
||||
config ARCH_BOARD_STM32H7S8_DK
|
||||
bool "STM32H7S3-DK Discovery Kit"
|
||||
depends on ARCH_CHIP_STM32H7S3L8
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
select STM32H7_HAVE_PWR_DIRECT_SMPS_SUPPLY
|
||||
---help---
|
||||
STMicro STM32H7S8-DK Discovery Kit based on the STM32H7S3L8 MCU.
|
||||
|
||||
config ARCH_BOARD_OPENH743I
|
||||
bool "Waveshare OpenH743I board"
|
||||
depends on ARCH_CHIP_STM32H743II
|
||||
|
|
@ -4125,6 +4135,7 @@ config ARCH_BOARD
|
|||
default "linum-stm32h753bi" if ARCH_BOARD_LINUM_STM32H753BI
|
||||
default "nucleo-h753zi" if ARCH_BOARD_NUCLEO_H753ZI
|
||||
default "nucleo-h7s3l8" if ARCH_BOARD_NUCLEO_H7S3L8
|
||||
default "stm32h7s8-dk" if ARCH_BOARD_STM32H7S8_DK
|
||||
default "openh743i" if ARCH_BOARD_OPENH743I
|
||||
default "portenta-h7" if ARCH_BOARD_PORTENTA_H7
|
||||
default "nucleo-l073rz" if ARCH_BOARD_NUCLEO_L073RZ
|
||||
|
|
@ -4955,6 +4966,9 @@ endif
|
|||
if ARCH_BOARD_NUCLEO_H7S3L8
|
||||
source "boards/arm/stm32h7/nucleo-h7s3l8/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_STM32H7S8_DK
|
||||
source "boards/arm/stm32h7/stm32h7s8-dk/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_OPENH743I
|
||||
source "boards/arm/stm32h7/openh743i/Kconfig"
|
||||
endif
|
||||
|
|
|
|||
23
boards/arm/stm32h7/stm32h7s8-dk/CMakeLists.txt
Normal file
23
boards/arm/stm32h7/stm32h7s8-dk/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/stm32h7/stm32h7s8-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)
|
||||
15
boards/arm/stm32h7/stm32h7s8-dk/Kconfig
Normal file
15
boards/arm/stm32h7/stm32h7s8-dk/Kconfig
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_STM32H7S8_DK
|
||||
|
||||
config STM32H7S8_DK_USE_HSE
|
||||
bool "Use the HSE clock source"
|
||||
default n
|
||||
help
|
||||
Use the 24 MHz external clock supplied to the HSE input.
|
||||
|
||||
|
||||
endif # ARCH_BOARD_STM32H7S8_DK
|
||||
59
boards/arm/stm32h7/stm32h7s8-dk/configs/nsh/defconfig
Normal file
59
boards/arm/stm32h7/stm32h7s8-dk/configs/nsh/defconfig
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#
|
||||
# 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_DISABLE_ENVIRON is not set
|
||||
# CONFIG_NSH_DISABLE_ECHO is not set
|
||||
# CONFIG_NSH_DISABLE_UNAME is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32h7s8-dk"
|
||||
CONFIG_ARCH_BOARD_STM32H7S8_DK=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32h7"
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32H7=y
|
||||
CONFIG_ARCH_CHIP_STM32H7S3L8=y
|
||||
CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y
|
||||
CONFIG_ARCH_IRQBUTTONS=y
|
||||
CONFIG_ARMV7M_DCACHE=y
|
||||
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
|
||||
CONFIG_ARMV7M_ICACHE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=119965
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_ENABLE_ALL_SIGNALS=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_LEDS=y
|
||||
CONFIG_FILE_STREAM=y
|
||||
CONFIG_INDUSTRY_MODBUS_DISABLE_LOG=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_BUTTONS=y
|
||||
CONFIG_INPUT_BUTTONS_LOWER=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=64
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_RAM_SIZE=466944
|
||||
CONFIG_RAM_START=0x24000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=22
|
||||
CONFIG_START_MONTH=9
|
||||
CONFIG_START_YEAR=2026
|
||||
CONFIG_STM32_PWR_DIRECT_SMPS_SUPPLY=y
|
||||
CONFIG_STM32_UART4=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_UART4_SERIAL_CONSOLE=y
|
||||
CONFIG_USERLED=y
|
||||
CONFIG_USERLED_LOWER=y
|
||||
215
boards/arm/stm32h7/stm32h7s8-dk/include/board.h
Normal file
215
boards/arm/stm32h7/stm32h7s8-dk/include/board.h
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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_STM32H7S8_DK_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_STM32H7_STM32H7S8_DK_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Do not include STM32 H7 header files here */
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* The STM32H7S8-DK board provides the following clock sources:
|
||||
*
|
||||
* MCO: 24 MHz from the ST-LINK is available as the HSE input
|
||||
* X2: 32.768 kHz crystal for LSE
|
||||
*
|
||||
* HSI is selected by default so that the board can run when the ST-LINK is
|
||||
* not supplying its MCO clock. CONFIG_STM32H7S8_DK_USE_HSE selects the
|
||||
* 24 MHz bypass clock instead.
|
||||
*/
|
||||
|
||||
#define STM32_BOARD_XTAL 24000000ul
|
||||
#define STM32_HSI_FREQUENCY 64000000ul
|
||||
#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
|
||||
#define STM32_LSI_FREQUENCY 32000ul
|
||||
#define STM32_LSE_FREQUENCY 32768ul
|
||||
|
||||
/* Main PLL configuration
|
||||
*
|
||||
* The HSI and HSE configurations both produce a 600 MHz PLL1 VCO and use
|
||||
* PLL1P as the system clock:
|
||||
*
|
||||
* HSI: PLL1_VCO = (64 MHz / 32) * 300 = 600 MHz
|
||||
* HSE: PLL1_VCO = (24 MHz / 2) * 50 = 600 MHz
|
||||
*
|
||||
* PLL1P = 600 MHz
|
||||
* PLL1Q = 300 MHz
|
||||
* PLL1R = 300 MHz
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_STM32H7S8_DK_USE_HSE
|
||||
# define STM32_BOARD_USEHSE
|
||||
# define STM32_HSEBYP_ENABLE
|
||||
# define STM32_PLLCFG_PLLSRC RCC_PLLCKSELR_PLLSRC_HSE
|
||||
# define STM32_PLLCFG_PLL1M RCC_PLLCKSELR_DIVM1(2)
|
||||
# define STM32_PLLCFG_PLL1N RCC_PLL1DIVR1_N(50)
|
||||
# define STM32_PLLCFG_PLL1CFG (RCC_PLLCFGR_PLL1RGE_8_16 | \
|
||||
RCC_PLLCFGR_PLL1PEN | \
|
||||
RCC_PLLCFGR_PLL1QEN | \
|
||||
RCC_PLLCFGR_PLL1REN)
|
||||
#else
|
||||
# define STM32_BOARD_USEHSI
|
||||
# define STM32_PLLCFG_PLLSRC RCC_PLLCKSELR_PLLSRC_HSI
|
||||
# define STM32_PLLCFG_PLL1M RCC_PLLCKSELR_DIVM1(32)
|
||||
# define STM32_PLLCFG_PLL1N RCC_PLL1DIVR1_N(300)
|
||||
# define STM32_PLLCFG_PLL1CFG (RCC_PLLCFGR_PLL1RGE_2_4 | \
|
||||
RCC_PLLCFGR_PLL1PEN | \
|
||||
RCC_PLLCFGR_PLL1QEN | \
|
||||
RCC_PLLCFGR_PLL1REN)
|
||||
#endif
|
||||
|
||||
#define STM32_PLLCFG_PLL1P RCC_PLL1DIVR1_P(1)
|
||||
#define STM32_PLLCFG_PLL1Q RCC_PLL1DIVR1_Q(2)
|
||||
#define STM32_PLLCFG_PLL1R RCC_PLL1DIVR1_R(2)
|
||||
|
||||
#define STM32_VCO1_FREQUENCY 600000000ul
|
||||
#define STM32_PLL1P_FREQUENCY STM32_VCO1_FREQUENCY
|
||||
#define STM32_PLL1Q_FREQUENCY (STM32_VCO1_FREQUENCY / 2)
|
||||
#define STM32_PLL1R_FREQUENCY (STM32_VCO1_FREQUENCY / 2)
|
||||
|
||||
/* SYSCLK = PLL1P = 600 MHz
|
||||
* CPUCLK = SYSCLK
|
||||
*/
|
||||
|
||||
#define STM32_RCC_CDCFGR_CPRE RCC_CDCFGR_CPRE_SYSCLK
|
||||
#define STM32_SYSCLK_FREQUENCY STM32_PLL1P_FREQUENCY
|
||||
#define STM32_CPUCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
|
||||
|
||||
/* AHB clock (HCLK) is SYSCLK/2 (300 MHz). */
|
||||
|
||||
#define STM32_RCC_BMCFGR_HPRE RCC_BMCFGR_HPRE_SYSCLKd2
|
||||
#define STM32_HCLK_FREQUENCY (STM32_SYSCLK_FREQUENCY / 2)
|
||||
|
||||
/* APB1, APB2, APB4 and APB5 clocks are HCLK/2 (150 MHz). */
|
||||
|
||||
#define STM32_RCC_APBCFGR_PPRE1 RCC_APBCFGR_PPRE1_HCLKd2
|
||||
#define STM32_RCC_APBCFGR_PPRE2 RCC_APBCFGR_PPRE2_HCLKd2
|
||||
#define STM32_RCC_APBCFGR_PPRE4 RCC_APBCFGR_PPRE4_HCLKd2
|
||||
#define STM32_RCC_APBCFGR_PPRE5 RCC_APBCFGR_PPRE5_HCLKd2
|
||||
#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
||||
#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
||||
#define STM32_PCLK4_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
||||
#define STM32_PCLK5_FREQUENCY (STM32_HCLK_FREQUENCY / 2)
|
||||
|
||||
/* Timers on APB1 and APB2 are clocked at twice the peripheral clock. */
|
||||
|
||||
#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)
|
||||
|
||||
#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)
|
||||
|
||||
/* FLASH wait states */
|
||||
|
||||
#define BOARD_FLASH_WAITSTATES 7
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* The STM32H7S8-DK has three user-controllable LEDs:
|
||||
*
|
||||
* LD1: Green
|
||||
* LD2: Yellow
|
||||
* LD3: Red
|
||||
* LD4: Blue
|
||||
*
|
||||
* If CONFIG_ARCH_LEDS is defined, NuttX controls the LEDs as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* LED_STARTED NuttX has been started All LEDs off
|
||||
* LED_HEAPALLOCATE Heap has been allocated No change
|
||||
* LED_IRQSENABLED Interrupts enabled No change
|
||||
* LED_STACKCREATED Idle stack created Green on
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed Red on
|
||||
* LED_PANIC The system has crashed Red blinking
|
||||
*/
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_LED2 1
|
||||
#define BOARD_LED3 2
|
||||
#define BOARD_LED4 3
|
||||
#define BOARD_NLEDS 4
|
||||
#define BOARD_LED_GREEN BOARD_LED1
|
||||
#define BOARD_LED_YELLOW BOARD_LED2
|
||||
#define BOARD_LED_RED BOARD_LED3
|
||||
#define BOARD_LED_BLUE BOARD_LED4
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
||||
|
||||
#define LED_STARTED 0
|
||||
#define LED_HEAPALLOCATE 1
|
||||
#define LED_IRQSENABLED 2
|
||||
#define LED_STACKCREATED 3
|
||||
#define LED_INIRQ 4
|
||||
#define LED_SIGNAL 5
|
||||
#define LED_ASSERTION 6
|
||||
#define LED_PANIC 7
|
||||
#define LED_IDLE 8
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* The blue B2 user button is connected to PC13 and is active low. The black
|
||||
* B1 button drives NRST and is not a GPIO button.
|
||||
*/
|
||||
|
||||
#define BUTTON_USER 0
|
||||
#define NUM_BUTTONS 1
|
||||
#define BUTTON_USER_BIT (1 << BUTTON_USER)
|
||||
|
||||
/* Alternate function pin selections ****************************************/
|
||||
|
||||
/* UART4: ST-LINK virtual COM port on PD1 and PD0. */
|
||||
|
||||
#define GPIO_UART4_TX (GPIO_UART4_TX_5 | GPIO_SPEED_100MHz) /* PD1 */
|
||||
#define GPIO_UART4_RX (GPIO_UART4_RX_5 | GPIO_SPEED_100MHz) /* PD0 */
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32H7_STM32H7S8_DK_INCLUDE_BOARD_H */
|
||||
36
boards/arm/stm32h7/stm32h7s8-dk/scripts/Make.defs
Normal file
36
boards/arm/stm32h7/stm32h7s8-dk/scripts/Make.defs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
############################################################################
|
||||
# boards/arm/stm32h7/stm32h7s8-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
|
||||
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
|
||||
|
||||
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
|
||||
124
boards/arm/stm32h7/stm32h7s8-dk/scripts/flash.ld
Normal file
124
boards/arm/stm32h7/stm32h7s8-dk/scripts/flash.ld
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The STM32H7S3L8 has 64 Kbytes of internal FLASH starting at 0x08000000.
|
||||
* Its default SRAM allocation provides:
|
||||
*
|
||||
* 64 Kbytes of ITCM RAM at 0x00000000
|
||||
* 64 Kbytes of DTCM RAM at 0x20000000
|
||||
* 456 Kbytes of AXI SRAM at 0x24000000
|
||||
* 16 Kbytes of AHB SRAM1 at 0x30000000
|
||||
* 16 Kbytes of AHB SRAM2 at 0x30004000
|
||||
* 4 Kbytes of backup SRAM at 0x38800000
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
|
||||
dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
sram (rwx) : ORIGIN = 0x24000000, LENGTH = 456K
|
||||
sram1 (rwx) : ORIGIN = 0x30000000, LENGTH = 16K
|
||||
sram2 (rwx) : ORIGIN = 0x30004000, 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
|
||||
|
||||
/* 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) }
|
||||
}
|
||||
40
boards/arm/stm32h7/stm32h7s8-dk/src/CMakeLists.txt
Normal file
40
boards/arm/stm32h7/stm32h7s8-dk/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# ##############################################################################
|
||||
# boards/arm/stm32h7/stm32h7s8-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()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
set(LD_SCRIPT flash.ld)
|
||||
|
||||
set_property(GLOBAL PROPERTY LD_SCRIPT
|
||||
"${NUTTX_BOARD_DIR}/scripts/${LD_SCRIPT}")
|
||||
39
boards/arm/stm32h7/stm32h7s8-dk/src/Make.defs
Normal file
39
boards/arm/stm32h7/stm32h7s8-dk/src/Make.defs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
############################################################################
|
||||
# boards/arm/stm32h7/stm32h7s8-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
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
116
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_autoleds.c
Normal file
116
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_autoleds.c
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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 <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32h7s8-dk.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Indexed by BOARD_LED_<color> */
|
||||
|
||||
static const uint32_t g_ledmap[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED_GREEN,
|
||||
GPIO_LED_ORANGE,
|
||||
GPIO_LED_RED, /* active low */
|
||||
GPIO_LED_BLUE, /* active low */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the LD1, LD2 and LD3 GPIOs for output. Initial state is
|
||||
* OFF.
|
||||
*/
|
||||
|
||||
for (i = 0; i < nitems(g_ledmap); i++)
|
||||
{
|
||||
stm32_configgpio(g_ledmap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case LED_STACKCREATED:
|
||||
stm32_gpiowrite(GPIO_LED_GREEN, true);
|
||||
break;
|
||||
|
||||
case LED_ASSERTION:
|
||||
case LED_PANIC:
|
||||
stm32_gpiowrite(GPIO_LED_RED, false); /* active low */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case LED_ASSERTION:
|
||||
case LED_PANIC:
|
||||
stm32_gpiowrite(GPIO_LED_RED, true); /* active low */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
84
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_boot.c
Normal file
84
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_boot.c
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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 <nuttx/config.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32h7s8-dk.h"
|
||||
#include "arm_internal.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "hardware/stm32h7rsxx_pwr.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)
|
||||
{
|
||||
/* Enable VDD33USB and VDDXSPI1 domains to power LED GPIO pins. */
|
||||
|
||||
modifyreg32(STM32_PWR_CSR2, 0, PWR_CSR2_EN_XSPIM1 | PWR_CSR2_USB33DEN);
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
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
|
||||
97
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_bringup.c
Normal file
97
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_bringup.c
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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 <nuttx/config.h>
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#if defined(CONFIG_USERLED) && !defined(CONFIG_ARCH_LEDS)
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#include "stm32h7s8-dk.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
UNUSED(ret);
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_FS_PROCFS */
|
||||
|
||||
#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS_LOWER
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
97
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_buttons.c
Normal file
97
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_buttons.c
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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 <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32h7s8-dk.h"
|
||||
|
||||
#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 NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* 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 /* CONFIG_ARCH_IRQBUTTONS */
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
130
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_userleds.c
Normal file
130
boards/arm/stm32h7/stm32h7s8-dk/src/stm32_userleds.c
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-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 <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32h7s8-dk.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration and is indexed by
|
||||
* BOARD_LED_<color>.
|
||||
*/
|
||||
|
||||
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED_GREEN,
|
||||
GPIO_LED_ORANGE,
|
||||
GPIO_LED_RED, /* Active low */
|
||||
GPIO_LED_BLUE, /* Active low */
|
||||
};
|
||||
|
||||
/* Bitmask indicating active state of LEDs */
|
||||
|
||||
static uint32_t g_ledactivemask = 0xc; /* LD3/LD4 are active low */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is not defined, then
|
||||
* board_userled_initialize() is available to initialize the LEDs from
|
||||
* application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the LD1, LD2, LD3, and LD4 GPIOs for output. */
|
||||
|
||||
for (i = 0; i < nitems(g_ledcfg); i++)
|
||||
{
|
||||
stm32_configgpio(g_ledcfg[i]);
|
||||
}
|
||||
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is not defined, then board_userled() is available
|
||||
* to control one LED from application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned int)led < nitems(g_ledcfg))
|
||||
{
|
||||
unsigned int ledstate = ledon;
|
||||
|
||||
ledstate ^= (g_ledactivemask >> led) & 0x1;
|
||||
stm32_gpiowrite(g_ledcfg[led], ledstate);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_ARCH_LEDS is not defined, then board_userled_all() is
|
||||
* available to control all LEDs from application logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nitems(g_ledcfg); i++)
|
||||
{
|
||||
unsigned int ledstate = (ledset >> i) & 0x1;
|
||||
|
||||
ledstate ^= (g_ledactivemask >> i) & 0x1;
|
||||
stm32_gpiowrite(g_ledcfg[i], ledstate);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
||||
92
boards/arm/stm32h7/stm32h7s8-dk/src/stm32h7s8-dk.h
Normal file
92
boards/arm/stm32h7/stm32h7s8-dk/src/stm32h7s8-dk.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32h7/stm32h7s8-dk/src/stm32h7s8-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_STM32H7S8_DK_SRC_STM32H7S8_DK_H
|
||||
#define __BOARDS_ARM_STM32H7_STM32H7S8_DK_SRC_STM32H7S8_DK_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* LEDS
|
||||
*
|
||||
* The green LD1, orange LD2, red LD3 LED, and blue LD4 LEDs are connected
|
||||
* to PO1, PO5, PM2, PM3 respectively. A high output illuminates each LED.
|
||||
*/
|
||||
|
||||
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTO | GPIO_PIN1)
|
||||
#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTO | GPIO_PIN5)
|
||||
#define GPIO_LD3 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTM | GPIO_PIN2)
|
||||
#define GPIO_LD4 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
|
||||
GPIO_OUTPUT_CLEAR | GPIO_PORTM | GPIO_PIN3)
|
||||
|
||||
#define GPIO_LED_GREEN GPIO_LD1
|
||||
#define GPIO_LED_ORANGE GPIO_LD2
|
||||
#define GPIO_LED_RED GPIO_LD3
|
||||
#define GPIO_LED_BLUE GPIO_LD4
|
||||
|
||||
/* BUTTONS
|
||||
*
|
||||
* The blue B2 user button is connected to PC13. The input is low while the
|
||||
* button is pressed. GPIO_EXTI permits interrupt button support.
|
||||
*/
|
||||
|
||||
#define GPIO_BTN_USER (GPIO_INPUT | GPIO_PULLDOWN | GPIO_EXTI | \
|
||||
GPIO_PORTC | GPIO_PIN13)
|
||||
|
||||
/* procfs file system */
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# define STM32_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# else
|
||||
# define STM32_PROCFS_MOUNTPOINT "/proc"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_bringup(void);
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32H7_STM32H7S8_DK_SRC_STM32H7S8_DK_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue