ChibiOS/RT
2.5.1
vectors.c
Go to the documentation of this file.
00001 /*
00002     ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
00003                  2011,2012 Giovanni Di Sirio.
00004 
00005     This file is part of ChibiOS/RT.
00006 
00007     ChibiOS/RT is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     ChibiOS/RT is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 /**
00022  * @file    GCC/ARMCMx/LPC11xx/vectors.c
00023  * @brief   Interrupt vectors for the LPC11xx family.
00024  *
00025  * @defgroup ARMCMx_LPC11xx_VECTORS LPC11xx Interrupt Vectors
00026  * @ingroup ARMCMx_SPECIFIC
00027  * @details Interrupt vectors for the LPC11xx family.
00028  * @{
00029  */
00030 
00031 #include "ch.h"
00032 
00033 /**
00034  * @brief   Type of an IRQ vector.
00035  */
00036 typedef void  (*irq_vector_t)(void);
00037 
00038 /**
00039  * @brief   Type of a structure representing the whole vectors table.
00040  */
00041 typedef struct {
00042   uint32_t      *init_stack;
00043   irq_vector_t  reset_vector;
00044   irq_vector_t  nmi_vector;
00045   irq_vector_t  hardfault_vector;
00046   irq_vector_t  memmanage_vector;
00047   irq_vector_t  busfault_vector;
00048   irq_vector_t  usagefault_vector;
00049   irq_vector_t  vector1c;
00050   irq_vector_t  vector20;
00051   irq_vector_t  vector24;
00052   irq_vector_t  vector28;
00053   irq_vector_t  svcall_vector;
00054   irq_vector_t  debugmonitor_vector;
00055   irq_vector_t  vector34;
00056   irq_vector_t  pendsv_vector;
00057   irq_vector_t  systick_vector;
00058   irq_vector_t  vectors[32];
00059 } vectors_t;
00060 
00061 #if !defined(__DOXYGEN__)
00062 extern uint32_t __main_stack_end__;
00063 extern void ResetHandler(void);
00064 extern void NMIVector(void);
00065 extern void HardFaultVector(void);
00066 extern void MemManageVector(void);
00067 extern void BusFaultVector(void);
00068 extern void UsageFaultVector(void);
00069 extern void Vector1C(void);
00070 extern void Vector20(void);
00071 extern void Vector24(void);
00072 extern void Vector28(void);
00073 extern void SVCallVector(void);
00074 extern void DebugMonitorVector(void);
00075 extern void Vector34(void);
00076 extern void PendSVVector(void);
00077 extern void SysTickVector(void);
00078 extern void Vector40(void);
00079 extern void Vector44(void);
00080 extern void Vector48(void);
00081 extern void Vector4C(void);
00082 extern void Vector50(void);
00083 extern void Vector54(void);
00084 extern void Vector58(void);
00085 extern void Vector5C(void);
00086 extern void Vector60(void);
00087 extern void Vector64(void);
00088 extern void Vector68(void);
00089 extern void Vector6C(void);
00090 extern void Vector70(void);
00091 extern void Vector74(void);
00092 extern void Vector78(void);
00093 extern void Vector7C(void);
00094 extern void Vector80(void);
00095 extern void Vector84(void);
00096 extern void Vector88(void);
00097 extern void Vector8C(void);
00098 extern void Vector90(void);
00099 extern void Vector94(void);
00100 extern void Vector98(void);
00101 extern void Vector9C(void);
00102 extern void VectorA0(void);
00103 extern void VectorA4(void);
00104 extern void VectorA8(void);
00105 extern void VectorAC(void);
00106 extern void VectorB0(void);
00107 extern void VectorB4(void);
00108 extern void VectorB8(void);
00109 extern void VectorBC(void);
00110 #endif
00111 
00112 /**
00113  * @brief   LPC11xx vectors table.
00114  */
00115 #if !defined(__DOXYGEN__)
00116 __attribute__ ((section("vectors")))
00117 #endif
00118 vectors_t _vectors = {
00119   &__main_stack_end__,ResetHandler,       NMIVector,          HardFaultVector,
00120   MemManageVector,    BusFaultVector,     UsageFaultVector,   Vector1C,
00121   Vector20,           Vector24,           Vector28,           SVCallVector,
00122   DebugMonitorVector, Vector34,           PendSVVector,       SysTickVector,
00123   {
00124     Vector40,           Vector44,           Vector48,           Vector4C,
00125     Vector50,           Vector54,           Vector58,           Vector5C,
00126     Vector60,           Vector64,           Vector68,           Vector6C,
00127     Vector70,           Vector74,           Vector78,           Vector7C,
00128     Vector80,           Vector84,           Vector88,           Vector8C,
00129     Vector90,           Vector94,           Vector98,           Vector9C,
00130     VectorA0,           VectorA4,           VectorA8,           VectorAC,
00131     VectorB0,           VectorB4,           VectorB8,           VectorBC
00132   }
00133 };
00134 
00135 /**
00136  * @brief   Unhandled exceptions handler.
00137  * @details Any undefined exception vector points to this function by default.
00138  *          This function simply stops the system into an infinite loop.
00139  *
00140  * @notapi
00141  */
00142 #if !defined(__DOXYGEN__)
00143 __attribute__ ((naked))
00144 #endif
00145 void _unhandled_exception(void) {
00146 
00147   while (TRUE)
00148     ;
00149 }
00150 
00151 void NMIVector(void) __attribute__((weak, alias("_unhandled_exception")));
00152 void HardFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00153 void MemManageVector(void) __attribute__((weak, alias("_unhandled_exception")));
00154 void BusFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00155 void UsageFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00156 void Vector1C(void) __attribute__((weak, alias("_unhandled_exception")));
00157 void Vector20(void) __attribute__((weak, alias("_unhandled_exception")));
00158 void Vector24(void) __attribute__((weak, alias("_unhandled_exception")));
00159 void Vector28(void) __attribute__((weak, alias("_unhandled_exception")));
00160 void SVCallVector(void) __attribute__((weak, alias("_unhandled_exception")));
00161 void DebugMonitorVector(void) __attribute__((weak, alias("_unhandled_exception")));
00162 void Vector34(void) __attribute__((weak, alias("_unhandled_exception")));
00163 void PendSVVector(void) __attribute__((weak, alias("_unhandled_exception")));
00164 void SysTickVector(void) __attribute__((weak, alias("_unhandled_exception")));
00165 void Vector40(void) __attribute__((weak, alias("_unhandled_exception")));
00166 void Vector44(void) __attribute__((weak, alias("_unhandled_exception")));
00167 void Vector48(void) __attribute__((weak, alias("_unhandled_exception")));
00168 void Vector4C(void) __attribute__((weak, alias("_unhandled_exception")));
00169 void Vector50(void) __attribute__((weak, alias("_unhandled_exception")));
00170 void Vector54(void) __attribute__((weak, alias("_unhandled_exception")));
00171 void Vector58(void) __attribute__((weak, alias("_unhandled_exception")));
00172 void Vector5C(void) __attribute__((weak, alias("_unhandled_exception")));
00173 void Vector60(void) __attribute__((weak, alias("_unhandled_exception")));
00174 void Vector64(void) __attribute__((weak, alias("_unhandled_exception")));
00175 void Vector68(void) __attribute__((weak, alias("_unhandled_exception")));
00176 void Vector6C(void) __attribute__((weak, alias("_unhandled_exception")));
00177 void Vector70(void) __attribute__((weak, alias("_unhandled_exception")));
00178 void Vector74(void) __attribute__((weak, alias("_unhandled_exception")));
00179 void Vector78(void) __attribute__((weak, alias("_unhandled_exception")));
00180 void Vector7C(void) __attribute__((weak, alias("_unhandled_exception")));
00181 void Vector80(void) __attribute__((weak, alias("_unhandled_exception")));
00182 void Vector84(void) __attribute__((weak, alias("_unhandled_exception")));
00183 void Vector88(void) __attribute__((weak, alias("_unhandled_exception")));
00184 void Vector8C(void) __attribute__((weak, alias("_unhandled_exception")));
00185 void Vector90(void) __attribute__((weak, alias("_unhandled_exception")));
00186 void Vector94(void) __attribute__((weak, alias("_unhandled_exception")));
00187 void Vector98(void) __attribute__((weak, alias("_unhandled_exception")));
00188 void Vector9C(void) __attribute__((weak, alias("_unhandled_exception")));
00189 void VectorA0(void) __attribute__((weak, alias("_unhandled_exception")));
00190 void VectorA4(void) __attribute__((weak, alias("_unhandled_exception")));
00191 void VectorA8(void) __attribute__((weak, alias("_unhandled_exception")));
00192 void VectorAC(void) __attribute__((weak, alias("_unhandled_exception")));
00193 void VectorB0(void) __attribute__((weak, alias("_unhandled_exception")));
00194 void VectorB4(void) __attribute__((weak, alias("_unhandled_exception")));
00195 void VectorB8(void) __attribute__((weak, alias("_unhandled_exception")));
00196 void VectorBC(void) __attribute__((weak, alias("_unhandled_exception")));
00197 
00198 /** @} */