File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 5656 #include "bsp_group_irq.h"
5757 #include "bsp_clocks.h"
5858 #include "bsp_module_stop.h"
59- #include "bsp_security.h"
60-
59+
6160/* Factory MCU information. */
6261 #include "fsp_features.h"
6362
6463/* BSP Common Includes (Other than bsp_common.h) */
6564 #include "bsp_delay.h"
6665 #include "bsp_mcu_api.h"
67-
66+ #include "bsp_security.h"
6867#endif
6968
7069/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
Original file line number Diff line number Diff line change @@ -26,6 +26,36 @@ FSP_HEADER
2626 * Exported global functions (to be accessed by other files)
2727 **********************************************************************************************************************/
2828void R_BSP_NonSecureEnter (void );
29+ void R_BSP_RegisterProtectDisable (bsp_reg_protect_t regs_to_unprotect );
30+ void R_BSP_RegisterProtectEnable (bsp_reg_protect_t regs_to_protect );
31+
32+ /*******************************************************************************************************************/ /**
33+ * Initialize security features for TrustZone.
34+ *
35+ * This function initializes ARM security register and Renesas SAR registers for secure projects.
36+ *
37+ * @note IDAU settings must be configured to match project settings with a separate configuration tool.
38+ **********************************************************************************************************************/
39+ __STATIC_INLINE void R_BSP_SecurityInit (void )
40+ {
41+ #if FSP_PRIV_TZ_USE_SECURE_REGS
42+ /* Disable protection using PRCR register. */
43+ R_BSP_RegisterProtectDisable (BSP_REG_PROTECT_SAR );
44+
45+ /* Initialize peripherals to secure mode for flat projects */
46+ R_PSCU -> PSARB = 0 ;
47+ R_PSCU -> PSARC = 0 ;
48+ R_PSCU -> PSARD = 0 ;
49+ R_PSCU -> PSARE = 0 ;
50+
51+ R_CPSCU -> ICUSARG = 0 ;
52+ R_CPSCU -> ICUSARH = 0 ;
53+ R_CPSCU -> ICUSARI = 0 ;
54+
55+ /* Enable protection using PRCR register. */
56+ R_BSP_RegisterProtectEnable (BSP_REG_PROTECT_SAR );
57+ #endif
58+ }
2959
3060/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
3161FSP_FOOTER
You can’t perform that action at this time.
0 commit comments