system_ARMv8MML.c 3.0 KB

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