startup_ARMSC000.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /******************************************************************************
  2. * @file startup_ARMSC000.c
  3. * @brief CMSIS-Core(M) Device Startup File for a SC000 Device
  4. * @version V2.0.3
  5. * @date 31. March 2020
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2009-2020 Arm Limited. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #if defined (ARMSC000)
  25. #include "ARMSC000.h"
  26. #else
  27. #error device not specified!
  28. #endif
  29. /*----------------------------------------------------------------------------
  30. External References
  31. *----------------------------------------------------------------------------*/
  32. extern uint32_t __INITIAL_SP;
  33. extern __NO_RETURN void __PROGRAM_START(void);
  34. /*----------------------------------------------------------------------------
  35. Internal References
  36. *----------------------------------------------------------------------------*/
  37. __NO_RETURN void Reset_Handler (void);
  38. void Default_Handler(void);
  39. /*----------------------------------------------------------------------------
  40. Exception / Interrupt Handler
  41. *----------------------------------------------------------------------------*/
  42. /* Exceptions */
  43. void NMI_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  44. void HardFault_Handler (void) __attribute__ ((weak));
  45. void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  46. void PendSV_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  47. void SysTick_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  48. void Interrupt0_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  49. void Interrupt1_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  50. void Interrupt2_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  51. void Interrupt3_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  52. void Interrupt4_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  53. void Interrupt5_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  54. void Interrupt6_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  55. void Interrupt7_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  56. void Interrupt8_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  57. void Interrupt9_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
  58. /*----------------------------------------------------------------------------
  59. Exception / Interrupt Vector table
  60. *----------------------------------------------------------------------------*/
  61. #if defined ( __GNUC__ )
  62. #pragma GCC diagnostic push
  63. #pragma GCC diagnostic ignored "-Wpedantic"
  64. #endif
  65. extern const VECTOR_TABLE_Type __VECTOR_TABLE[48];
  66. const VECTOR_TABLE_Type __VECTOR_TABLE[48] __VECTOR_TABLE_ATTRIBUTE = {
  67. (VECTOR_TABLE_Type)(&__INITIAL_SP), /* Initial Stack Pointer */
  68. Reset_Handler, /* Reset Handler */
  69. NMI_Handler, /* -14 NMI Handler */
  70. HardFault_Handler, /* -13 Hard Fault Handler */
  71. 0, /* Reserved */
  72. 0, /* Reserved */
  73. 0, /* Reserved */
  74. 0, /* Reserved */
  75. 0, /* Reserved */
  76. 0, /* Reserved */
  77. 0, /* Reserved */
  78. SVC_Handler, /* -5 SVC Handler */
  79. 0, /* Reserved */
  80. 0, /* Reserved */
  81. PendSV_Handler, /* -2 PendSV Handler */
  82. SysTick_Handler, /* -1 SysTick Handler */
  83. /* Interrupts */
  84. Interrupt0_Handler, /* 0 Interrupt 0 */
  85. Interrupt1_Handler, /* 1 Interrupt 1 */
  86. Interrupt2_Handler, /* 2 Interrupt 2 */
  87. Interrupt3_Handler, /* 3 Interrupt 3 */
  88. Interrupt4_Handler, /* 4 Interrupt 4 */
  89. Interrupt5_Handler, /* 5 Interrupt 5 */
  90. Interrupt6_Handler, /* 6 Interrupt 6 */
  91. Interrupt7_Handler, /* 7 Interrupt 7 */
  92. Interrupt8_Handler, /* 8 Interrupt 8 */
  93. Interrupt9_Handler /* 9 Interrupt 9 */
  94. /* Interrupts 10..31 are left out */
  95. };
  96. #if defined ( __GNUC__ )
  97. #pragma GCC diagnostic pop
  98. #endif
  99. /*----------------------------------------------------------------------------
  100. Reset Handler called on controller reset
  101. *----------------------------------------------------------------------------*/
  102. __NO_RETURN void Reset_Handler(void)
  103. {
  104. SystemInit(); /* CMSIS System Initialization */
  105. __PROGRAM_START(); /* Enter PreMain (C library entry point) */
  106. }
  107. #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  108. #pragma clang diagnostic push
  109. #pragma clang diagnostic ignored "-Wmissing-noreturn"
  110. #endif
  111. /*----------------------------------------------------------------------------
  112. Hard Fault Handler
  113. *----------------------------------------------------------------------------*/
  114. void HardFault_Handler(void)
  115. {
  116. while(1);
  117. }
  118. /*----------------------------------------------------------------------------
  119. Default Handler for Exceptions / Interrupts
  120. *----------------------------------------------------------------------------*/
  121. void Default_Handler(void)
  122. {
  123. while(1);
  124. }
  125. #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  126. #pragma clang diagnostic pop
  127. #endif