1 /**************************************************************************//**
2  * @file     system_ARMCM3.c
3  * @brief    CMSIS Device System Source File for
4  *           ARMCM3 Device
5  * @version  V1.0.1
6  * @date     15. November 2019
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2009-2019 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 #include "ARMCM3.h"
27 
28 /*----------------------------------------------------------------------------
29   Define clocks
30  *----------------------------------------------------------------------------*/
31 #define  XTAL            (50000000UL)     /* Oscillator frequency */
32 
33 #define  SYSTEM_CLOCK    (XTAL / 2U)
34 
35 /*----------------------------------------------------------------------------
36   Exception / Interrupt Vector table
37  *----------------------------------------------------------------------------*/
38 extern const VECTOR_TABLE_Type __VECTOR_TABLE[240];
39 
40 /*----------------------------------------------------------------------------
41   System Core Clock Variable
42  *----------------------------------------------------------------------------*/
43 uint32_t SystemCoreClock = SYSTEM_CLOCK;  /* System Core Clock Frequency */
44 
45 
46 /*----------------------------------------------------------------------------
47   System Core Clock update function
48  *----------------------------------------------------------------------------*/
SystemCoreClockUpdate(void)49 void SystemCoreClockUpdate (void)
50 {
51   SystemCoreClock = SYSTEM_CLOCK;
52 }
53 
54 /*----------------------------------------------------------------------------
55   System initialization function
56  *----------------------------------------------------------------------------*/
SystemInit(void)57 void SystemInit (void)
58 {
59 
60 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
61   SCB->VTOR = (uint32_t) &(__VECTOR_TABLE[0]);
62 #endif
63 
64   SystemCoreClock = SYSTEM_CLOCK;
65 }
66