system_ARMv8MML.c 3.2 KB

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