1 /**************************************************************************//**
2  * @file     system_ARMCM55.c
3  * @brief    CMSIS Device System Source File for
4  *           ARMCM55 Device
5  * @version  V1.0.0
6  * @date     23. March 2020
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2009-2020 Arm Limited. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 #if defined (ARMCM55)
27   #include "ARMCM55.h"
28 
29   #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U)
30     #include "partition_ARMCM55.h"
31   #endif
32 
33 #else
34   #error device not specified!
35 #endif
36 
37 /*----------------------------------------------------------------------------
38   Define clocks
39  *----------------------------------------------------------------------------*/
40 #define  XTAL            ( 5000000UL)      /* Oscillator frequency */
41 
42 #define  SYSTEM_CLOCK    (5U * XTAL)
43 
44 
45 /*----------------------------------------------------------------------------
46   Exception / Interrupt Vector table
47  *----------------------------------------------------------------------------*/
48 extern const VECTOR_TABLE_Type __VECTOR_TABLE[496];
49 
50 
51 /*----------------------------------------------------------------------------
52   System Core Clock Variable
53  *----------------------------------------------------------------------------*/
54 uint32_t SystemCoreClock = SYSTEM_CLOCK;
55 
56 
57 /*----------------------------------------------------------------------------
58   System Core Clock update function
59  *----------------------------------------------------------------------------*/
SystemCoreClockUpdate(void)60 void SystemCoreClockUpdate (void)
61 {
62   SystemCoreClock = SYSTEM_CLOCK;
63 }
64 
65 /*----------------------------------------------------------------------------
66   System initialization function
67  *----------------------------------------------------------------------------*/
SystemInit(void)68 void SystemInit (void)
69 {
70 
71 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
72   SCB->VTOR = (uint32_t)(&__VECTOR_TABLE[0]);
73 #endif
74 
75 #if (defined (__FPU_USED) && (__FPU_USED == 1U)) || \
76     (defined (__ARM_FEATURE_MVE) && (__ARM_FEATURE_MVE > 0U))
77   SCB->CPACR |= ((3U << 10U*2U) |           /* enable CP10 Full Access */
78                  (3U << 11U*2U)  );         /* enable CP11 Full Access */
79 #endif
80 
81 #ifdef UNALIGNED_SUPPORT_DISABLE
82   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
83 #endif
84 
85 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
86   TZ_SAU_Setup();
87 #endif
88 
89   SystemCoreClock = SYSTEM_CLOCK;
90 }
91