Subversion Repositories dashGPS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /**************************************************************************//**
  2.  * @file     system_ARMCM4.c
  3.  * @brief    CMSIS Device System Source File for
  4.  *           ARMCM4 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 (ARMCM4)
  27.   #include "ARMCM4.h"
  28. #elif defined (ARMCM4_FP)
  29.   #include "ARMCM4_FP.h"
  30. #else
  31.   #error device not specified!
  32. #endif
  33.  
  34. /*----------------------------------------------------------------------------
  35.   Define clocks
  36.  *----------------------------------------------------------------------------*/
  37. #define  XTAL            ( 5000000UL)      /* Oscillator frequency */
  38.  
  39. #define  SYSTEM_CLOCK    (5U * XTAL)
  40.  
  41.  
  42. /*----------------------------------------------------------------------------
  43.   Externals
  44.  *----------------------------------------------------------------------------*/
  45. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  46.   extern uint32_t __Vectors;
  47. #endif
  48.  
  49. /*----------------------------------------------------------------------------
  50.   System Core Clock Variable
  51.  *----------------------------------------------------------------------------*/
  52. uint32_t SystemCoreClock = SYSTEM_CLOCK;
  53.  
  54.  
  55. /*----------------------------------------------------------------------------
  56.   System Core Clock update function
  57.  *----------------------------------------------------------------------------*/
  58. void SystemCoreClockUpdate (void)
  59. {
  60.   SystemCoreClock = SYSTEM_CLOCK;
  61. }
  62.  
  63. /*----------------------------------------------------------------------------
  64.   System initialization function
  65.  *----------------------------------------------------------------------------*/
  66. void SystemInit (void)
  67. {
  68.  
  69. #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
  70.   SCB->VTOR = (uint32_t) &__Vectors;
  71. #endif
  72.  
  73. #if defined (__FPU_USED) && (__FPU_USED == 1U)
  74.   SCB->CPACR |= ((3U << 10U*2U) |           /* set CP10 Full Access */
  75.                  (3U << 11U*2U)  );         /* set CP11 Full Access */
  76. #endif
  77.  
  78. #ifdef UNALIGNED_SUPPORT_DISABLE
  79.   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
  80. #endif
  81.  
  82.   SystemCoreClock = SYSTEM_CLOCK;
  83. }
  84.