vectors.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file ARM/compilers/GCC/vectors.s
  15. * @brief Interrupt vectors for ARM devices.
  16. *
  17. * @defgroup ARM_VECTORS ARM Exception Vectors
  18. * @{
  19. */
  20. #if defined(__DOXYGEN__)
  21. /**
  22. * @brief Unhandled exceptions handler.
  23. * @details Any undefined exception vector points to this function by default.
  24. * This function simply stops the system into an infinite loop.
  25. * @note The default implementation is a weak symbol, the application
  26. * can override the default implementation.
  27. *
  28. * @notapi
  29. */
  30. void _unhandled_exception(void) {}
  31. #endif
  32. #if !defined(__DOXYGEN__)
  33. .section .vectors, "ax"
  34. .code 32
  35. .balign 4
  36. /*
  37. * System entry points.
  38. */
  39. .global _start
  40. _start:
  41. ldr pc, _reset
  42. ldr pc, _undefined
  43. ldr pc, _swi
  44. ldr pc, _prefetch
  45. ldr pc, _abort
  46. nop
  47. ldr pc, _irq
  48. ldr pc, _fiq
  49. _reset:
  50. .word Boot_Handler
  51. _undefined:
  52. .word Und_Handler
  53. _swi:
  54. .word Swi_Handler
  55. _prefetch:
  56. .word Prefetch_Handler
  57. _abort:
  58. .word Abort_Handler
  59. _fiq:
  60. .word Fiq_Handler
  61. _irq:
  62. .word Irq_Handler
  63. /*
  64. * Default exceptions handlers. The handlers are declared weak in order to be
  65. * replaced by the real handling code. Everything is defaulted to an infinite
  66. * loop.
  67. */
  68. .weak Reset_Handler
  69. Reset_Handler:
  70. .weak Und_Handler
  71. Und_Handler:
  72. .weak Swi_Handler
  73. Swi_Handler:
  74. .weak Prefetch_Handler
  75. Prefetch_Handler:
  76. .weak Abort_Handler
  77. Abort_Handler:
  78. .weak Fiq_Handler
  79. Fiq_Handler:
  80. .weak Irq_Handler
  81. Irq_Handler:
  82. .weak _unhandled_exception
  83. _unhandled_exception:
  84. b _unhandled_exception
  85. /*
  86. * Default boot handler. Jump to Reset_Handler.
  87. */
  88. .section .boot, "ax"
  89. .weak Boot_Handler
  90. Boot_Handler:
  91. b Reset_Handler
  92. #endif
  93. /** @} */