Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
56 | mjames | 1 | /**************************************************************************//** |
2 | * @file system_ARMCM7.c |
||
3 | * @brief CMSIS Device System Source File for |
||
4 | * ARMCM7 Device Series |
||
5 | * @version V5.00 |
||
6 | * @date 07. September 2016 |
||
7 | ******************************************************************************/ |
||
8 | /* |
||
9 | * Copyright (c) 2009-2016 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 | * http://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 (ARMCM7) |
||
27 | #include "ARMCM7.h" |
||
28 | #elif defined (ARMCM7_SP) |
||
29 | #include "ARMCM7_SP.h" |
||
30 | #elif defined (ARMCM7_DP) |
||
31 | #include "ARMCM7_DP.h" |
||
32 | #else |
||
33 | #error device not specified! |
||
34 | #endif |
||
35 | |||
36 | /*---------------------------------------------------------------------------- |
||
37 | Define clocks |
||
38 | *----------------------------------------------------------------------------*/ |
||
39 | #define XTAL ( 5000000UL) /* Oscillator frequency */ |
||
40 | |||
41 | #define SYSTEM_CLOCK (5U * XTAL) |
||
42 | |||
43 | |||
44 | /*---------------------------------------------------------------------------- |
||
45 | Externals |
||
46 | *----------------------------------------------------------------------------*/ |
||
47 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
||
48 | extern uint32_t __Vectors; |
||
49 | #endif |
||
50 | |||
51 | /*---------------------------------------------------------------------------- |
||
52 | System Core Clock Variable |
||
53 | *----------------------------------------------------------------------------*/ |
||
54 | uint32_t SystemCoreClock = SYSTEM_CLOCK; |
||
55 | |||
56 | |||
57 | /*---------------------------------------------------------------------------- |
||
58 | System Core Clock update function |
||
59 | *----------------------------------------------------------------------------*/ |
||
60 | void SystemCoreClockUpdate (void) |
||
61 | { |
||
62 | SystemCoreClock = SYSTEM_CLOCK; |
||
63 | } |
||
64 | |||
65 | /*---------------------------------------------------------------------------- |
||
66 | System initialization function |
||
67 | *----------------------------------------------------------------------------*/ |
||
68 | void SystemInit (void) |
||
69 | { |
||
70 | |||
71 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) |
||
72 | SCB->VTOR = (uint32_t) &__Vectors; |
||
73 | #endif |
||
74 | |||
75 | #if defined (__FPU_USED) && (__FPU_USED == 1U) |
||
76 | SCB->CPACR |= ((3U << 10U*2U) | /* set CP10 Full Access */ |
||
77 | (3U << 11U*2U) ); /* set CP11 Full Access */ |
||
78 | #endif |
||
79 | |||
80 | #ifdef UNALIGNED_SUPPORT_DISABLE |
||
81 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; |
||
82 | #endif |
||
83 | |||
84 | SystemCoreClock = SYSTEM_CLOCK; |
||
85 | } |