Index: trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Inc/stm32n6xx_hal_ramcfg.h
===================================================================
--- trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Inc/stm32n6xx_hal_ramcfg.h	(revision 27)
+++ trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Inc/stm32n6xx_hal_ramcfg.h	(revision 27)
@@ -0,0 +1,396 @@
+/**
+  ******************************************************************************
+  * @file    stm32n6xx_hal_ramcfg.h
+  * @author  MCD Application Team
+  * @brief   Header file of RAMCFG HAL module.
+  ******************************************************************************
+  * @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.
+  *
+  ******************************************************************************
+  */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STM32N6xx_HAL_RAMCFG_H
+#define STM32N6xx_HAL_RAMCFG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32n6xx_hal_def.h"
+
+/** @addtogroup STM32N6xx_HAL_Driver
+  * @{
+  */
+
+/** @addtogroup RAMCFG
+  * @{
+  */
+
+
+/* Exported types ------------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Exported_Types RAMCFG Exported Types
+  * @brief    RAMCFG Exported Types
+  * @{
+  */
+
+/**
+  * @brief  HAL RAMCFG State Enumeration Definition
+  */
+typedef enum
+{
+  HAL_RAMCFG_STATE_RESET             = 0x00U,  /*!< RAMCFG not yet initialized or disabled */
+  HAL_RAMCFG_STATE_READY             = 0x01U,  /*!< RAMCFG initialized and ready for use   */
+  HAL_RAMCFG_STATE_BUSY              = 0x02U,  /*!< RAMCFG process is ongoing              */
+  HAL_RAMCFG_STATE_ERROR             = 0x03U,  /*!< RAMCFG error state                     */
+} HAL_RAMCFG_StateTypeDef;
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+/**
+  * @brief  HAL RAMCFG Callbacks IDs Enumeration Definition
+  */
+typedef enum
+{
+  HAL_RAMCFG_MSPINIT_CB_ID           = 0x00U,  /*!< RAMCFG MSP Init Callback ID            */
+  HAL_RAMCFG_MSPDEINIT_CB_ID         = 0x01U,  /*!< RAMCFG MSP DeInit Callback ID          */
+  HAL_RAMCFG_SE_DETECT_CB_ID         = 0x02U,  /*!< RAMCFG Single Error Detect Callback ID */
+  HAL_RAMCFG_DE_DETECT_CB_ID         = 0x03U,  /*!< RAMCFG Double Error Detect Callback ID */
+  HAL_RAMCFG_ALL_CB_ID               = 0x04U,  /*!< RAMCFG All callback ID                 */
+} HAL_RAMCFG_CallbackIDTypeDef;
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+
+/**
+  * @brief  RAMCFG Handle Structure Definition
+  */
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+typedef struct __RAMCFG_HandleTypeDef
+#else
+typedef struct
+#endif /* (USE_HAL_RAMCFG_REGISTER_CALLBACKS) */
+{
+  RAMCFG_TypeDef                  *Instance;                                 /*!< RAMCFG Register Base Address        */
+  __IO HAL_RAMCFG_StateTypeDef    State;                                     /*!< RAMCFG State                        */
+  __IO uint32_t                   ErrorCode;                                 /*!< RAMCFG Error Code                   */
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+  void (* MspInitCallback)(struct __RAMCFG_HandleTypeDef *hramcfg);          /*!< RAMCFG MSP Init Callback            */
+  void (* MspDeInitCallback)(struct __RAMCFG_HandleTypeDef *hramcfg);        /*!< RAMCFG MSP DeInit Callback          */
+  void (* DetectSingleErrorCallback)(struct __RAMCFG_HandleTypeDef *hramcfg);/*!< RAMCFG Single Error Detect Callback */
+  void (* DetectDoubleErrorCallback)(struct __RAMCFG_HandleTypeDef *hramcfg);/*!< RAMCFG Double Error Detect Callback */
+#endif  /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+} RAMCFG_HandleTypeDef;
+
+/**
+  * @}
+  */
+
+
+/* Exported constants --------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Exported_Constants RAMCFG Exported Constants
+  * @brief    RAMCFG Exported Constants
+  * @{
+  */
+
+/** @defgroup RAMCFG_Error_Codes RAMCFG Error Codes
+  * @brief    RAMCFG Error Codes
+  * @{
+  */
+#define HAL_RAMCFG_ERROR_NONE             0x00000000U  /*!< RAMCFG No Error         */
+#define HAL_RAMCFG_ERROR_TIMEOUT          0x00000001U  /*!< RAMCFG Timeout Error    */
+#define HAL_RAMCFG_ERROR_BUSY             0x00000002U  /*!< RAMCFG Busy Error       */
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+#define HAL_RAMCFG_ERROR_INVALID_CALLBACK 0x00000003U  /*!< Invalid Callback error  */
+#endif  /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Interrupt RAMCFG Interrupts
+  * @brief    RAMCFG Interrupts
+  * @{
+  */
+#define RAMCFG_IT_SINGLEERR   RAMCFG_IER_SEIE           /*!< RAMCFG Single Error Interrupt                   */
+#define RAMCFG_IT_DOUBLEERR   RAMCFG_IER_DEIE           /*!< RAMCFG Double Error Interrupt                   */
+#define RAMCFG_IT_ALL \
+  (RAMCFG_IER_SEIE | RAMCFG_IER_DEIE)                     /*!<RAMCFG All RAMCFG interrupt                      */
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_FLAG RAMCFG Monitor Flags
+  * @brief    RAMCFG Monitor Flags
+  * @{
+  */
+#define RAMCFG_FLAG_SINGLEERR   RAMCFG_ISR_SEDC            /*!< RAMCFG Single Error Detected and Corrected Flag */
+#define RAMCFG_FLAG_DOUBLEERR   RAMCFG_ISR_DED             /*!< RAMCFG Double Error Detected Flag               */
+#define RAMCFG_FLAG_SRAMBUSY    RAMCFG_ISR_SRAMBUSY        /*!< RAMCFG SRAM busy Flag                           */
+#define RAMCFG_FLAGS_ALL \
+  (RAMCFG_ISR_SEDC | RAMCFG_ISR_DED  | RAMCFG_ISR_SRAMBUSY)  /*!< RAMCFG All Flags                                */
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Keys RAMCFG Keys
+  * @brief    RAMCFG Keys
+  * @{
+  */
+#define RAMCFG_ERASE_KEY1  (0xCAU) /*!< RAMCFG launch Erase Key 1 */
+#define RAMCFG_ERASE_KEY2  (0x53U) /*!< RAMCFG launch Erase Key 2 */
+
+#define RAMCFG_ECC_KEY1    (0xAEU) /*!< RAMCFG launch ECC Key 1 */
+#define RAMCFG_ECC_KEY2    (0x75U) /*!< RAMCFG launch ECC Key 2 */
+/**
+  * @}
+  */
+/** @defgroup RAMCFG_AXISRAM_PowerDown RAMCFG SRAM Power Down
+  * @{
+  */
+#define RAMCFG_AXISRAM_POWERDOWN       RAMCFG_CR_SRAMSD                         /*!< AXISRAM power down */
+/**
+  * @}
+  */
+/**
+  * @}
+  */
+
+
+/* Exported macro ------------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Exported_Macros RAMCFG Exported Macros
+  * @brief    RAMCFG Exported Macros
+  * @{
+  */
+
+/**
+  * @brief  Enable the specified RAMCFG interrupts.
+  * @param  __HANDLE__   : Specifies RAMCFG handle.
+  * @param  __INTERRUPT__: Specifies the RAMCFG interrupt sources to be enabled.
+  *         This parameter can be one of the following values:
+  *           @arg RAMCFG_IT_SINGLEERR    : Single Error Interrupt Mask.
+  *           @arg RAMCFG_IT_DOUBLEERR    : Double Error Interrupt Mask.
+  *           @arg RAMCFG_IT_NMIERR       : Double Error Interrupt redirection to NMI Mask.
+  *           @arg RAMCFG_IT_ALL          : All Interrupt Mask.
+  * @retval None
+  */
+#define __HAL_RAMCFG_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
+  ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
+
+/**
+  * @brief  Disable the specified RAMCFG interrupts.
+  * @note   This macros is used only to disable RAMCFG_IT_SINGLEERR and RAMCFG_IT_DOUBLEERR
+  *         interrupts. RAMCFG_IT_NMIERR interrupt can only be disabled by global  peripheral reset or system reset.
+  * @param  __HANDLE__   : Specifies RAMCFG handle.
+  * @param  __INTERRUPT__: Specifies the RAMCFG interrupt sources to be disabled.
+  *         This parameter can be one of the following values:
+  *           @arg RAMCFG_IT_SINGLEERR    : Single Error Interrupt Mask.
+  *           @arg RAMCFG_IT_DOUBLEERR    : Double Error Interrupt Mask.
+  * @retval None
+  */
+#define __HAL_RAMCFG_DISABLE_IT(__HANDLE__, __INTERRUPT__) \
+  ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
+
+/**
+  * @brief  Check whether the specified RAMCFG interrupt source is enabled or not.
+  * @param  __HANDLE__    : Specifies the RAMCFG Handle.
+  * @param  __INTERRUPT__ : Specifies the RAMCFG interrupt source to check.
+  *          This parameter can be one of the following values:
+  *           @arg RAMCFG_IT_SINGLEERR    : Single Error Interrupt Mask.
+  *           @arg RAMCFG_IT_DOUBLEERR    : Double Error Interrupt Mask.
+  *           @arg RAMCFG_IT_NMIERR       : Double Error Interrupt Redirection to NMI Mask.
+  * @retval The new state of __INTERRUPT__ (SET or RESET).
+  */
+#define __HAL_RAMCFG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
+  ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? 1U : 0U)
+
+/**
+  * @brief  Get the RAMCFG pending flags.
+  * @param  __HANDLE__   : Specifies RAMCFG handle.
+  * @param  __FLAG__     : Specifies the flag to be checked.
+  *         This parameter can be one of the following values:
+  *            @arg RAMCFG_FLAG_SINGLEERR  : Single Error Detected and Corrected Flag.
+  *            @arg RAMCFG_FLAG_DOUBLEERR  : Double Error Detected Flag.
+  *            @arg RAMCFG_FLAG_SRAMBUSY   : SRAM Busy Flag.
+  * @retval The state of FLAG (SET or RESET).
+  */
+#define __HAL_RAMCFG_GET_FLAG(__HANDLE__, __FLAG__) \
+  (READ_BIT((__HANDLE__)->Instance->ISR, (__FLAG__)) == (__FLAG__))
+
+/**
+  * @brief  Clear the RAMCFG pending flags.
+  * @param  __HANDLE__   : Specifies RAMCFG handle.
+  * @param  __FLAG__     : Specifies the flag to be cleared.
+  *          This parameter can be any combination of the following values:
+  *            @arg RAMCFG_FLAG_SINGLEERR  : Single Error Detected and Corrected Flag.
+  *            @arg RAMCFG_FLAG_DOUBLEERR  : Double Error Detected Flag.
+  * @retval None.
+  */
+#define __HAL_RAMCFG_CLEAR_FLAG(__HANDLE__, __FLAG__) \
+  ((__HANDLE__)->Instance->ICR |= (__FLAG__))
+
+/** @brief  Reset the RAMCFG handle state.
+  * @param  __HANDLE__    : Specifies the RAMCFG Handle.
+  * @retval None.
+  */
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+#define __HAL_RAMCFG_RESET_HANDLE_STATE(__HANDLE__) \
+  do{\
+    (__HANDLE__)->State = HAL_RAMCFG_STATE_RESET; \
+    (__HANDLE__)->MspInitCallback   = NULL;       \
+    (__HANDLE__)->MspDeInitCallback = NULL;       \
+  }while(0)
+#else
+#define __HAL_RAMCFG_RESET_HANDLE_STATE(__HANDLE__) \
+  do{\
+    (__HANDLE__)->State = HAL_RAMCFG_STATE_RESET; \
+  }while(0)
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+
+/**
+  * @}
+  */
+
+/* Exported functions --------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Exported_Functions RAMCFG Exported Functions
+  * @brief    RAMCFG Exported Functions
+  * @{
+  */
+
+/** @defgroup RAMCFG_Exported_Functions_Group1 Initialization and De-Initialization Functions
+  * @brief    Initialization and De-Initialization Functions
+  * @{
+  */
+HAL_StatusTypeDef HAL_RAMCFG_Init(RAMCFG_HandleTypeDef *hramcfg);
+HAL_StatusTypeDef HAL_RAMCFG_DeInit(RAMCFG_HandleTypeDef *hramcfg);
+void HAL_RAMCFG_MspInit(RAMCFG_HandleTypeDef *hramcfg);
+void HAL_RAMCFG_MspDeInit(RAMCFG_HandleTypeDef *hramcfg);
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Exported_Functions_Group2 ECC Operation Functions
+  * @brief    ECC Operation Functions
+  * @{
+  */
+HAL_StatusTypeDef HAL_RAMCFG_StartECC(RAMCFG_HandleTypeDef *hramcfg);
+HAL_StatusTypeDef HAL_RAMCFG_StopECC(RAMCFG_HandleTypeDef *hramcfg);
+HAL_StatusTypeDef HAL_RAMCFG_EnableNotification(RAMCFG_HandleTypeDef *hramcfg, uint32_t Notifications);
+HAL_StatusTypeDef HAL_RAMCFG_DisableNotification(RAMCFG_HandleTypeDef *hramcfg, uint32_t Notifications);
+uint32_t HAL_RAMCFG_IsECCSingleErrorDetected(const RAMCFG_HandleTypeDef *hramcfg);
+uint32_t HAL_RAMCFG_IsECCDoubleErrorDetected(const RAMCFG_HandleTypeDef *hramcfg);
+uint32_t HAL_RAMCFG_GetSingleErrorAddress(const RAMCFG_HandleTypeDef *hramcfg);
+uint32_t HAL_RAMCFG_GetDoubleErrorAddress(const RAMCFG_HandleTypeDef *hramcfg);
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Exported_Functions_Group5 Erase Operation Functions
+  * @brief    Erase Operation Functions
+  * @{
+  */
+HAL_StatusTypeDef HAL_RAMCFG_Erase(RAMCFG_HandleTypeDef *hramcfg);
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Exported_Functions_Group6 Handle Interrupt and Callbacks Functions
+  * @brief    Handle Interrupt and Callbacks Functions
+  * @{
+  */
+void              HAL_RAMCFG_IRQHandler(RAMCFG_HandleTypeDef *hramcfg);
+void              HAL_RAMCFG_DetectSingleErrorCallback(RAMCFG_HandleTypeDef *hramcfg);
+void              HAL_RAMCFG_DetectDoubleErrorCallback(RAMCFG_HandleTypeDef *hramcfg);
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+HAL_StatusTypeDef HAL_RAMCFG_RegisterCallback(RAMCFG_HandleTypeDef *hramcfg,
+                                              HAL_RAMCFG_CallbackIDTypeDef CallbackID,
+                                              void (* pCallback)(RAMCFG_HandleTypeDef *_hramcfg));
+HAL_StatusTypeDef HAL_RAMCFG_UnRegisterCallback(RAMCFG_HandleTypeDef *hramcfg, HAL_RAMCFG_CallbackIDTypeDef CallbackID);
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+/**
+  * @}
+  */
+
+/** @defgroup RAMCFG_Exported_Functions_Group7 State and Error Functions
+  * @brief    State and Error Functions
+  * @{
+  */
+uint32_t HAL_RAMCFG_GetError(const RAMCFG_HandleTypeDef *hramcfg);
+HAL_RAMCFG_StateTypeDef HAL_RAMCFG_GetState(const RAMCFG_HandleTypeDef *hramcfg);
+/**
+  * @}
+  */
+
+
+/** @defgroup RAMCFG_Exported_Functions_Group9 AXISRAM Powerdown Functions
+  * @brief    AXISRAM Powerdown Functions
+  * @{
+  */
+void HAL_RAMCFG_EnableAXISRAM(const RAMCFG_HandleTypeDef *hramcfg);
+void HAL_RAMCFG_DisableAXISRAM(const RAMCFG_HandleTypeDef *hramcfg);
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+
+/* Private Constants ---------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Private_Constants RAMCFG Private Defines and Constants
+  * @brief    RAMCFG Private Defines and Constants
+  * @{
+  */
+/**
+  * @}
+  */
+
+
+/* Private macros ------------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Private_Macros RAMCFG Private Macros
+  * @brief    RAMCFG Private Macros
+  * @{
+  */
+#define IS_RAMCFG_INTERRUPT(INTERRUPT) \
+  (((INTERRUPT) != 0U) && (((INTERRUPT) & ~(RAMCFG_IT_SINGLEERR | RAMCFG_IT_DOUBLEERR)) == 0U))
+
+
+/**
+  * @}
+  */
+
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup RAMCFG_Private_Functions RAMCFG Private Functions
+  * @brief    RAMCFG Private Functions
+  * @{
+  */
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STM32N6xx_HAL_RAMCFG_H */
Index: trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_hal_ramcfg.c
===================================================================
--- trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_hal_ramcfg.c	(revision 27)
+++ trunk/firmware/FSBL/CubeMX/Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_hal_ramcfg.c	(revision 27)
@@ -0,0 +1,1072 @@
+/**
+  ******************************************************************************
+  * @file    stm32n6xx_hal_ramcfg.c
+  * @author  GPM Application Team
+  * @brief   RAMCFG HAL module driver.
+  *          This file provides firmware functions to manage the following
+  *          functionalities of the RAMs configuration controller peripheral:
+  *           + RAMCFG Initialization and De-initialization Functions.
+  *           + RAMCFG ECC Operation Functions.
+  *           + RAMCFG Erase Operation Functions.
+  *           + RAMCFG Handle Interrupt and Callbacks Functions.
+  *           + RAMCFG State and Error Functions.
+  ******************************************************************************
+  * @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.
+  *
+  ******************************************************************************
+  @verbatim
+  ==============================================================================
+                    ##### RAMCFG Peripheral features #####
+  ==============================================================================
+  [..]
+    (+) Each SRAM is managed by a RAMCFG instance (AHBSRAM1/2, AXISRAM1 to 6,
+        BKPSRAM, FLEXRAM, and VENCRAM).
+
+    (+) Each SRAM can be erased independently through its RAMCFG instance.
+
+    (+) AXISRAM 1 to 6 are the main SRAMs. AHBSRAM1/2 are preferably for DMA-controlled
+        peripheral-to-memory data flow.
+        AXISRAM 2 to 6 can be shut down when the application is in Run mode.
+
+    (+) FLEXMEM can be either allocated as Cortex-M55 TCM, or as system RAM
+        (FLEXRAM).
+        80 Kbytes of the FLEXMEM are retained in Standby mode, either allocated as
+        extended ITCM (64 +16-Kbyte ECC), or allocated as FLEXRAM.
+
+    (+) The BKPSRAM content is retained in low-power modes, even when VDD is off
+        in VBAT mode. On a tamper event detection, the BKPSRAM content is erased.
+
+    (+) The VENCRAM implements hardware and software erases.
+
+    (+) FLEXRAM and BKPRAM support ECC correction feature:
+             (++) Single error detection and correction with interrupt generation.
+             (++) Double error detection with interrupt generation.
+             (++) Status with failing address
+  ==============================================================================
+                        ##### How to use this driver #####
+  ==============================================================================
+  [..]
+    (#) Call HAL_RAMCFG_Init() to initialize the RAMCFG peripheral before using
+       any feature. Call HAL_RAMCFG_DeInit() to de-initialize the RAMCFG when
+       using this peripheral is no more needed or a hardware issue has occurred.
+          (+) HAL_RAMCFG_Init() and HAL_RAMCFG_DeInit() APIs do not change the
+              activation status of ECC feature. It is managed by
+              HAL_RAMCFG_StartECC(), HAL_RAMCFG_StopECC() or option bytes (When
+              available on the device).
+
+     *** ECC feature ***
+     ===================
+    [..]
+          (+) Call HAL_RAMCFG_StartECC() and HAL_RAMCFG_StopECC() to enable and
+              disable ECC hardware mechanism.
+                    (++) When ECC feature is previously enabled (case of option
+                         byte activation), calling HAL_RAMCFG_StartECC() is
+                         recommended to enable the ECC address latching feature.
+
+          (+) Call HAL_RAMCFG_EnableNotification() and HAL_RAMCFG_DisableNotification()
+              to enable and disable ECC interrupts. Interrupts can be:
+                    (++) Single error interrupt.
+                    (++) Double error interrupt.
+                    (++) Double error interrupt redirected to Non maskable
+                          interrupt (NMI).
+
+          (+) Call HAL_RAMCFG_GetSingleErrorAddress() to get the address of the
+              last fail RAM word detected (only for single error) and
+              call HAL_RAMCFG_GetDoubleErrorAddress() to get the address of the
+              last fail RAM word detected (only for double error).
+
+          (+) Call HAL_RAMCFG_IsECCSingleErrorDetected() to check if an ECC single
+              error was detected.
+              Call HAL_RAMCFG_IsECCDoubleErrorDetected() to check if an ECC double
+              error was detected.
+              These APIs are used in silent mode (No ECC interrupt
+              is enabled).
+
+     *** Erase feature ***
+     =====================
+    [..]
+          (+) Call HAL_RAMCFG_Erase() to launch a hardware erase for the given
+              SRAM.
+
+          (+) The erase value is equal to 0 when launching erase hardware through
+              RAMCFG.
+
+          (+) SRAM2 write protected pages are erased when performing an erase
+              through RAMCFG.
+
+     *** RAMCFG HAL driver macros list ***
+     =====================================
+     [..]
+       Below the list of used macros in RAMCFG HAL driver.
+
+      (+) __HAL_RAMCFG_ENABLE_IT     : Enable the specified RAMCFG interrupts.
+      (+) __HAL_RAMCFG_DISABLE_IT    : Disable the specified RAMCFG interrupts.
+      (+) __HAL_RAMCFG_GET_FLAG      : Get the RAMCFG pending flags.
+      (+) __HAL_RAMCFG_CLEAR_FLAG    : Clear the RAMCFG pending flags.
+      (+) __HAL_RAMCFG_GET_IT_SOURCE : Check whether the specified RAMCFG
+                                       interrupt source is enabled or not.
+  @endverbatim
+  */
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32n6xx_hal.h"
+
+/** @addtogroup STM32N6xx_HAL_Driver
+  * @{
+  */
+
+/** @defgroup RAMCFG RAMCFG
+  * @brief RAMCFG HAL module driver
+  * @{
+  */
+
+#ifdef HAL_RAMCFG_MODULE_ENABLED
+
+/* Private types -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private constants ---------------------------------------------------------*/
+
+/** @addtogroup RAMCFG_Private_Constants
+  * @{
+  */
+#define RAMCFG_TIMEOUT_VALUE 50000U
+/**
+  * @}
+  */
+
+/* Private macros ------------------------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+/* Exported functions --------------------------------------------------------*/
+
+/** @addtogroup RAMCFG_Exported_Functions
+  * @{
+  */
+
+/** @addtogroup RAMCFG_Exported_Functions_Group1
+  *
+@verbatim
+ ===============================================================================
+             ##### Initialization and de-initialization Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions allowing to initialize and de-initialize the
+      RAMCFG instance.
+    [..]
+      The HAL_RAMCFG_Init() function follows the RAMCFG instance configuration
+      procedures as described in the reference manual.
+      The HAL_RAMCFG_DeInit() function allows to deinitialize the RAMCFG instance.
+      HAL_RAMCFG_Init() and HAL_RAMCFG_DeInit() APIs do not change the activation
+      status of ECC feature. It is managed by HAL_RAMCFG_StartECC(),
+      HAL_RAMCFG_StopECC() or option bytes (When available on the device).
+
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Initialize the RAMCFG by clearing flags and disabling interrupts.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG
+  *                   instance.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_Init(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the RAMCFG peripheral handle */
+  if (hramcfg == NULL)
+  {
+    return HAL_ERROR;
+  }
+
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Update RAMCFG peripheral state */
+  hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+  /* Check if a valid MSP API was registered */
+  if (hramcfg->MspInitCallback == NULL)
+  {
+    /* Init the low level hardware */
+    hramcfg->MspInitCallback = HAL_RAMCFG_MspInit;
+  }
+
+  /* Init the low level hardware */
+  hramcfg->MspInitCallback(hramcfg);
+#else
+  HAL_RAMCFG_MspInit(hramcfg);
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+
+  /* Disable the ECC Address latch */
+  hramcfg->Instance->CR &= ~(RAMCFG_CR_ALE);
+
+  /* Disable all RAMCFG interrupts */
+  __HAL_RAMCFG_DISABLE_IT(hramcfg, RAMCFG_IT_ALL);
+
+  /* Clear RAMCFG monitor flags */
+  __HAL_RAMCFG_CLEAR_FLAG(hramcfg, RAMCFG_FLAGS_ALL);
+
+  /* Initialize the RAMCFG error code */
+  hramcfg->ErrorCode = HAL_RAMCFG_ERROR_NONE;
+
+  /* Initialize the RAMCFG state */
+  hramcfg->State = HAL_RAMCFG_STATE_READY;
+
+  return HAL_OK;
+}
+
+/**
+  * @brief  DeInitialize the RAMCFG peripheral.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG
+  *                   instance.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_DeInit(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the RAMCFG peripheral handle */
+  if (hramcfg == NULL)
+  {
+    return HAL_ERROR;
+  }
+
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Disable the ECC Address latch */
+  hramcfg->Instance->CR &= ~(RAMCFG_CR_ALE);
+
+  /* Disable all RAMCFG interrupts */
+  __HAL_RAMCFG_DISABLE_IT(hramcfg, RAMCFG_IT_ALL);
+
+  /* Clear RAMCFG monitor flags */
+  __HAL_RAMCFG_CLEAR_FLAG(hramcfg, RAMCFG_FLAGS_ALL);
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+  /* Check if a valid MSP API was registered */
+  if (hramcfg->MspDeInitCallback != NULL)
+  {
+    /* Init the low level hardware */
+    hramcfg->MspDeInitCallback(hramcfg);
+  }
+
+  /* Clean callbacks */
+  hramcfg->DetectSingleErrorCallback = NULL;
+  hramcfg->DetectDoubleErrorCallback = NULL;
+#else
+  HAL_RAMCFG_MspDeInit(hramcfg);
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+
+  /* Reset the RAMCFG error code */
+  hramcfg->ErrorCode = HAL_RAMCFG_ERROR_NONE;
+
+  /* Reset the RAMCFG state */
+  hramcfg->State = HAL_RAMCFG_STATE_RESET;
+
+  return HAL_OK;
+}
+
+/**
+  * @brief Initialize the RAMCFG MSP.
+  * @param hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                  the configuration information for the specified RAMCFG.
+  * @retval None.
+  */
+__weak void HAL_RAMCFG_MspInit(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Prevent unused argument(s) compilation warning */
+  UNUSED(hramcfg);
+
+  /* NOTE : This function should not be modified, when the callback is needed,
+            the HAL_RAMCFG_MspInit can be implemented in the user file      */
+}
+
+/**
+  * @brief DeInitialize the RAMCFG MSP.
+  * @param hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                  the configuration information for the specified RAMCFG.
+  * @retval None.
+  */
+__weak void HAL_RAMCFG_MspDeInit(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Prevent unused argument(s) compilation warning */
+  UNUSED(hramcfg);
+
+  /* NOTE : This function should not be modified, when the callback is needed,
+            the HAL_RAMCFG_MspDeInit can be implemented in the user file    */
+}
+/**
+  * @}
+  */
+
+/** @addtogroup RAMCFG_Exported_Functions_Group2
+  *
+@verbatim
+ ===============================================================================
+                      ##### ECC Operations Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions allowing to manage ECC feature provided by
+      the RAMCFG peripheral.
+    [..]
+      The HAL_RAMCFG_StartECC() function allows starting the ECC mechanism and
+      enabling ECC address latching for the selected RAMCFG instance.
+      The HAL_RAMCFG_StopECC() function allows stopping the ECC mechanism and
+      disabling ECC address latching for the selected RAMCFG instance.
+      The HAL_RAMCFG_EnableNotification() function allows enabling interrupts
+      for single ECC error, double ECC error and NMI error.
+      The HAL_RAMCFG_DisableNotification() function allows disabling interrupts
+      for single ECC error, double ECC error. When NMI interrupt is enabled it
+      can only be disabled by a global peripheral reset or by a system reset.
+      The HAL_RAMCFG_IsECCSingleErrorDetected() function allows to check if an
+      single ECC error has occurred.
+      The HAL_RAMCFG_IsECCDoubleErrorDetected() function allows to check if an
+      double ECC error has occurred.
+      The HAL_RAMCFG_GetSingleErrorAddress() function allows to get the address of
+      the last single ECC error detected.
+      The HAL_RAMCFG_GetDoubleErrorAddress() function allows to get the address of
+      the last double ECC error detected.
+
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Start ECC mechanism for the given SRAM.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG
+  *                   instance.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_StartECC(RAMCFG_HandleTypeDef *hramcfg)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    /* Update RAMCFG peripheral state */
+    hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+    /* Check if ECC mechanism is non active */
+    if ((hramcfg->Instance->CR & RAMCFG_CR_ECCE) != RAMCFG_CR_ECCE)
+    {
+      /* Start the SRAM ECC mechanism and latching the error address */
+      hramcfg->Instance->CR |= (RAMCFG_CR_ECCE | RAMCFG_CR_ALE);
+    }
+    else
+    {
+      /* Start latching the error address */
+      hramcfg->Instance->CR |= RAMCFG_CR_ALE;
+    }
+
+    /* Update the RAMCFG state */
+    hramcfg->State = HAL_RAMCFG_STATE_READY;
+  }
+  else
+  {
+    /* Update the RAMCFG error code and return error  */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_BUSY;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @brief  Stop ECC mechanism for the given SRAM.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG
+  *                   instance.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_StopECC(RAMCFG_HandleTypeDef *hramcfg)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    /* Update RAMCFG peripheral state */
+    hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+    /* Check if ECC mechanism is active */
+    if ((hramcfg->Instance->CR & RAMCFG_CR_ECCE) == RAMCFG_CR_ECCE)
+    {
+      /* Unlock the SRAM ECC bit */
+      WRITE_REG(hramcfg->Instance->ECCKEYR, RAMCFG_ECC_KEY1);
+      WRITE_REG(hramcfg->Instance->ECCKEYR, RAMCFG_ECC_KEY2);
+
+      /* Stop the SRAM ECC mechanism and latching the error address */
+      hramcfg->Instance->CR &= ~(RAMCFG_CR_ECCE | RAMCFG_CR_ALE);
+    }
+    /* Update the RAMCFG state */
+    hramcfg->State = HAL_RAMCFG_STATE_READY;
+  }
+  else
+  {
+    /* Update the RAMCFG error code and return error  */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_BUSY;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @brief  Enable the RAMCFG error interrupts.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @param  Notifications : Select the notification to be enabled.
+  *                         This parameter can be any value of @ref
+  *                         RAMCFG_Interrupt group.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_EnableNotification(RAMCFG_HandleTypeDef *hramcfg, uint32_t Notifications)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+  assert_param(IS_RAMCFG_INTERRUPT(Notifications));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    /* Update RAMCFG peripheral state */
+    hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+    /* Enable RAMCFG interrupts */
+    __HAL_RAMCFG_ENABLE_IT(hramcfg, Notifications);
+
+    /* Update the RAMCFG state */
+    hramcfg->State = HAL_RAMCFG_STATE_READY;
+
+  }
+  else
+  {
+    /* Update the RAMCFG error code and return error */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_BUSY;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @brief  Disable the RAMCFG error interrupts.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @param  Notifications : Select the notification to be disabled.
+  *                         This parameter can be :
+  *                         RAMCFG_IT_SINGLEERR : Single Error Interrupt.
+  *                         RAMCFG_IT_DOUBLEERR : Double Error Interrupt.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_DisableNotification(RAMCFG_HandleTypeDef *hramcfg, uint32_t Notifications)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+  assert_param(IS_RAMCFG_INTERRUPT(Notifications));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    /* Update RAMCFG peripheral state */
+    hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+    /* Disable RAMCFG interrupts */
+    __HAL_RAMCFG_DISABLE_IT(hramcfg, Notifications);
+
+    /* Update the RAMCFG state */
+    hramcfg->State = HAL_RAMCFG_STATE_READY;
+  }
+  else
+  {
+    /* Update the RAMCFG error code and return error */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_BUSY;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @brief  Check if an ECC single error has occurred.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval State of bit (1 or 0).
+  */
+uint32_t HAL_RAMCFG_IsECCSingleErrorDetected(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  /* Return the state of SEDC flag */
+  return ((READ_BIT(hramcfg->Instance->ISR, RAMCFG_FLAG_SINGLEERR) == (RAMCFG_FLAG_SINGLEERR)) ? 1UL : 0UL);
+}
+
+/**
+  * @brief  Check if an ECC double error was occurred.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval State of bit (1 or 0).
+  */
+uint32_t HAL_RAMCFG_IsECCDoubleErrorDetected(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  /* Return the state of DED flag */
+  return ((READ_BIT(hramcfg->Instance->ISR, RAMCFG_FLAG_DOUBLEERR) == (RAMCFG_FLAG_DOUBLEERR)) ? 1UL : 0UL);
+}
+
+/**
+  * @brief  Get the RAMCFG single error address.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval Single error address offset.
+  */
+uint32_t HAL_RAMCFG_GetSingleErrorAddress(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  return hramcfg->Instance->ESEAR;
+}
+
+/**
+  * @brief  Get the RAMCFG double error address.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval Double error address offset.
+  */
+uint32_t HAL_RAMCFG_GetDoubleErrorAddress(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ECC_INSTANCE(hramcfg->Instance));
+
+  return hramcfg->Instance->EDEAR;
+}
+
+/**
+  * @}
+  */
+
+/** @addtogroup RAMCFG_Exported_Functions_Group5
+  *
+@verbatim
+ ===============================================================================
+                      ##### Erase Operation Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions allowing a hardware erase for the given SRAM.
+    [..]
+      The HAL_RAMCFG_Erase() function allows a hardware mass erase for the given
+      SRAM. The erase value for all SRAMs is 0.
+
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Launch a Mass Erase for the given SRAM.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_Erase(RAMCFG_HandleTypeDef *hramcfg)
+{
+  uint32_t tickstart = HAL_GetTick();
+
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    /* Update RAMCFG peripheral state */
+    hramcfg->State = HAL_RAMCFG_STATE_BUSY;
+
+    /* Unlock the RAMCFG erase bit */
+    WRITE_REG(hramcfg->Instance->ERKEYR, RAMCFG_ERASE_KEY1);
+    WRITE_REG(hramcfg->Instance->ERKEYR, RAMCFG_ERASE_KEY2);
+
+    /* Start the SRAM erase operation */
+    hramcfg->Instance->CR |= RAMCFG_CR_SRAMER;
+
+    /*
+       Wait for the SRAM hardware erase operation to complete by polling on
+       SRAMBUSY flag to be reset.
+    */
+    while (__HAL_RAMCFG_GET_FLAG(hramcfg, RAMCFG_FLAG_SRAMBUSY) != 0U)
+    {
+      if ((HAL_GetTick() - tickstart) > RAMCFG_TIMEOUT_VALUE)
+      {
+        /* Update the RAMCFG error code */
+        hramcfg->ErrorCode = HAL_RAMCFG_ERROR_TIMEOUT;
+
+        /* Update the RAMCFG state and return error status */
+        hramcfg->State = HAL_RAMCFG_STATE_ERROR;
+        return HAL_ERROR;
+      }
+    }
+  }
+  else
+  {
+    /* Update the error code and return error status */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_BUSY;
+    return HAL_ERROR;
+  }
+
+  /* Update the RAMCFG state */
+  hramcfg->State = HAL_RAMCFG_STATE_READY;
+
+  return HAL_OK;
+}
+
+/**
+  * @}
+  */
+
+/** @addtogroup RAMCFG_Exported_Functions_Group6
+  *
+@verbatim
+ ===============================================================================
+               ##### Handle Interrupt and Callbacks Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions to handle RAMCFG interrupts and
+      Register / UnRegister the different callbacks.
+    [..]
+      The HAL_RAMCFG_IRQHandler() function allows the user to handle the active RAMCFG
+      interrupt request.
+      The HAL_RAMCFG_RegisterCallback() function allows the user to register the selected
+      RAMCFG callbacks.
+      The HAL_RAMCFG_UnRegisterCallback() function allows the user to unregister the
+      selected RAMCFG callbacks.
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Handles RAMCFG interrupt request.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval None.
+  */
+void HAL_RAMCFG_IRQHandler(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Single Error Interrupt Management ****************************************/
+  if (__HAL_RAMCFG_GET_IT_SOURCE(hramcfg, RAMCFG_IT_SINGLEERR) != 0U)
+  {
+    if (__HAL_RAMCFG_GET_FLAG(hramcfg, RAMCFG_FLAG_SINGLEERR) != 0U)
+    {
+      /* Clear active flags */
+      __HAL_RAMCFG_CLEAR_FLAG(hramcfg, RAMCFG_FLAG_SINGLEERR);
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+      /* Check if a valid single error callback is registered */
+      if (hramcfg->DetectSingleErrorCallback != NULL)
+      {
+        /* Single error detection callback */
+        hramcfg->DetectSingleErrorCallback(hramcfg);
+      }
+#else
+      HAL_RAMCFG_DetectSingleErrorCallback(hramcfg);
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+    }
+  }
+
+  /* Double Error Interrupt Management ****************************************/
+  if (__HAL_RAMCFG_GET_IT_SOURCE(hramcfg, RAMCFG_IT_DOUBLEERR) != 0U)
+  {
+    if (__HAL_RAMCFG_GET_FLAG(hramcfg, RAMCFG_FLAG_DOUBLEERR) != 0U)
+    {
+      /* Clear active flags */
+      __HAL_RAMCFG_CLEAR_FLAG(hramcfg, RAMCFG_FLAG_DOUBLEERR);
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+      /* Check if a valid double error callback is registered */
+      if (hramcfg->DetectDoubleErrorCallback != NULL)
+      {
+        /* Double error detection callback */
+        hramcfg->DetectDoubleErrorCallback(hramcfg);
+      }
+#else
+      HAL_RAMCFG_DetectDoubleErrorCallback(hramcfg);
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+    }
+  }
+}
+
+/**
+  * @brief  RAMCFG single error detection callback.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG.
+  * @retval None.
+  */
+__weak void HAL_RAMCFG_DetectSingleErrorCallback(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Prevent unused argument(s) compilation warning */
+  UNUSED(hramcfg);
+
+  /* NOTE : This function should not be modified, when the callback is needed,
+            the HAL_RAMCFG_DetectSingleErrorCallback can be implemented in
+            the user file.                                                    */
+}
+
+/**
+  * @brief  RAMCFG double error detection callback.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that contains
+  *                   the configuration information for the specified RAMCFG.
+  * @retval None.
+  */
+__weak void HAL_RAMCFG_DetectDoubleErrorCallback(RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Prevent unused argument(s) compilation warning */
+  UNUSED(hramcfg);
+
+  /* NOTE : This function should not be modified, when the callback is needed,
+            the HAL_RAMCFG_DetectDoubleErrorCallback can be implemented in
+            the user file.                                                    */
+}
+
+#if (USE_HAL_RAMCFG_REGISTER_CALLBACKS == 1)
+/**
+  * @brief  Register RAMCFG callbacks.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @param  CallbackID    : User Callback identifier a HAL_RAMCFG_CallbackIDTypeDef
+  *                         ENUM as parameter.
+  * @param  pCallback     : Pointer to private callback function.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_RegisterCallback(RAMCFG_HandleTypeDef *hramcfg,
+                                              HAL_RAMCFG_CallbackIDTypeDef CallbackID,
+                                              void (* pCallback)(RAMCFG_HandleTypeDef *_hramcfg))
+{
+  HAL_StatusTypeDef status = HAL_OK;
+
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  if (pCallback == NULL)
+  {
+    /* Update the error code and return error */
+    hramcfg->ErrorCode |= HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+    return HAL_ERROR;
+  }
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    switch (CallbackID)
+    {
+      case  HAL_RAMCFG_SE_DETECT_CB_ID:
+        /* Register single error callback */
+        hramcfg->DetectSingleErrorCallback = pCallback;
+        break;
+
+      case  HAL_RAMCFG_DE_DETECT_CB_ID:
+        /* Register double error callback */
+        hramcfg->DetectDoubleErrorCallback = pCallback;
+        break;
+
+      case HAL_RAMCFG_MSPINIT_CB_ID :
+        /* Register msp init callback */
+        hramcfg->MspInitCallback = pCallback;
+        break;
+
+      case HAL_RAMCFG_MSPDEINIT_CB_ID :
+        /* Register msp de-init callback */
+        hramcfg->MspDeInitCallback = pCallback;
+        break;
+
+      default:
+        /* Update the error code and return error */
+        hramcfg->ErrorCode |= HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+        status = HAL_ERROR;
+        break;
+    }
+  }
+  else if (hramcfg->State == HAL_RAMCFG_STATE_RESET)
+  {
+    switch (CallbackID)
+    {
+      case HAL_RAMCFG_MSPINIT_CB_ID :
+        /* Register msp init callback */
+        hramcfg->MspInitCallback = pCallback;
+        break;
+
+      case HAL_RAMCFG_MSPDEINIT_CB_ID :
+        /* Register msp de-init callback */
+        hramcfg->MspDeInitCallback = pCallback;
+        break;
+
+      default :
+        /* Update the error code and return error */
+        hramcfg->ErrorCode |= HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+        status =  HAL_ERROR;
+        break;
+    }
+  }
+  else
+  {
+    /* Update the error code and return error  */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @brief  UnRegister RAMCFG callbacks.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @param  CallbackID    : User Callback identifier a HAL_RAMCFG_CallbackIDTypeDef
+  *                         ENUM as parameter.
+  * @retval HAL status.
+  */
+HAL_StatusTypeDef HAL_RAMCFG_UnRegisterCallback(RAMCFG_HandleTypeDef *hramcfg, HAL_RAMCFG_CallbackIDTypeDef CallbackID)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Check RAMCFG state */
+  if (hramcfg->State == HAL_RAMCFG_STATE_READY)
+  {
+    switch (CallbackID)
+    {
+      case  HAL_RAMCFG_SE_DETECT_CB_ID:
+        /* UnRegister single error callback */
+        hramcfg->DetectSingleErrorCallback = NULL;
+        break;
+
+      case  HAL_RAMCFG_DE_DETECT_CB_ID:
+        /* UnRegister double error callback */
+        hramcfg->DetectDoubleErrorCallback = NULL;
+        break;
+
+      case HAL_RAMCFG_MSPINIT_CB_ID :
+        /* UnRegister msp init callback */
+        hramcfg->MspInitCallback = NULL;
+        break;
+
+      case HAL_RAMCFG_MSPDEINIT_CB_ID :
+        /* UnRegister msp de-init callback */
+        hramcfg->MspDeInitCallback = NULL;
+        break;
+
+      case  HAL_RAMCFG_ALL_CB_ID:
+        /* UnRegister all available callbacks */
+        hramcfg->DetectSingleErrorCallback = NULL;
+        hramcfg->DetectDoubleErrorCallback = NULL;
+        hramcfg->MspDeInitCallback         = NULL;
+        hramcfg->MspInitCallback           = NULL;
+        break;
+
+      default:
+        /* Return error status */
+        status = HAL_ERROR;
+        break;
+    }
+  }
+  else if (hramcfg->State == HAL_RAMCFG_STATE_RESET)
+  {
+    switch (CallbackID)
+    {
+      case HAL_RAMCFG_MSPINIT_CB_ID :
+        /* UnRegister msp init callback */
+        hramcfg->MspInitCallback = NULL;
+        break;
+
+      case HAL_RAMCFG_MSPDEINIT_CB_ID :
+        /* UnRegister msp de-init callback */
+        hramcfg->MspDeInitCallback = NULL;
+        break;
+
+      case  HAL_RAMCFG_ALL_CB_ID:
+        /* UnRegister all available callbacks */
+        hramcfg->MspDeInitCallback = NULL;
+        hramcfg->MspInitCallback   = NULL;
+        break;
+
+      default :
+        /* Update the error code */
+        hramcfg->ErrorCode |= HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+
+        /* Update return status */
+        status =  HAL_ERROR;
+        break;
+    }
+  }
+  else
+  {
+    /* Update the error code and return error */
+    hramcfg->ErrorCode = HAL_RAMCFG_ERROR_INVALID_CALLBACK;
+    status = HAL_ERROR;
+  }
+
+  return status;
+}
+
+/**
+  * @}
+  */
+#endif /* USE_HAL_RAMCFG_REGISTER_CALLBACKS */
+
+/** @addtogroup RAMCFG_Exported_Functions_Group7
+  *
+@verbatim
+ ===============================================================================
+                    ##### State and Error Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions to check and get the RAMCFG state
+      and the error code.
+    [..]
+      The HAL_RAMCFG_GetState() function allows the user to get the RAMCFG peripheral
+      state.
+      The HAL_RAMCFG_GetError() function allows the user to get the RAMCFG peripheral error
+      code.
+
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Get the RAMCFG peripheral state.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval RAMCFG state.
+  */
+HAL_RAMCFG_StateTypeDef HAL_RAMCFG_GetState(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Return the RAMCFG state */
+  return hramcfg->State;
+}
+
+/**
+  * @brief  Get the RAMCFG peripheral error code.
+  * @param  hramcfg       : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                         contains the configuration information for the
+  *                         specified RAMCFG instance.
+  * @retval RAMCFG error code.
+  */
+uint32_t HAL_RAMCFG_GetError(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_ALL_INSTANCE(hramcfg->Instance));
+
+  /* Return the RAMCFG error code */
+  return hramcfg->ErrorCode;
+}
+
+/**
+  * @}
+  */
+
+
+
+/** @addtogroup RAMCFG_Exported_Functions_Group9
+  *
+@verbatim
+ ===============================================================================
+                      ##### AXISRAM Powerdown Functions  #####
+ ===============================================================================
+    [..]
+      This section provides functions allowing to shutdown some AXISRAM memories
+      reduce the consumption.
+    [..]
+      The HAL_RAMCFG_EnableAXISRAM() function allows to power on the selected AXISRAM.
+    [..]
+      The HAL_RAMCFG_DisableAXISRAM() function allows to power off the selected AXISRAM.
+      AXISRAMi memory is in shutdown, and its content is not retained.
+@endverbatim
+  * @{
+  */
+
+/**
+  * @brief  Enable AXISRAM power on.
+  * @note   Only AXISRAM2 to AXISRAM6 are available for this feature.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                   contains the configuration information for the
+  *                   specified RAMCFG instance.
+  * @retval None.
+  */
+void HAL_RAMCFG_EnableAXISRAM(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_AXISRAM_POWERDOWN_INSTANCE(hramcfg->Instance));
+
+  /* AXISRAMi power on */
+  CLEAR_BIT(hramcfg->Instance->CR, RAMCFG_AXISRAM_POWERDOWN);
+}
+
+/**
+  * @brief  Disable AXISRAM power on.
+  * @note   Only AXISRAM2 to AXISRAM6 are available for this feature.
+  * @note   AXISRAMi memory is in shutdown, and its content is not retained.
+  * @note   This bit is used to reduce the consumption by powering off the AXISRAMi.
+  * @param  hramcfg : Pointer to a RAMCFG_HandleTypeDef structure that
+  *                   contains the configuration information for the
+  *                   specified RAMCFG instance.
+  * @retval None.
+  */
+void HAL_RAMCFG_DisableAXISRAM(const RAMCFG_HandleTypeDef *hramcfg)
+{
+  /* Check the parameters */
+  assert_param(IS_RAMCFG_AXISRAM_POWERDOWN_INSTANCE(hramcfg->Instance));
+
+  /* AXISRAMi powered off */
+  SET_BIT(hramcfg->Instance->CR, RAMCFG_AXISRAM_POWERDOWN);
+}
+#endif /* HAL_RAMCFG_MODULE_ENABLED */
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+
