init
This commit is contained in:
commit
2c2202e60d
2491 files changed
+1295990
No files matched your search
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,67 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : mx_extmem.h
|
||||
* @version : 1.0.0
|
||||
* @brief : Header for secure_manager_api.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MX_EXTMEM__H__
|
||||
#define __MX_EXTMEM__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32_extmem_conf.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
/* USER CODE END INCLUDE */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/*
|
||||
* -- Insert your variables declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN VARIABLES */
|
||||
|
||||
/* USER CODE END VARIABLES */
|
||||
|
||||
void MX_EXTMEM_MANAGER_Init(void);
|
||||
|
||||
/*
|
||||
* -- Insert functions declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN FD */
|
||||
|
||||
/* USER CODE END FD */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MX_EXTMEM__H__ */
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h7rsxx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define FRAME_RATE_Pin GPIO_PIN_3
|
||||
#define FRAME_RATE_GPIO_Port GPIOF
|
||||
#define RENDER_TIME_Pin GPIO_PIN_2
|
||||
#define RENDER_TIME_GPIO_Port GPIOF
|
||||
#define ADF1_CK_Pin GPIO_PIN_2
|
||||
#define ADF1_CK_GPIO_Port GPIOE
|
||||
#define MCU_ACTIVE_Pin GPIO_PIN_4
|
||||
#define MCU_ACTIVE_GPIO_Port GPIOF
|
||||
#define VSYNC_FREQ_Pin GPIO_PIN_1
|
||||
#define VSYNC_FREQ_GPIO_Port GPIOF
|
||||
#define LCD_EN_Pin GPIO_PIN_15
|
||||
#define LCD_EN_GPIO_Port GPIOE
|
||||
#define ADF1_D_Pin GPIO_PIN_6
|
||||
#define ADF1_D_GPIO_Port GPIOD
|
||||
#define TP_IRQ_Pin GPIO_PIN_3
|
||||
#define TP_IRQ_GPIO_Port GPIOE
|
||||
#define TP_IRQ_EXTI_IRQn EXTI3_IRQn
|
||||
#define LCD_BL_CTRL_Pin GPIO_PIN_15
|
||||
#define LCD_BL_CTRL_GPIO_Port GPIOG
|
||||
#define MIC_DET_Pin GPIO_PIN_1
|
||||
#define MIC_DET_GPIO_Port GPIOH
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
@@ -0,0 +1,118 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : stm32_extmem_conf.h
|
||||
* @version : 1.0.0
|
||||
* @brief : Header for extmem.c file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32_EXTMEM_CONF__H__
|
||||
#define __STM32_EXTMEM_CONF__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@brief management of the driver layer enable
|
||||
*/
|
||||
|
||||
#define EXTMEM_DRIVER_NOR_SFDP 1
|
||||
#define EXTMEM_DRIVER_PSRAM 1
|
||||
#define EXTMEM_DRIVER_SDCARD 0
|
||||
#define EXTMEM_DRIVER_USER 0
|
||||
|
||||
/*
|
||||
@brief management of the sal layer enable
|
||||
*/
|
||||
#define EXTMEM_SAL_XSPI 1
|
||||
#define EXTMEM_SAL_SD 0
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32h7rsxx_hal.h"
|
||||
#include "stm32_extmem.h"
|
||||
#include "stm32_extmem_type.h"
|
||||
#include "boot/stm32_boot_xip.h"
|
||||
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
|
||||
/* USER CODE END INCLUDE */
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
extern XSPI_HandleTypeDef hxspi2;
|
||||
extern XSPI_HandleTypeDef hxspi1;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup EXTMEM_CONF_Exported_constants EXTMEM_CONF exported constants
|
||||
* @{
|
||||
*/
|
||||
enum {
|
||||
EXTMEMORY_1 = 0, /*!< ID=0 for the first external memory */
|
||||
EXTMEMORY_2 = 1, /*!< ID=1 for the second external memory */
|
||||
};
|
||||
|
||||
/*
|
||||
@brief management of the boot layer
|
||||
*/
|
||||
#define EXTMEM_MEMORY_BOOTXIP EXTMEMORY_1
|
||||
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported configuration --------------------------------------------------------*/
|
||||
/** @defgroup EXTMEM_CONF_Exported_configuration EXTMEM_CONF exported configuration definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern EXTMEM_DefinitionTypeDef extmem_list_config[2];
|
||||
#if defined(EXTMEM_C)
|
||||
EXTMEM_DefinitionTypeDef extmem_list_config[2];
|
||||
#endif /* EXTMEM_C */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/*
|
||||
* -- Insert your variables declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN VARIABLES */
|
||||
|
||||
/* USER CODE END VARIABLES */
|
||||
|
||||
/*
|
||||
* -- Insert functions declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN FD */
|
||||
|
||||
/* USER CODE END FD */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32_EXTMEM_CONF__H__ */
|
||||
@@ -0,0 +1,520 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7rsxx_hal_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief HAL configuration template file.
|
||||
* This file should be copied to the application folder and renamed
|
||||
* to stm32h7rsxx_hal_conf.h.
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2022 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32H7RSxx_HAL_CONF_H
|
||||
#define STM32H7RSxx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#define HAL_MODULE_ENABLED
|
||||
/* #define HAL_ADC_MODULE_ENABLED */
|
||||
/* #define HAL_CEC_MODULE_ENABLED */
|
||||
/* #define HAL_CORDIC_MODULE_ENABLED */
|
||||
/* #define HAL_CRC_MODULE_ENABLED */
|
||||
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||
/* #define HAL_DCMIPP_MODULE_ENABLED */
|
||||
/* #define HAL_DMA2D_MODULE_ENABLED */
|
||||
/* #define HAL_DTS_MODULE_ENABLED */
|
||||
/* #define HAL_ETH_MODULE_ENABLED */
|
||||
/* #define HAL_FDCAN_MODULE_ENABLED */
|
||||
/* #define HAL_GFXMMU_MODULE_ENABLED */
|
||||
/* #define HAL_GFXTIM_MODULE_ENABLED */
|
||||
/* #define HAL_GPU2D_MODULE_ENABLED */
|
||||
/* #define HAL_HASH_MODULE_ENABLED */
|
||||
/* #define HAL_HCD_MODULE_ENABLED */
|
||||
/* #define HAL_I2C_MODULE_ENABLED */
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
/* #define HAL_I3C_MODULE_ENABLED */
|
||||
/* #define HAL_ICACHE_MODULE_ENABLED */
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_JPEG_MODULE_ENABLED */
|
||||
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||
/* #define HAL_MCE_MODULE_ENABLED */
|
||||
/* #define HAL_MDF_MODULE_ENABLED */
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_NAND_MODULE_ENABLED */
|
||||
/* #define HAL_NOR_MODULE_ENABLED */
|
||||
/* #define HAL_PCD_MODULE_ENABLED */
|
||||
/* #define HAL_PKA_MODULE_ENABLED */
|
||||
/* #define HAL_PSSI_MODULE_ENABLED */
|
||||
/* #define HAL_RAMECC_MODULE_ENABLED */
|
||||
/* #define HAL_RCC_MODULE_ENABLED */
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
/* #define HAL_SDIO_MODULE_ENABLED */
|
||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_SRAM_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
/* #define HAL_UART_MODULE_ENABLED */
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
#define HAL_XSPI_MODULE_ENABLED
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_EXTI_MODULE_ENABLED
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE 24000000UL /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT 100UL /*!< Time out for HSE start up (in ms) */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE 64000000UL /*!< Value of the Internal oscillator in Hz */
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal Low-power oscillator (CSI) default value.
|
||||
* This value is the default CSI range value after Reset.
|
||||
*/
|
||||
#if !defined (CSI_VALUE)
|
||||
#define CSI_VALUE 4000000UL /*!< Value of the Internal oscillator in Hz */
|
||||
#endif /* CSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI48) value for USB OTG FS and RNG.
|
||||
* This internal oscillator is mainly dedicated to provide a high precision clock to
|
||||
* the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
|
||||
* When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
|
||||
* which is subject to manufacturing process variations.
|
||||
*/
|
||||
#if !defined (HSI48_VALUE)
|
||||
#define HSI48_VALUE 48000000UL /*!< Value of the Internal High Speed oscillator for USB OTG FS/RNG in Hz.
|
||||
The real value my vary depending on manufacturing process variations. */
|
||||
#endif /* HSI48_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal Low Speed oscillator (LSI) value.
|
||||
*/
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE 32000UL /*!< LSI Typical Value in Hz.
|
||||
Value of the Internal Low Speed oscillator in Hz.
|
||||
The real value may vary depending on the variations
|
||||
in voltage and temperature.*/
|
||||
#endif /* LSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE 32768UL /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT 5000UL /*!< Time out for LSE start up (in ms) */
|
||||
#endif /* LSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief External clock source for digital audio interfaces: SPI/I2S, SAI and ADF
|
||||
* This value is used by the RCC HAL module to provide the digital audio interfaces
|
||||
* frequency. This clock source is inserted directly through I2S_CKIN pad.
|
||||
*/
|
||||
#if !defined (EXTERNAL_CLOCK_VALUE)
|
||||
#define EXTERNAL_CLOCK_VALUE 48000UL /*!< Value of the external clock source in Hz */
|
||||
#endif /* EXTERNAL_CLOCK_VALUE */
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE 3300UL /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY (15UL)/*!< tick interrupt priority (lowest by default) */
|
||||
#define USE_RTOS 0U
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
||||
/* ################## Register callback feature configuration ############### */
|
||||
/**
|
||||
* @brief Set below the peripheral configuration to "1U" to add the support
|
||||
* of HAL callback registration/unregistration feature for the HAL
|
||||
* driver(s). This allows user application to provide specific callback
|
||||
* functions thanks to HAL_PPP_RegisterCallback() rather than overwriting
|
||||
* the default weak callback functions (see each stm32h7rsxx_hal_ppp.h file
|
||||
* for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef
|
||||
* for each PPP peripheral).
|
||||
*/
|
||||
#define USE_HAL_ADC_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_CORDIC_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_DCMIPP_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_HASH_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_I2C_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_I2S_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_MDF_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_PKA_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_PSSI_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_RNG_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SAI_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_SD_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SDIO_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 1U
|
||||
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U
|
||||
#define USE_HAL_XSPI_REGISTER_CALLBACKS 1U
|
||||
|
||||
/* ################## SPI peripheral configuration ########################## */
|
||||
|
||||
/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
|
||||
* Activated: CRC code is present inside driver
|
||||
* Deactivated: CRC code cleaned from driver
|
||||
*/
|
||||
|
||||
#define USE_SPI_CRC 1U
|
||||
|
||||
/* ################## CRYP peripheral configuration ########################## */
|
||||
|
||||
/**
|
||||
* @brief For code optimization purpose, uncomment and set to "1U" the USE_HAL_CRYP_ONLY or USE_HAL_SAES_ONLY,
|
||||
* to use only one peripheral. Both defines cannot be set to "1U" at the same time.
|
||||
*/
|
||||
|
||||
/* #define USE_HAL_CRYP_ONLY 1U */
|
||||
/* #define USE_HAL_SAES_ONLY 0U */
|
||||
|
||||
#define USE_HAL_CRYP_SUSPEND_RESUME 0U
|
||||
|
||||
/* ################## HASH peripheral configuration ########################## */
|
||||
|
||||
#define USE_HAL_HASH_SUSPEND_RESUME 0U
|
||||
|
||||
/* ################## SDMMC peripheral configuration ######################### */
|
||||
|
||||
#define USE_SD_TRANSCEIVER 0U
|
||||
|
||||
/* ################## SDIO peripheral configuration ######################### */
|
||||
|
||||
#define USE_SDIO_TRANSCEIVER 0U
|
||||
#define SDIO_MAX_IO_NUMBER 7U
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_adc.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_cec.h"
|
||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORDIC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_cordic.h"
|
||||
#endif /* HAL_CORDIC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DCMIPP_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_dcmipp.h"
|
||||
#endif /* HAL_DCMIPP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_dma2d.h"
|
||||
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DTS_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_dts.h"
|
||||
#endif /* HAL_DTS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ETH_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_eth.h"
|
||||
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_fdcan.h"
|
||||
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GFXMMU_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_gfxmmu.h"
|
||||
#endif /* HAL_GFXMMU_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GFXTIM_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_gfxtim.h"
|
||||
#endif /* HAL_GFXTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPU2D_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_gpu2d.h"
|
||||
#endif /* HAL_GPU2D_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HASH_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_hash.h"
|
||||
#endif /* HAL_HASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HCD_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_hcd.h"
|
||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I3C_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_i3c.h"
|
||||
#endif /* HAL_I3C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ICACHE_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_icache.h"
|
||||
#endif /* HAL_ICACHE_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_JPEG_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_jpeg.h"
|
||||
#endif /* HAL_JPEG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LTDC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_ltdc.h"
|
||||
#endif /* HAL_LTDC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_lptim.h"
|
||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MCE_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_mce.h"
|
||||
#endif /* HAL_MCE_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MDF_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_mdf.h"
|
||||
#endif /* HAL_MDF_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MMC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_mmc.h"
|
||||
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NAND_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_nand.h"
|
||||
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NOR_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_nor.h"
|
||||
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_pcd.h"
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PKA_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_pka.h"
|
||||
#endif /* HAL_PKA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PSSI_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_pssi.h"
|
||||
#endif /* HAL_PSSI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RAMECC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_ramecc.h"
|
||||
#endif /* HAL_RAMECC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RNG_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_rng.h"
|
||||
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SAI_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_sai.h"
|
||||
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SD_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_sd.h"
|
||||
#endif /* HAL_SD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SDIO_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_sdio.h"
|
||||
#endif /* HAL_SDIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_sdram.h"
|
||||
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_smbus.h"
|
||||
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_spdifrx.h"
|
||||
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_sram.h"
|
||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_XSPI_MODULE_ENABLED
|
||||
#include "stm32h7rsxx_hal_xspi.h"
|
||||
#endif /* HAL_XSPI_MODULE_ENABLED */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t *file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32H7RSxx_HAL_CONF_H */
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7rsxx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32H7RSxx_IT_H
|
||||
#define __STM32H7RSxx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32H7RSxx_IT_H */
|
||||
@@ -0,0 +1,104 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : mx_extmem.c
|
||||
* @version : 1.0.0
|
||||
* @brief : This file implements the extmem configuration
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "extmem_manager.h"
|
||||
#include <string.h>
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* USER CODE BEGIN PFP */
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/*
|
||||
* -- Insert your variables declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/*
|
||||
* -- Insert your external function declaration here --
|
||||
*/
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/**
|
||||
* Init External memory manager
|
||||
* @retval None
|
||||
*/
|
||||
void MX_EXTMEM_MANAGER_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN MX_EXTMEM_Init_PreTreatment */
|
||||
|
||||
/* USER CODE END MX_EXTMEM_Init_PreTreatment */
|
||||
HAL_RCCEx_EnableClockProtection(RCC_CLOCKPROTECT_XSPI);
|
||||
|
||||
/* Initialization of the memory parameters */
|
||||
memset(extmem_list_config, 0x0, sizeof(extmem_list_config));
|
||||
|
||||
/* EXTMEMORY_1 */
|
||||
extmem_list_config[0].MemType = EXTMEM_NOR_SFDP;
|
||||
extmem_list_config[0].Handle = (void*)&hxspi2;
|
||||
extmem_list_config[0].ConfigType = EXTMEM_LINK_CONFIG_8LINES;
|
||||
|
||||
/* EXTMEMORY_2 */
|
||||
extmem_list_config[1].MemType = EXTMEM_PSRAM;
|
||||
extmem_list_config[1].Handle = (void*)&hxspi1;
|
||||
extmem_list_config[1].ConfigType = EXTMEM_LINK_CONFIG_16LINES;
|
||||
|
||||
extmem_list_config[1].PsramObject.psram_public.MemorySize = HAL_XSPI_SIZE_256MB;
|
||||
extmem_list_config[1].PsramObject.psram_public.FreqMax = 133 * 1000000u;
|
||||
extmem_list_config[1].PsramObject.psram_public.NumberOfConfig = 1u;
|
||||
|
||||
/* Config */
|
||||
extmem_list_config[1].PsramObject.psram_public.config[0].WriteMask = 0x40u;
|
||||
extmem_list_config[1].PsramObject.psram_public.config[0].WriteValue = 0x40u;
|
||||
extmem_list_config[1].PsramObject.psram_public.config[0].REGAddress = 0x08u;
|
||||
|
||||
/* Memory command configuration */
|
||||
extmem_list_config[1].PsramObject.psram_public.ReadREG = 0x40u;
|
||||
extmem_list_config[1].PsramObject.psram_public.WriteREG = 0xC0u;
|
||||
extmem_list_config[1].PsramObject.psram_public.ReadREGSize = 2u;
|
||||
extmem_list_config[1].PsramObject.psram_public.REG_DummyCycle = 4u;
|
||||
extmem_list_config[1].PsramObject.psram_public.Write_command = 0xA0u;
|
||||
extmem_list_config[1].PsramObject.psram_public.Write_DummyCycle = 4u;
|
||||
extmem_list_config[1].PsramObject.psram_public.Read_command = 0x20u;
|
||||
extmem_list_config[1].PsramObject.psram_public.WrapRead_command = 0x00u;
|
||||
extmem_list_config[1].PsramObject.psram_public.Read_DummyCycle = 4u;
|
||||
|
||||
EXTMEM_Init(EXTMEMORY_1, HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_XSPI2));
|
||||
EXTMEM_Init(EXTMEMORY_2, HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_XSPI1));
|
||||
|
||||
/* USER CODE BEGIN MX_EXTMEM_Init_PostTreatment */
|
||||
|
||||
/* USER CODE END MX_EXTMEM_Init_PostTreatment */
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.c
|
||||
* @brief : Main program body
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "extmem_manager.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
|
||||
/* USER CODE END PTD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
XSPI_HandleTypeDef hxspi1;
|
||||
XSPI_HandleTypeDef hxspi2;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void SystemClock_Config(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_HPDMA1_Init(void);
|
||||
static void MX_GPDMA1_Init(void);
|
||||
static void MX_XSPI1_Init(void);
|
||||
static void MX_XSPI2_Init(void);
|
||||
static void MX_FLASH_Init(void);
|
||||
static void MX_SBS_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* Enable the CPU Cache */
|
||||
|
||||
/* Enable I-Cache---------------------------------------------------------*/
|
||||
SCB_EnableICache();
|
||||
|
||||
/* Enable D-Cache---------------------------------------------------------*/
|
||||
SCB_EnableDCache();
|
||||
|
||||
/* MCU Configuration--------------------------------------------------------*/
|
||||
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||
HAL_Init();
|
||||
|
||||
/* USER CODE BEGIN Init */
|
||||
|
||||
/* USER CODE END Init */
|
||||
|
||||
/* Configure the system clock */
|
||||
SystemClock_Config();
|
||||
|
||||
/* USER CODE BEGIN SysInit */
|
||||
|
||||
/* USER CODE END SysInit */
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_HPDMA1_Init();
|
||||
MX_GPDMA1_Init();
|
||||
MX_XSPI1_Init();
|
||||
MX_XSPI2_Init();
|
||||
MX_FLASH_Init();
|
||||
MX_SBS_Init();
|
||||
MX_EXTMEM_MANAGER_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Launch the application */
|
||||
if (BOOT_OK != BOOT_Application())
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief System Clock Configuration
|
||||
* @retval None
|
||||
*/
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure LSE Drive Capability
|
||||
*/
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
|
||||
RCC_OscInitStruct.PLL1.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL1.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL1.PLLM = 4;
|
||||
RCC_OscInitStruct.PLL1.PLLN = 200;
|
||||
RCC_OscInitStruct.PLL1.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL1.PLLQ = 2;
|
||||
RCC_OscInitStruct.PLL1.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL1.PLLS = 2;
|
||||
RCC_OscInitStruct.PLL1.PLLT = 2;
|
||||
RCC_OscInitStruct.PLL1.PLLFractional = 0;
|
||||
RCC_OscInitStruct.PLL2.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL2.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL2.PLLM = 5;
|
||||
RCC_OscInitStruct.PLL2.PLLN = 128;
|
||||
RCC_OscInitStruct.PLL2.PLLP = 25;
|
||||
RCC_OscInitStruct.PLL2.PLLQ = 10;
|
||||
RCC_OscInitStruct.PLL2.PLLR = 2;
|
||||
RCC_OscInitStruct.PLL2.PLLS = 2;
|
||||
RCC_OscInitStruct.PLL2.PLLT = 2;
|
||||
RCC_OscInitStruct.PLL2.PLLFractional = 0;
|
||||
RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL3.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL3.PLLM = 2;
|
||||
RCC_OscInitStruct.PLL3.PLLN = 50;
|
||||
RCC_OscInitStruct.PLL3.PLLP = 2;
|
||||
RCC_OscInitStruct.PLL3.PLLQ = 2;
|
||||
RCC_OscInitStruct.PLL3.PLLR = 24;
|
||||
RCC_OscInitStruct.PLL3.PLLS = 2;
|
||||
RCC_OscInitStruct.PLL3.PLLT = 2;
|
||||
RCC_OscInitStruct.PLL3.PLLFractional = 0;
|
||||
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|
||||
|RCC_CLOCKTYPE_PCLK4|RCC_CLOCKTYPE_PCLK5;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
||||
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
|
||||
RCC_ClkInitStruct.APB5CLKDivider = RCC_APB5_DIV2;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FLASH Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_FLASH_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN FLASH_Init 0 */
|
||||
|
||||
/* USER CODE END FLASH_Init 0 */
|
||||
|
||||
FLASH_OBProgramInitTypeDef pOBInit = {0};
|
||||
|
||||
/* USER CODE BEGIN FLASH_Init 1 */
|
||||
|
||||
/* USER CODE END FLASH_Init 1 */
|
||||
HAL_FLASHEx_OBGetConfig(&pOBInit);
|
||||
if ((pOBInit.USERConfig1 & OB_IWDG_SW) != OB_IWDG_SW||
|
||||
(pOBInit.USERConfig1 & OB_XSPI1_HSLV_ENABLE) != OB_XSPI1_HSLV_ENABLE||
|
||||
(pOBInit.USERConfig1 & OB_XSPI2_HSLV_ENABLE) != OB_XSPI2_HSLV_ENABLE||
|
||||
(pOBInit.USERConfig2 & OB_I2C_NI3C_I2C) != OB_I2C_NI3C_I2C)
|
||||
{
|
||||
if (HAL_FLASH_Unlock() != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_FLASH_OB_Unlock() != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
pOBInit.OptionType = OPTIONBYTE_USER;
|
||||
pOBInit.USERType = OB_USER_IWDG_SW|OB_USER_XSPI1_HSLV
|
||||
|OB_USER_XSPI2_HSLV|OB_USER_I2C_NI3C;
|
||||
pOBInit.USERConfig1 = OB_IWDG_SW|OB_XSPI1_HSLV_ENABLE
|
||||
|OB_XSPI2_HSLV_ENABLE;
|
||||
pOBInit.USERConfig2 = OB_I2C_NI3C_I2C;
|
||||
if (HAL_FLASHEx_OBProgram(&pOBInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_FLASH_OB_Lock() != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_FLASH_Lock() != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
/* USER CODE BEGIN FLASH_Init 2 */
|
||||
|
||||
/* USER CODE END FLASH_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPDMA1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_GPDMA1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN GPDMA1_Init 0 */
|
||||
|
||||
/* USER CODE END GPDMA1_Init 0 */
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_GPDMA1_CLK_ENABLE();
|
||||
|
||||
/* USER CODE BEGIN GPDMA1_Init 1 */
|
||||
|
||||
/* USER CODE END GPDMA1_Init 1 */
|
||||
/* USER CODE BEGIN GPDMA1_Init 2 */
|
||||
|
||||
/* USER CODE END GPDMA1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HPDMA1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_HPDMA1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN HPDMA1_Init 0 */
|
||||
|
||||
/* USER CODE END HPDMA1_Init 0 */
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_HPDMA1_CLK_ENABLE();
|
||||
|
||||
/* USER CODE BEGIN HPDMA1_Init 1 */
|
||||
|
||||
/* USER CODE END HPDMA1_Init 1 */
|
||||
/* USER CODE BEGIN HPDMA1_Init 2 */
|
||||
|
||||
/* USER CODE END HPDMA1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SBS Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_SBS_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN SBS_Init 0 */
|
||||
|
||||
/* USER CODE END SBS_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN SBS_Init 1 */
|
||||
|
||||
/* USER CODE END SBS_Init 1 */
|
||||
/* USER CODE BEGIN SBS_Init 2 */
|
||||
|
||||
/* USER CODE END SBS_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XSPI1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_XSPI1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN XSPI1_Init 0 */
|
||||
|
||||
/* USER CODE END XSPI1_Init 0 */
|
||||
|
||||
XSPIM_CfgTypeDef sXspiManagerCfg = {0};
|
||||
|
||||
/* USER CODE BEGIN XSPI1_Init 1 */
|
||||
|
||||
/* USER CODE END XSPI1_Init 1 */
|
||||
/* XSPI1 parameter configuration*/
|
||||
hxspi1.Instance = XSPI1;
|
||||
hxspi1.Init.FifoThresholdByte = 2;
|
||||
hxspi1.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;
|
||||
hxspi1.Init.MemoryType = HAL_XSPI_MEMTYPE_APMEM_16BITS;
|
||||
hxspi1.Init.MemorySize = HAL_XSPI_SIZE_256MB;
|
||||
hxspi1.Init.ChipSelectHighTimeCycle = 5;
|
||||
hxspi1.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;
|
||||
hxspi1.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;
|
||||
hxspi1.Init.WrapSize = HAL_XSPI_WRAP_32_BYTES;
|
||||
hxspi1.Init.ClockPrescaler = 0;
|
||||
hxspi1.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_NONE;
|
||||
hxspi1.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_16KB;
|
||||
hxspi1.Init.MaxTran = 0;
|
||||
hxspi1.Init.Refresh = 400;
|
||||
hxspi1.Init.MemorySelect = HAL_XSPI_CSSEL_NCS1;
|
||||
if (HAL_XSPI_Init(&hxspi1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sXspiManagerCfg.nCSOverride = HAL_XSPI_CSSEL_OVR_NCS1;
|
||||
sXspiManagerCfg.IOPort = HAL_XSPIM_IOPORT_1;
|
||||
sXspiManagerCfg.Req2AckTime = 1;
|
||||
if (HAL_XSPIM_Config(&hxspi1, &sXspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN XSPI1_Init 2 */
|
||||
|
||||
/* USER CODE END XSPI1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XSPI2 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_XSPI2_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN XSPI2_Init 0 */
|
||||
|
||||
/* USER CODE END XSPI2_Init 0 */
|
||||
|
||||
XSPIM_CfgTypeDef sXspiManagerCfg = {0};
|
||||
|
||||
/* USER CODE BEGIN XSPI2_Init 1 */
|
||||
|
||||
/* USER CODE END XSPI2_Init 1 */
|
||||
/* XSPI2 parameter configuration*/
|
||||
hxspi2.Instance = XSPI2;
|
||||
hxspi2.Init.FifoThresholdByte = 4;
|
||||
hxspi2.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;
|
||||
hxspi2.Init.MemoryType = HAL_XSPI_MEMTYPE_MACRONIX;
|
||||
hxspi2.Init.MemorySize = HAL_XSPI_SIZE_1GB;
|
||||
hxspi2.Init.ChipSelectHighTimeCycle = 2;
|
||||
hxspi2.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;
|
||||
hxspi2.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;
|
||||
hxspi2.Init.WrapSize = HAL_XSPI_WRAP_NOT_SUPPORTED;
|
||||
hxspi2.Init.ClockPrescaler = 0;
|
||||
hxspi2.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_NONE;
|
||||
hxspi2.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_NONE;
|
||||
hxspi2.Init.MaxTran = 0;
|
||||
hxspi2.Init.Refresh = 0;
|
||||
hxspi2.Init.MemorySelect = HAL_XSPI_CSSEL_NCS1;
|
||||
if (HAL_XSPI_Init(&hxspi2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sXspiManagerCfg.nCSOverride = HAL_XSPI_CSSEL_OVR_NCS1;
|
||||
sXspiManagerCfg.IOPort = HAL_XSPIM_IOPORT_2;
|
||||
sXspiManagerCfg.Req2AckTime = 1;
|
||||
if (HAL_XSPIM_Config(&hxspi2, &sXspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN XSPI2_Init 2 */
|
||||
|
||||
/* USER CODE END XSPI2_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_GPIO_Init(void)
|
||||
{
|
||||
/* USER CODE BEGIN MX_GPIO_Init_1 */
|
||||
/* USER CODE END MX_GPIO_Init_1 */
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPION_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOO_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOP_CLK_ENABLE();
|
||||
|
||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||
/* USER CODE END MX_GPIO_Init_2 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
||||
/**
|
||||
* @brief This function is executed in case of error occurrence.
|
||||
* @retval None
|
||||
*/
|
||||
void Error_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END Error_Handler_Debug */
|
||||
}
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief Reports the name of the source file and the source line number
|
||||
* where the assert_param error has occurred.
|
||||
* @param file: pointer to the source file name
|
||||
* @param line: assert_param error line source number
|
||||
* @retval None
|
||||
*/
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
/* USER CODE BEGIN 6 */
|
||||
/* User can add his own implementation to report the file name and line number,
|
||||
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
/* USER CODE END 6 */
|
||||
}
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
@@ -0,0 +1,316 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7rsxx_hal_msp.c
|
||||
* @brief This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* External functions --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ExternalFunctions */
|
||||
|
||||
/* USER CODE END ExternalFunctions */
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
{
|
||||
|
||||
/* Configure the system Power Supply */
|
||||
|
||||
if (HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY) != HAL_OK)
|
||||
{
|
||||
/* Initialization error */
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN MspInit 0 */
|
||||
|
||||
/* USER CODE END MspInit 0 */
|
||||
|
||||
__HAL_RCC_SBS_CLK_ENABLE();
|
||||
|
||||
/* System interrupt init*/
|
||||
|
||||
/* Enable the XSPIM_P1 interface */
|
||||
HAL_PWREx_EnableXSPIM1();
|
||||
|
||||
/* Enable the XSPIM_P2 interface */
|
||||
HAL_PWREx_EnableXSPIM2();
|
||||
|
||||
/* USER CODE BEGIN MspInit 1 */
|
||||
/* high speed low voltage config */
|
||||
HAL_SBS_EnableIOSpeedOptimize(SBS_IO_XSPI1_HSLV);
|
||||
HAL_SBS_EnableIOSpeedOptimize(SBS_IO_XSPI2_HSLV);
|
||||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
static uint32_t HAL_RCC_XSPIM_CLK_ENABLED=0;
|
||||
|
||||
/**
|
||||
* @brief XSPI MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hxspi: XSPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_XSPI_MspInit(XSPI_HandleTypeDef* hxspi)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||
if(hxspi->Instance==XSPI1)
|
||||
{
|
||||
/* USER CODE BEGIN XSPI1_MspInit 0 */
|
||||
|
||||
/* USER CODE END XSPI1_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_XSPI1;
|
||||
PeriphClkInit.Xspi1ClockSelection = RCC_XSPI1CLKSOURCE_PLL2S;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
HAL_RCC_XSPIM_CLK_ENABLED++;
|
||||
if(HAL_RCC_XSPIM_CLK_ENABLED==1){
|
||||
__HAL_RCC_XSPIM_CLK_ENABLE();
|
||||
}
|
||||
__HAL_RCC_XSPI1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOO_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOP_CLK_ENABLE();
|
||||
/**XSPI1 GPIO Configuration
|
||||
PO3 ------> XSPIM_P1_DQS1
|
||||
PP10 ------> XSPIM_P1_IO10
|
||||
PP12 ------> XSPIM_P1_IO12
|
||||
PP14 ------> XSPIM_P1_IO14
|
||||
PP2 ------> XSPIM_P1_IO2
|
||||
PP5 ------> XSPIM_P1_IO5
|
||||
PO2 ------> XSPIM_P1_DQS0
|
||||
PP1 ------> XSPIM_P1_IO1
|
||||
PP11 ------> XSPIM_P1_IO11
|
||||
PP15 ------> XSPIM_P1_IO15
|
||||
PP3 ------> XSPIM_P1_IO3
|
||||
PP0 ------> XSPIM_P1_IO0
|
||||
PP7 ------> XSPIM_P1_IO7
|
||||
PP8 ------> XSPIM_P1_IO8
|
||||
PP13 ------> XSPIM_P1_IO13
|
||||
PP4 ------> XSPIM_P1_IO4
|
||||
PO4 ------> XSPIM_P1_CLK
|
||||
PP6 ------> XSPIM_P1_IO6
|
||||
PO0 ------> XSPIM_P1_NCS1
|
||||
PP9 ------> XSPIM_P1_IO9
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_XSPIM_P1;
|
||||
HAL_GPIO_Init(GPIOO, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_2
|
||||
|GPIO_PIN_5|GPIO_PIN_1|GPIO_PIN_11|GPIO_PIN_15
|
||||
|GPIO_PIN_3|GPIO_PIN_0|GPIO_PIN_7|GPIO_PIN_8
|
||||
|GPIO_PIN_13|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_XSPIM_P1;
|
||||
HAL_GPIO_Init(GPIOP, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN XSPI1_MspInit 1 */
|
||||
|
||||
/* USER CODE END XSPI1_MspInit 1 */
|
||||
}
|
||||
else if(hxspi->Instance==XSPI2)
|
||||
{
|
||||
/* USER CODE BEGIN XSPI2_MspInit 0 */
|
||||
|
||||
/* USER CODE END XSPI2_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_XSPI2;
|
||||
PeriphClkInit.Xspi2ClockSelection = RCC_XSPI2CLKSOURCE_PLL2S;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
HAL_RCC_XSPIM_CLK_ENABLED++;
|
||||
if(HAL_RCC_XSPIM_CLK_ENABLED==1){
|
||||
__HAL_RCC_XSPIM_CLK_ENABLE();
|
||||
}
|
||||
__HAL_RCC_XSPI2_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPION_CLK_ENABLE();
|
||||
/**XSPI2 GPIO Configuration
|
||||
PN1 ------> XSPIM_P2_NCS1
|
||||
PN3 ------> XSPIM_P2_IO1
|
||||
PN0 ------> XSPIM_P2_DQS0
|
||||
PN11 ------> XSPIM_P2_IO7
|
||||
PN10 ------> XSPIM_P2_IO6
|
||||
PN9 ------> XSPIM_P2_IO5
|
||||
PN2 ------> XSPIM_P2_IO0
|
||||
PN6 ------> XSPIM_P2_CLK
|
||||
PN8 ------> XSPIM_P2_IO4
|
||||
PN4 ------> XSPIM_P2_IO2
|
||||
PN5 ------> XSPIM_P2_IO3
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_0|GPIO_PIN_11
|
||||
|GPIO_PIN_10|GPIO_PIN_9|GPIO_PIN_2|GPIO_PIN_6
|
||||
|GPIO_PIN_8|GPIO_PIN_4|GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_XSPIM_P2;
|
||||
HAL_GPIO_Init(GPION, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN XSPI2_MspInit 1 */
|
||||
|
||||
/* USER CODE END XSPI2_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XSPI MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hxspi: XSPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_XSPI_MspDeInit(XSPI_HandleTypeDef* hxspi)
|
||||
{
|
||||
if(hxspi->Instance==XSPI1)
|
||||
{
|
||||
/* USER CODE BEGIN XSPI1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END XSPI1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
HAL_RCC_XSPIM_CLK_ENABLED--;
|
||||
if(HAL_RCC_XSPIM_CLK_ENABLED==0){
|
||||
__HAL_RCC_XSPIM_CLK_DISABLE();
|
||||
}
|
||||
__HAL_RCC_XSPI1_CLK_DISABLE();
|
||||
|
||||
/**XSPI1 GPIO Configuration
|
||||
PO3 ------> XSPIM_P1_DQS1
|
||||
PP10 ------> XSPIM_P1_IO10
|
||||
PP12 ------> XSPIM_P1_IO12
|
||||
PP14 ------> XSPIM_P1_IO14
|
||||
PP2 ------> XSPIM_P1_IO2
|
||||
PP5 ------> XSPIM_P1_IO5
|
||||
PO2 ------> XSPIM_P1_DQS0
|
||||
PP1 ------> XSPIM_P1_IO1
|
||||
PP11 ------> XSPIM_P1_IO11
|
||||
PP15 ------> XSPIM_P1_IO15
|
||||
PP3 ------> XSPIM_P1_IO3
|
||||
PP0 ------> XSPIM_P1_IO0
|
||||
PP7 ------> XSPIM_P1_IO7
|
||||
PP8 ------> XSPIM_P1_IO8
|
||||
PP13 ------> XSPIM_P1_IO13
|
||||
PP4 ------> XSPIM_P1_IO4
|
||||
PO4 ------> XSPIM_P1_CLK
|
||||
PP6 ------> XSPIM_P1_IO6
|
||||
PO0 ------> XSPIM_P1_NCS1
|
||||
PP9 ------> XSPIM_P1_IO9
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOO, GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_0);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOP, GPIO_PIN_10|GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_2
|
||||
|GPIO_PIN_5|GPIO_PIN_1|GPIO_PIN_11|GPIO_PIN_15
|
||||
|GPIO_PIN_3|GPIO_PIN_0|GPIO_PIN_7|GPIO_PIN_8
|
||||
|GPIO_PIN_13|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9);
|
||||
|
||||
/* USER CODE BEGIN XSPI1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END XSPI1_MspDeInit 1 */
|
||||
}
|
||||
else if(hxspi->Instance==XSPI2)
|
||||
{
|
||||
/* USER CODE BEGIN XSPI2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END XSPI2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
HAL_RCC_XSPIM_CLK_ENABLED--;
|
||||
if(HAL_RCC_XSPIM_CLK_ENABLED==0){
|
||||
__HAL_RCC_XSPIM_CLK_DISABLE();
|
||||
}
|
||||
__HAL_RCC_XSPI2_CLK_DISABLE();
|
||||
|
||||
/**XSPI2 GPIO Configuration
|
||||
PN1 ------> XSPIM_P2_NCS1
|
||||
PN3 ------> XSPIM_P2_IO1
|
||||
PN0 ------> XSPIM_P2_DQS0
|
||||
PN11 ------> XSPIM_P2_IO7
|
||||
PN10 ------> XSPIM_P2_IO6
|
||||
PN9 ------> XSPIM_P2_IO5
|
||||
PN2 ------> XSPIM_P2_IO0
|
||||
PN6 ------> XSPIM_P2_CLK
|
||||
PN8 ------> XSPIM_P2_IO4
|
||||
PN4 ------> XSPIM_P2_IO2
|
||||
PN5 ------> XSPIM_P2_IO3
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPION, GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_0|GPIO_PIN_11
|
||||
|GPIO_PIN_10|GPIO_PIN_9|GPIO_PIN_2|GPIO_PIN_6
|
||||
|GPIO_PIN_8|GPIO_PIN_4|GPIO_PIN_5);
|
||||
|
||||
/* USER CODE BEGIN XSPI2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END XSPI2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -0,0 +1,203 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32h7rsxx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "stm32h7rsxx_it.h"
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
|
||||
/* USER CODE END TD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
|
||||
/* USER CODE END W1_HardFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory management fault.
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
|
||||
/* USER CODE END W1_MemoryManagement_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pre-fetch fault, memory access fault.
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
|
||||
/* USER CODE END W1_BusFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Undefined instruction or illegal state.
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
|
||||
/* USER CODE END W1_UsageFault_IRQn 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 0 */
|
||||
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug monitor.
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Pendable request for system service.
|
||||
*/
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN PendSV_IRQn 0 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 0 */
|
||||
/* USER CODE BEGIN PendSV_IRQn 1 */
|
||||
|
||||
/* USER CODE END PendSV_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SysTick_IRQn 0 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 0 */
|
||||
HAL_IncTick();
|
||||
/* USER CODE BEGIN SysTick_IRQn 1 */
|
||||
|
||||
/* USER CODE END SysTick_IRQn 1 */
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32H7RSxx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file (startup_stm32h7rsxx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
@@ -0,0 +1,304 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32h7rsxx.c
|
||||
* @author MCD Application Team
|
||||
* @brief CMSIS Cortex-M7 Device Peripheral Access Layer System Source File
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2022 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* This file provides two functions and one global variable to be called from
|
||||
* user application:
|
||||
* - SystemInit(): This function is called at startup just after reset and
|
||||
* before branch to main program. This call is made inside
|
||||
* the "startup_stm32h7rsxx.s" file.
|
||||
*
|
||||
* - SystemCoreClock variable: Contains the core clock (sys_cpu_ck), it can
|
||||
* be used by the user application to setup the
|
||||
* SysTick timer or configure other parameters.
|
||||
*
|
||||
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||
* be called whenever the core clock is changed
|
||||
* during program execution.
|
||||
*
|
||||
* After each device reset the HSI (64 MHz) is used as system clock source.
|
||||
* Then SystemInit() function is called, in "startup_stm32h7rsxx.s" file, to
|
||||
* optionally configure the system clock before to branch to main program.
|
||||
*
|
||||
*=============================================================================
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "stm32h7rsxx.h"
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE 24000000UL /*!< Value of the High-Speed External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE 64000000UL /*!< Value of the High-Speed Internal oscillator in Hz */
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
#if !defined (CSI_VALUE)
|
||||
#define CSI_VALUE 4000000UL /*!< Value of the Low-power Internal oscillator in Hz */
|
||||
#endif /* CSI_VALUE */
|
||||
|
||||
/* Note: Following vector table addresses must be defined in line with linker
|
||||
configuration. */
|
||||
/*!< Uncomment the following line or define USER_VECT_TAB_ADDRESS at compiler level if you need
|
||||
to relocate the vector table anywhere in Flash or Sram, else the vector table is kept at
|
||||
the automatic remap of the selected boot address */
|
||||
/* #define USER_VECT_TAB_ADDRESS */
|
||||
|
||||
#if defined(USER_VECT_TAB_ADDRESS)
|
||||
/*!< Uncomment the following line or define VECT_TAB_SRAM at compiler level if you need
|
||||
to relocate your vector Table in Sram else user remap will be done in Flash. */
|
||||
/* #define VECT_TAB_SRAM */
|
||||
|
||||
#if defined(VECT_TAB_SRAM)
|
||||
#if !defined(VECT_TAB_BASE_ADDRESS)
|
||||
#define VECT_TAB_BASE_ADDRESS ITCM_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x400. */
|
||||
#endif
|
||||
#if !defined(VECT_TAB_OFFSET)
|
||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x400. */
|
||||
#endif
|
||||
#else
|
||||
#if !defined(VECT_TAB_BASE_ADDRESS)
|
||||
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
|
||||
This value must be a multiple of 0x400. */
|
||||
#endif
|
||||
#if !defined(VECT_TAB_OFFSET)
|
||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x400. */
|
||||
#endif
|
||||
#endif /* VECT_TAB_SRAM */
|
||||
#endif /* USER_VECT_TAB_ADDRESS */
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
/* The SystemCoreClock variable is updated in two ways:
|
||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||
2) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
Note: If you use this function to configure the system clock; then there
|
||||
is no need to call the first function listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
uint32_t SystemCoreClock = HSI_VALUE;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32H7RSxx_System_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Setup the microcontroller system.
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
/* Configure the Vector Table location -------------------------------------*/
|
||||
#if defined(USER_VECT_TAB_ADDRESS)
|
||||
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
|
||||
#endif
|
||||
|
||||
/* FPU settings ------------------------------------------------------------*/
|
||||
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||
SCB->CPACR |= ((3UL << 20U)|(3UL << 22U)); /* set CP10 and CP11 Full Access */
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update SystemCoreClock variable according to RCC registers values.
|
||||
* The SystemCoreClock variable contains the core clock (sys_cpu_ck), it can
|
||||
* be used by the user application to setup the SysTick timer or configure
|
||||
* other parameters.
|
||||
*
|
||||
* @note Each time the core clock changes, this function must be called
|
||||
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||
* based on this variable will be incorrect.
|
||||
*
|
||||
* @note - The system frequency computed by this function is not the real
|
||||
* frequency in the chip. It is calculated based on the predefined
|
||||
* constant and the selected clock source:
|
||||
*
|
||||
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
|
||||
*
|
||||
* - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(**)
|
||||
*
|
||||
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
|
||||
*
|
||||
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSI_VALUE(*)
|
||||
* or CSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
|
||||
*
|
||||
* (*) HSI_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||
* 64 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (**) CSI_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||
* 4 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (***) HSE_VALUE is a constant defined in stm32h7rsxx_hal.h file (default value
|
||||
* 24 MHz), user has to ensure that HSE_VALUE is same as the real
|
||||
* frequency of the crystal used. Otherwise, this function may
|
||||
* have wrong result.
|
||||
*
|
||||
* - The result of this function could be not correct when using fractional
|
||||
* value for HSE crystal.
|
||||
*
|
||||
* @retval None
|
||||
*/
|
||||
void SystemCoreClockUpdate(void)
|
||||
{
|
||||
uint32_t sysclk, hsivalue, pllsource, pllm, pllp, core_presc;
|
||||
float_t pllfracn, pllvco;
|
||||
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
switch (RCC->CFGR & RCC_CFGR_SWS)
|
||||
{
|
||||
case 0x00: /* HSI used as system clock source (default after reset) */
|
||||
sysclk = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||
break;
|
||||
|
||||
case 0x08: /* CSI used as system clock source */
|
||||
sysclk = CSI_VALUE;
|
||||
break;
|
||||
|
||||
case 0x10: /* HSE used as system clock source */
|
||||
sysclk = HSE_VALUE;
|
||||
break;
|
||||
|
||||
case 0x18: /* PLL1 used as system clock source */
|
||||
/* PLL1_VCO = (HSE_VALUE or HSI_VALUE or CSI_VALUE/ PLLM) * PLLN
|
||||
SYSCLK = PLL1_VCO / PLL1R
|
||||
*/
|
||||
pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
|
||||
pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1) >> RCC_PLLCKSELR_DIVM1_Pos) ;
|
||||
if ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN) != 0U)
|
||||
{
|
||||
pllfracn = (float_t)(uint32_t)(((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN)>> RCC_PLL1FRACR_FRACN_Pos));
|
||||
}
|
||||
else
|
||||
{
|
||||
pllfracn = (float_t)0U;
|
||||
}
|
||||
|
||||
if (pllm != 0U)
|
||||
{
|
||||
switch (pllsource)
|
||||
{
|
||||
case 0x02: /* HSE used as PLL1 clock source */
|
||||
pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||
break;
|
||||
|
||||
case 0x01: /* CSI used as PLL1 clock source */
|
||||
pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||
break;
|
||||
|
||||
case 0x00: /* HSI used as PLL1 clock source */
|
||||
default:
|
||||
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||
pllvco = ( (float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVN) + (pllfracn/(float_t)0x2000) +(float_t)1 );
|
||||
break;
|
||||
}
|
||||
pllp = (((RCC->PLL1DIVR1 & RCC_PLL1DIVR1_DIVP) >> RCC_PLL1DIVR1_DIVP_Pos) + 1U ) ;
|
||||
sysclk = (uint32_t)(float_t)(pllvco/(float_t)pllp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sysclk = 0U;
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Unexpected, default to HSI used as system clock source (default after reset) */
|
||||
sysclk = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> RCC_CR_HSIDIV_Pos));
|
||||
break;
|
||||
}
|
||||
|
||||
/* system clock frequency : CM7 CPU frequency */
|
||||
core_presc = (RCC->CDCFGR & RCC_CDCFGR_CPRE);
|
||||
if (core_presc >= 8U)
|
||||
{
|
||||
SystemCoreClock = (sysclk >> (core_presc - RCC_CDCFGR_CPRE_3 + 1U));
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemCoreClock = sysclk;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
Reference in new issue
Block a user