system_ARMCM7.c 2.8 KB

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