1 /** 2 ****************************************************************************** 3 * @file boot_hal_cfg.h 4 * @author MCD Application Team 5 * @brief File fixing configuration flag specific for STM32H5xx platform 6 * 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2023 STMicroelectronics. 11 * All rights reserved. 12 * 13 * This software component is licensed by ST under BSD 3-Clause license, 14 * the "License"; You may not use this file except in compliance with the 15 * License. You may obtain a copy of the License at: 16 * opensource.org/licenses/BSD-3-Clause 17 * 18 ****************************************************************************** 19 */ 20 21 22 /* Define to prevent recursive inclusion -------------------------------------*/ 23 #ifndef BOOT_HAL_CFG_H 24 #define BOOT_HAL_CFG_H 25 26 /* Includes ------------------------------------------------------------------*/ 27 #include "stm32h5xx_hal.h" 28 29 /* RTC clock */ 30 #define RTC_CLOCK_SOURCE_LSI 31 #ifdef RTC_CLOCK_SOURCE_LSI 32 #define RTC_ASYNCH_PREDIV 0x7F 33 #define RTC_SYNCH_PREDIV 0x00F9 34 #endif 35 #ifdef RTC_CLOCK_SOURCE_LSE 36 #define RTC_ASYNCH_PREDIV 0x7F 37 #define RTC_SYNCH_PREDIV 0x00FF 38 #endif 39 40 #define TFM_DEV_MODE 41 /* ICache */ 42 /*#define TFM_ICACHE_ENABLE*/ /*!< Instruction cache enable */ 43 44 /* Static protections */ 45 #define TFM_WRP_PROTECT_ENABLE /*!< Write Protection */ 46 #define TFM_HDP_PROTECT_ENABLE /*!< HDP protection */ 47 #define TFM_SECURE_USER_SRAM2_ERASE_AT_RESET /*!< SRAM2 clear at Reset */ 48 #define TFM_SECURE_USER_SRAM2_ECC /*!< SRAM2 ECC */ 49 50 #ifdef TFM_DEV_MODE 51 #define TFM_OB_PRODUCT_STATE_VALUE OB_PROD_STATE_OPEN /*!< Product State */ 52 #else 53 #define TFM_OB_PRODUCT_STATE_VALUE OB_PROD_STATE_CLOSED /*!< Product State */ 54 #endif /* TFM_DEV_MODE */ 55 56 #define NO_TAMPER (0) /*!< No tamper activated */ 57 #define INTERNAL_TAMPER_ONLY (1) /*!< Only Internal tamper activated */ 58 #define ALL_TAMPER (2) /*!< Internal and External tamper activated */ 59 #define TFM_TAMPER_ENABLE NO_TAMPER /*!< TAMPER configuration flag */ 60 61 #ifdef TFM_DEV_MODE 62 #define TFM_OB_BOOT_LOCK OB_BOOT_LOCK_DISABLE /*!< BOOT Lock expected value */ 63 #define TFM_ENABLE_SET_OB /*!< Option bytes are set by TFM_SBSFU_Boot when not correctly set */ 64 #define TFM_ERROR_HANDLER_NON_SECURE /*!< Error handler is in Non Secure , this allows regression without jumping */ 65 #else 66 #define TFM_WRP_LOCK_ENABLE /*!< Write Protection Lock */ 67 #define TFM_OB_BOOT_LOCK OB_BOOT_LOCK_ENABLE /*!< BOOT Lock expected value */ 68 #endif /* TFM_DEV_MODE */ 69 70 /* Run time protections */ 71 #define TFM_FLASH_PRIVONLY_ENABLE /*!< Flash Command in Privileged only */ 72 /*#define TFM_MPU_PROTECTION*/ /*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code */ 73 74 /* Exported types ------------------------------------------------------------*/ 75 typedef enum 76 { 77 TFM_SUCCESS = 0U, 78 TFM_FAILED 79 } TFM_ErrorStatus; 80 81 /* Exported constants --------------------------------------------------------*/ 82 /* Exported macro ------------------------------------------------------------*/ 83 /* Exported functions ------------------------------------------------------- */ 84 void Error_Handler(void); 85 #ifndef TFM_ERROR_HANDLER_NON_SECURE 86 void Error_Handler_rdp(void); 87 #else 88 #define Error_Handler_rdp Error_Handler 89 #endif 90 #endif /* GENERATOR_RDP_PASSWORD_AVAILABLE */ 91