boards/arm: add nucleo-h7s3l8 support

add nucleo-h7s3l8 board support

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: OpenAI Codex:gpt-5
This commit is contained in:
raiden00pl 2026-08-14 14:06:34 +02:00 committed by Xiang Xiao
parent 3c91ae096e
commit 7d8f8f47e8
22 changed files with 1872 additions and 0 deletions

View file

@ -0,0 +1,100 @@
=================
ST Nucleo H7S3L8
=================
.. tags:: chip:stm32, chip:stm32h7, chip:stm32h7s3
This page describes the NuttX port for the STMicro NUCLEO-H7S3L8
development board. The board is based on the 600 MHz STM32H7S3L8
Cortex-M7 microcontroller.
XIP Boot
========
The STM32H7S3L8 has 64 KB of internal flash. The board also carries a
32 MB MX25UW25645G NOR flash on XSPI2, mapped at ``0x70000000``. Running
NuttX from the external flash uses two images:
* ``boot-xip`` runs from internal flash at ``0x08000000``.
* ``nsh-xip`` executes in place from XSPI2 flash at ``0x70000000``.
The bootloader configures the MX25UW25645G in octal STR memory-mapped mode,
validates the initial stack pointer and reset vector, and starts the external
image. Image management, rollback, integrity checking, and authentication
are not currently provided.
Flashing
========
.. note::
The ``XSPI2_HSLV`` option byte must be set to ``1`` before using the
external flash. The option byte setting is persistent.
Build the external image::
cmake -B build/nsh-xip -DBOARD_CONFIG=nucleo-h7s3l8:nsh-xip -GNinja
cmake --build build/nsh-xip
Build the internal bootloader::
cmake -B build/boot-xip -DBOARD_CONFIG=nucleo-h7s3l8:boot-xip -GNinja
cmake --build build/boot-xip
Install STM32CubeProgrammer and set ``CUBE_PROGRAMMER`` to the path of its
command-line executable. The external loader is supplied by the
STM32CubeProgrammer installation::
CUBE_PROGRAMMER=/path/to/STM32_Programmer_CLI
EXTERNAL_LOADER="$(dirname "$CUBE_PROGRAMMER")/ExternalLoader/MX25UW25645G_NUCLEO-H7S3L8-OBL.stldr"
Erase the external flash, then program and verify the XIP image::
"$CUBE_PROGRAMMER" --connect port=SWD mode=Normal --erase all \
-el "$EXTERNAL_LOADER"
"$CUBE_PROGRAMMER" --connect port=SWD mode=Normal \
--download build/nsh-xip/nuttx.bin 0x70000000 --verify \
--skipErase \
-el "$EXTERNAL_LOADER"
Program and verify the internal bootloader, then reset the board::
"$CUBE_PROGRAMMER" --connect port=SWD reset=HWrst \
--download build/boot-xip/nuttx.bin 0x08000000 --verify --rst
The internal image initializes XSPI2 and transfers control to the external
image after reset.
Configurations
==============
Each configuration is maintained in a subdirectory of ``configs`` and can be
selected as follows::
tools/configure.sh nucleo-h7s3l8:<subdir>
Where ``<subdir>`` is one of the following:
nsh
---
Provides a basic NuttShell configuration in internal flash. The default
console is the ST-LINK virtual COM port on USART3.
nsh-xip
-------
Provides NuttShell, common diagnostic commands, and ``ostest``. The image is
linked for execution from XSPI2 flash at ``0x70000000`` and requires an XIP
bootloader in internal flash.
jumbo-xip
---------
As ``nsh-xip``, with networking over the on-board LAN8742A Ethernet PHY. The
address is obtained by DHCP.
boot-xip
--------
Provides the internal-flash NuttX bootloader used to start the ``nsh-xip``
image.

View file

@ -2098,6 +2098,15 @@ config ARCH_BOARD_NUCLEO_H753ZI
---help---
STMicro Nucleo H753ZI board based on the STMicro STM32H753ZI MCU.
config ARCH_BOARD_NUCLEO_H7S3L8
bool "STM32H7S3 Nucleo H7S3L8"
depends on ARCH_CHIP_STM32H7S3L8
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
---help---
STMicro Nucleo H7S3L8 board based on the STM32H7S3L8 MCU.
config ARCH_BOARD_OPENH743I
bool "Waveshare OpenH743I board"
depends on ARCH_CHIP_STM32H743II
@ -4019,6 +4028,7 @@ config ARCH_BOARD
default "stm32h750b-dk" if ARCH_BOARD_STM32H750B_DK
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 "openh743i" if ARCH_BOARD_OPENH743I
default "portenta-h7" if ARCH_BOARD_PORTENTA_H7
default "nucleo-l073rz" if ARCH_BOARD_NUCLEO_L073RZ
@ -4829,6 +4839,9 @@ endif
if ARCH_BOARD_NUCLEO_H753ZI
source "boards/arm/stm32h7/nucleo-h753zi/Kconfig"
endif
if ARCH_BOARD_NUCLEO_H7S3L8
source "boards/arm/stm32h7/nucleo-h7s3l8/Kconfig"
endif
if ARCH_BOARD_OPENH743I
source "boards/arm/stm32h7/openh743i/Kconfig"
endif

View file

@ -0,0 +1,23 @@
# ##############################################################################
# boards/arm/stm32h7/nucleo-h7s3l8/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)

View file

@ -0,0 +1,33 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_NUCLEO_H7S3L8
config NUCLEO_H7S3L8_USE_HSE
bool "Use the HSE clock source"
default n
help
Use the 24 MHz external clock supplied to the HSE input.
config NUCLEO_H7S3L8_XIP
bool "Run from external XSPI2 flash"
default n
select STM32_BYPASS_CLOCKCONFIG
help
Link NuttX for execution from the board's MX25UW25645G flash at
0x70000000. The internal flash must contain a loader which
initializes XSPI2 before transferring control to NuttX.
config NUCLEO_H7S3L8_XIP_BOOTLOADER
bool "Boot an external XIP image"
default n
depends on STM32_XSPI && MTD_MX25UW25645G
help
Build a NuttX bootloader in internal flash. It initializes the
MX25UW25645G flash in memory-mapped mode and starts a raw Arm image
linked at 0x70000000. Image selection, update and integrity checking
are not provided.
endif # ARCH_BOARD_NUCLEO_H7S3L8

View file

@ -0,0 +1,38 @@
#
# 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_FPU is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nucleo-h7s3l8"
CONFIG_ARCH_BOARD_NUCLEO_H7S3L8=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_ARMV7M_DCACHE=y
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
CONFIG_ARMV7M_ICACHE=y
CONFIG_BOARD_LOOPSPERMSEC=119965
CONFIG_DEFAULT_SMALL=y
CONFIG_INIT_ENTRYPOINT="stm32_xip_boot"
CONFIG_INIT_STACKSIZE=1536
CONFIG_MTD=y
CONFIG_MTD_MX25UW25645G=y
CONFIG_NUCLEO_H7S3L8_XIP_BOOTLOADER=y
CONFIG_NUNGET_CHARS=0
CONFIG_RAM_SIZE=466944
CONFIG_RAM_START=0x24000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_START_DAY=13
CONFIG_START_MONTH=8
CONFIG_START_YEAR=2026
CONFIG_STM32_USART3=y
CONFIG_STM32_XSPI=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART3_SERIAL_CONSOLE=y

View file

@ -0,0 +1,70 @@
#
# 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="arm"
CONFIG_ARCH_BOARD="nucleo-h7s3l8"
CONFIG_ARCH_BOARD_NUCLEO_H7S3L8=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_ETH0_PHY_LAN8742A=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_TMPFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=1536
CONFIG_INTELHEX_BINARY=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETINIT_DHCPC=y
CONFIG_NETINIT_THREAD=y
CONFIG_NETUTILS_DHCPC=y
CONFIG_NET_ETH_PKTSIZE=1500
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_UDP=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_MAXARGUMENTS=16
CONFIG_NSH_READLINE=y
CONFIG_NUCLEO_H7S3L8_XIP=y
CONFIG_PIPES=y
CONFIG_RAM_SIZE=466944
CONFIG_RAM_START=0x24000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=13
CONFIG_START_MONTH=8
CONFIG_START_YEAR=2026
CONFIG_STM32_ETHMAC=y
CONFIG_STM32_PHYSR=31
CONFIG_STM32_PHYSR_100FD=0x0018
CONFIG_STM32_PHYSR_100HD=0x0008
CONFIG_STM32_PHYSR_10FD=0x0014
CONFIG_STM32_PHYSR_10HD=0x0004
CONFIG_STM32_PHYSR_ALTCONFIG=y
CONFIG_STM32_PHYSR_ALTMODE=0x001c
CONFIG_STM32_USART3=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TESTING_OSTEST=y
CONFIG_USART3_SERIAL_CONSOLE=y

View file

@ -0,0 +1,51 @@
#
# 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="arm"
CONFIG_ARCH_BOARD="nucleo-h7s3l8"
CONFIG_ARCH_BOARD_NUCLEO_H7S3L8=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_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_TMPFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=1536
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=24
CONFIG_IOB_NCHAINS=24
CONFIG_MM_IOB=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_MAXARGUMENTS=16
CONFIG_NSH_READLINE=y
CONFIG_NUCLEO_H7S3L8_XIP=y
CONFIG_PIPES=y
CONFIG_RAM_SIZE=466944
CONFIG_RAM_START=0x24000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=13
CONFIG_START_MONTH=8
CONFIG_START_YEAR=2026
CONFIG_STM32_USART3=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_OSTEST=y
CONFIG_USART3_SERIAL_CONSOLE=y

View file

@ -0,0 +1,43 @@
#
# 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_DISABLE_ENVIRON is not set
# CONFIG_NSH_DISABLE_ECHO is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nucleo-h7s3l8"
CONFIG_ARCH_BOARD_NUCLEO_H7S3L8=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_DEFAULT_SMALL=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=1536
CONFIG_INTELHEX_BINARY=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
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=13
CONFIG_START_MONTH=8
CONFIG_START_YEAR=2026
CONFIG_STM32_USART3=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART3_SERIAL_CONSOLE=y

View file

@ -0,0 +1,237 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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_NUCLEO_H7S3L8_INCLUDE_BOARD_H
#define __BOARDS_ARM_STM32H7_NUCLEO_H7S3L8_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 NUCLEO-H7S3L8 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_NUCLEO_H7S3L8_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_NUCLEO_H7S3L8_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 NUCLEO-H7S3L8 has three user-controllable LEDs:
*
* LD1: Green
* LD2: Yellow
* LD3: Red
*
* 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_NLEDS 3
#define BOARD_LED_GREEN BOARD_LED1
#define BOARD_LED_YELLOW BOARD_LED2
#define BOARD_LED_RED BOARD_LED3
/* 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 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 ****************************************/
/* USART3: ST-LINK virtual COM port on PD8 and PD9. */
#define GPIO_USART3_TX (GPIO_USART3_TX_3 | GPIO_SPEED_100MHz) /* PD8 */
#define GPIO_USART3_RX (GPIO_USART3_RX_3 | GPIO_SPEED_100MHz) /* PD9 */
/* XSPI2: MX25UW25645G Octal SPI flash. */
#define GPIO_XSPI2_CLK (GPIO_XSPI2_CLK_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_DQS (GPIO_XSPI2_DQS_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_NCS (GPIO_XSPI2_NCS_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO0 (GPIO_XSPI2_IO0_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO1 (GPIO_XSPI2_IO1_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO2 (GPIO_XSPI2_IO2_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO3 (GPIO_XSPI2_IO3_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO4 (GPIO_XSPI2_IO4_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO5 (GPIO_XSPI2_IO5_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO6 (GPIO_XSPI2_IO6_1 | GPIO_SPEED_100MHz)
#define GPIO_XSPI2_IO7 (GPIO_XSPI2_IO7_1 | GPIO_SPEED_100MHz)
/* Ethernet: LAN8742A PHY on RMII, RJ45 at CN4. */
#define GPIO_ETH_MDC (GPIO_ETH_MDC_2 | GPIO_SPEED_100MHz) /* PG6 */
#define GPIO_ETH_MDIO (GPIO_ETH_MDIO_1 | GPIO_SPEED_100MHz) /* PA2 */
#define GPIO_ETH_RMII_REF_CLK (GPIO_ETH_RMII_REF_CLK_2 | GPIO_SPEED_100MHz) /* PB6 */
#define GPIO_ETH_RMII_CRS_DV (GPIO_ETH_RMII_CRS_DV_1 | GPIO_SPEED_100MHz) /* PA7 */
#define GPIO_ETH_RMII_RXD0 (GPIO_ETH_RMII_RXD0_2 | GPIO_SPEED_100MHz) /* PG4 */
#define GPIO_ETH_RMII_RXD1 (GPIO_ETH_RMII_RXD1_2 | GPIO_SPEED_100MHz) /* PG5 */
#define GPIO_ETH_RMII_TX_EN (GPIO_ETH_RMII_TX_EN_3 | GPIO_SPEED_100MHz) /* PG11 */
#define GPIO_ETH_RMII_TXD0 (GPIO_ETH_RMII_TXD0_2 | GPIO_SPEED_100MHz) /* PG13 */
#define GPIO_ETH_RMII_TXD1 (GPIO_ETH_RMII_TXD1_3 | GPIO_SPEED_100MHz) /* PG12 */
#endif /* __BOARDS_ARM_STM32H7_NUCLEO_H7S3L8_INCLUDE_BOARD_H */

View file

@ -0,0 +1,40 @@
############################################################################
# boards/arm/stm32h7/nucleo-h7s3l8/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
ifeq ($(CONFIG_NUCLEO_H7S3L8_XIP),y)
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)xip.ld
else
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
endif
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

View file

@ -0,0 +1,124 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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) }
}

View file

@ -0,0 +1,124 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/scripts/xip.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 XIP image executes from the board's 32-Mbyte MX25UW25645G flash at
* 0x70000000. The STM32H7S3L8 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 = 0x70000000, LENGTH = 32M
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) }
}

View file

@ -0,0 +1,48 @@
# ##############################################################################
# boards/arm/stm32h7/nucleo-h7s3l8/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_NUCLEO_H7S3L8_XIP_BOOTLOADER)
list(APPEND SRCS stm32_mx25uw25645g.c stm32_xip_boot.c)
endif()
target_sources(board PRIVATE ${SRCS})
if(CONFIG_NUCLEO_H7S3L8_XIP)
set(LD_SCRIPT xip.ld)
else()
set(LD_SCRIPT flash.ld)
endif()
set_property(GLOBAL PROPERTY LD_SCRIPT
"${NUTTX_BOARD_DIR}/scripts/${LD_SCRIPT}")

View file

@ -0,0 +1,43 @@
############################################################################
# boards/arm/stm32h7/nucleo-h7s3l8/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_NUCLEO_H7S3L8_XIP_BOOTLOADER),y)
CSRCS += stm32_mx25uw25645g.c stm32_xip_boot.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board

View file

@ -0,0 +1,102 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/src/nucleo-h7s3l8.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_NUCLEO_H7S3L8_SRC_NUCLEO_H7S3L8_H
#define __BOARDS_ARM_STM32H7_NUCLEO_H7S3L8_SRC_NUCLEO_H7S3L8_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include "stm32_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* LEDS
*
* The green LD1, yellow LD2 and red LD3 LEDs are connected to PD10, PD13 and
* PB7 respectively. A high output illuminates each LED.
*/
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
GPIO_OUTPUT_CLEAR | GPIO_PORTD | GPIO_PIN10)
#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
GPIO_OUTPUT_CLEAR | GPIO_PORTD | GPIO_PIN13)
#define GPIO_LD3 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_2MHz | \
GPIO_OUTPUT_CLEAR | GPIO_PORTB | GPIO_PIN7)
#define GPIO_LED_GREEN GPIO_LD1
#define GPIO_LED_YELLOW GPIO_LD2
#define GPIO_LED_RED GPIO_LD3
/* 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_PULLUP | 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);
/****************************************************************************
* Name: stm32_xspi_flash_initialize
*
* Description:
* Initialize the external MX25UW25645G flash for memory-mapped access.
*
****************************************************************************/
#ifdef CONFIG_NUCLEO_H7S3L8_XIP_BOOTLOADER
int stm32_xspi_flash_initialize(void);
int stm32_xip_boot(int argc, char *argv[]);
#endif
#endif /* __BOARDS_ARM_STM32H7_NUCLEO_H7S3L8_SRC_NUCLEO_H7S3L8_H */

View file

@ -0,0 +1,115 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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 "nucleo-h7s3l8.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_YELLOW,
GPIO_LED_RED,
};
/****************************************************************************
* 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, true);
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, false);
break;
}
}
#endif /* CONFIG_ARCH_LEDS */

View file

@ -0,0 +1,77 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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 "nucleo-h7s3l8.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
/* 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

View file

@ -0,0 +1,97 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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 "nucleo-h7s3l8.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;
}

View file

@ -0,0 +1,97 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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 "nucleo-h7s3l8.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 */

View file

@ -0,0 +1,109 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/src/stm32_mx25uw25645g.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/mtd/mtd.h>
#include "stm32_xspi.h"
#include "nucleo-h7s3l8.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Must match OCTA_READ/DC settings in drivers/mtd/mx25uw25645g.c */
#define MX25UW_OCTA_READ 0xec13 /* Octal STR read command */
#define MX25UW_READ_DUMMY 6 /* Dummy cycles for 100 MHz XSPI */
/* DEVSIZE encodes 2^(n+1) bytes: 24 -> 32 MB */
#define MX25UW_DEVSIZE 24
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_xspi_flash_initialize
*
* Description:
* Initialize XSPI2 and the board's MX25UW25645G flash, then enter
* memory-mapped octal STR mode.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int stm32_xspi_flash_initialize(void)
{
struct stm32_xspi_config_s config;
struct qspi_meminfo_s readinfo;
struct mtd_dev_s *mtd;
struct qspi_dev_s *qspi;
config.memtype = STM32_XSPI_MEMTYPE_MACRONIX;
config.iomport = STM32_XSPI_IOM_PORT2;
config.cs_override = STM32_XSPI_CS_NCS1;
config.devsize = MX25UW_DEVSIZE;
config.csht = 2;
config.prescaler = 3;
config.fthres = 4;
config.wrapsize = 0;
config.maxtran = 0;
config.csbound = 0;
config.req2ack = 1;
config.refresh = 0;
config.clock_mode3 = false;
config.free_running = false;
config.sample_shift = false;
readinfo.flags = QSPIMEM_IOCTAL | QSPIMEM_OCTALIO;
readinfo.addrlen = 4;
readinfo.dummies = MX25UW_READ_DUMMY;
readinfo.cmd = MX25UW_OCTA_READ;
readinfo.buflen = 0;
readinfo.addr = 0;
readinfo.buffer = NULL;
qspi = stm32_xspi_initialize(2, &config);
if (qspi == NULL)
{
return -ENODEV;
}
mtd = mx25uw25645g_initialize(qspi);
if (mtd == NULL)
{
return -ENODEV;
}
return stm32_xspi_enter_memorymapped(qspi, &readinfo, NULL);
}

View file

@ -0,0 +1,119 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/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 "nucleo-h7s3l8.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_YELLOW,
GPIO_LED_RED,
};
/****************************************************************************
* 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 and LD3 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))
{
stm32_gpiowrite(g_ledcfg[led], ledon);
}
}
/****************************************************************************
* 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++)
{
stm32_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
}
}
#endif /* !CONFIG_ARCH_LEDS */

View file

@ -0,0 +1,169 @@
/****************************************************************************
* boards/arm/stm32h7/nucleo-h7s3l8/src/stm32_xip_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 <errno.h>
#include <stdint.h>
#include <syslog.h>
#include <arch/barriers.h>
#include <nuttx/cache.h>
#include "arm_internal.h"
#include "nvic.h"
#include "nucleo-h7s3l8.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define STM32_XIP_BASE 0x70000000
#define STM32_XIP_SIZE 0x02000000
/****************************************************************************
* Private Types
****************************************************************************/
struct xip_vector_s
{
uint32_t stack;
uint32_t reset;
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: xip_vector_valid
*
* Description:
* Validate the initial stack pointer and reset vector of the external
* image before transferring control to it.
*
****************************************************************************/
static int xip_vector_valid(const struct xip_vector_s *vector)
{
uint32_t reset = vector->reset & ~1;
if (vector->stack < 0x20000000 || vector->stack >= 0x40000000 ||
reset < STM32_XIP_BASE || reset >= STM32_XIP_BASE + STM32_XIP_SIZE ||
(vector->reset & 1) == 0)
{
return -EINVAL;
}
return OK;
}
/****************************************************************************
* Name: xip_jump
*
* Description:
* Disable active core state and transfer control to an external image.
* This function does not return.
*
****************************************************************************/
static void xip_jump(const struct xip_vector_s *vector)
{
int i;
putreg32(0, NVIC_SYSTICK_CTRL);
UP_ISB();
cpsid();
for (i = 0; i < NR_IRQS; i += 32)
{
putreg32(0xffffffff, NVIC_IRQ_CLEAR(i));
putreg32(0xffffffff, NVIC_IRQ_CLRPEND(i));
}
#ifdef CONFIG_ARMV7M_DCACHE
up_disable_dcache();
#endif
#ifdef CONFIG_ARMV7M_ICACHE
up_disable_icache();
#endif
putreg32(STM32_XIP_BASE, NVIC_VECTAB);
UP_DSB();
UP_ISB();
__asm__ __volatile__("msr msp, %0\n"
"msr control, %1\n"
"msr primask, %1\n"
"isb\n"
"bx %2\n"
:
: "r" (vector->stack), "r" (0),
"r" (vector->reset));
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_xip_boot
*
* Description:
* Bootloader entry point (CONFIG_INIT_ENTRYPOINT) which initializes the
* external flash and starts the raw NuttX image at the beginning of the
* XSPI2 memory-mapped window.
*
* Returned Value:
* This function does not return after a successful transfer. A negated
* errno value is returned if initialization or image validation fails.
*
****************************************************************************/
int stm32_xip_boot(int argc, char *argv[])
{
const struct xip_vector_s *vector =
(const struct xip_vector_s *)STM32_XIP_BASE;
int ret;
UNUSED(argc);
UNUSED(argv);
ret = stm32_xspi_flash_initialize();
if (ret == OK)
{
ret = xip_vector_valid(vector);
}
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: XIP boot failed: %d\n", ret);
return ret;
}
xip_jump(vector);
return -EIO;
}