system_ARMCM33.c 3.2 KB

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