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/LPC13xx/vectors.c
00023  * @brief   Interrupt vectors for the LPC13xx family.
00024  *
00025  * @defgroup ARMCMx_LPC13xx_VECTORS LPC13xx Interrupt Vectors
00026  * @ingroup ARMCMx_SPECIFIC
00027  * @details Interrupt vectors for the LPC13xx 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[58];
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 extern void VectorC0(void);
00111 extern void VectorC4(void);
00112 extern void VectorC8(void);
00113 extern void VectorCC(void);
00114 extern void VectorD0(void);
00115 extern void VectorD4(void);
00116 extern void VectorD8(void);
00117 extern void VectorDC(void);
00118 extern void VectorE0(void);
00119 extern void VectorE4(void);
00120 extern void VectorE8(void);
00121 extern void VectorEC(void);
00122 extern void VectorF0(void);
00123 extern void VectorF4(void);
00124 extern void VectorF8(void);
00125 extern void VectorFC(void);
00126 extern void Vector100(void);
00127 extern void Vector104(void);
00128 extern void Vector108(void);
00129 extern void Vector10C(void);
00130 extern void Vector110(void);
00131 extern void Vector114(void);
00132 extern void Vector118(void);
00133 extern void Vector11C(void);
00134 extern void Vector120(void);
00135 extern void Vector124(void);
00136 #endif
00137 
00138 /**
00139  * @brief   LPC13xx vectors table.
00140  */
00141 #if !defined(__DOXYGEN__)
00142 __attribute__ ((section("vectors")))
00143 #endif
00144 vectors_t _vectors = {
00145   &__main_stack_end__,ResetHandler,       NMIVector,          HardFaultVector,
00146   MemManageVector,    BusFaultVector,     UsageFaultVector,   Vector1C,
00147   Vector20,           Vector24,           Vector28,           SVCallVector,
00148   DebugMonitorVector, Vector34,           PendSVVector,       SysTickVector,
00149   {
00150     Vector40,           Vector44,           Vector48,           Vector4C,
00151     Vector50,           Vector54,           Vector58,           Vector5C,
00152     Vector60,           Vector64,           Vector68,           Vector6C,
00153     Vector70,           Vector74,           Vector78,           Vector7C,
00154     Vector80,           Vector84,           Vector88,           Vector8C,
00155     Vector90,           Vector94,           Vector98,           Vector9C,
00156     VectorA0,           VectorA4,           VectorA8,           VectorAC,
00157     VectorB0,           VectorB4,           VectorB8,           VectorBC,
00158     VectorC0,           VectorC4,           VectorC8,           VectorCC,
00159     VectorD0,           VectorD4,           VectorD8,           VectorDC,
00160     VectorE0,           VectorE4,           VectorE8,           VectorEC,
00161     VectorF0,           VectorF4,           VectorF8,           VectorFC,
00162     Vector100,          Vector104,          Vector108,          Vector10C,
00163     Vector110,          Vector114,          Vector118,          Vector11C,
00164     Vector120,          Vector124
00165   }
00166 };
00167 
00168 /**
00169  * @brief   Unhandled exceptions handler.
00170  * @details Any undefined exception vector points to this function by default.
00171  *          This function simply stops the system into an infinite loop.
00172  *
00173  * @notapi
00174  */
00175 #if !defined(__DOXYGEN__)
00176 __attribute__ ((naked))
00177 #endif
00178 void _unhandled_exception(void) {
00179 
00180   while (TRUE)
00181     ;
00182 }
00183 
00184 void NMIVector(void) __attribute__((weak, alias("_unhandled_exception")));
00185 void HardFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00186 void MemManageVector(void) __attribute__((weak, alias("_unhandled_exception")));
00187 void BusFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00188 void UsageFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
00189 void Vector1C(void) __attribute__((weak, alias("_unhandled_exception")));
00190 void Vector20(void) __attribute__((weak, alias("_unhandled_exception")));
00191 void Vector24(void) __attribute__((weak, alias("_unhandled_exception")));
00192 void Vector28(void) __attribute__((weak, alias("_unhandled_exception")));
00193 void SVCallVector(void) __attribute__((weak, alias("_unhandled_exception")));
00194 void DebugMonitorVector(void) __attribute__((weak, alias("_unhandled_exception")));
00195 void Vector34(void) __attribute__((weak, alias("_unhandled_exception")));
00196 void PendSVVector(void) __attribute__((weak, alias("_unhandled_exception")));
00197 void SysTickVector(void) __attribute__((weak, alias("_unhandled_exception")));
00198 void Vector40(void) __attribute__((weak, alias("_unhandled_exception")));
00199 void Vector44(void) __attribute__((weak, alias("_unhandled_exception")));
00200 void Vector48(void) __attribute__((weak, alias("_unhandled_exception")));
00201 void Vector4C(void) __attribute__((weak, alias("_unhandled_exception")));
00202 void Vector50(void) __attribute__((weak, alias("_unhandled_exception")));
00203 void Vector54(void) __attribute__((weak, alias("_unhandled_exception")));
00204 void Vector58(void) __attribute__((weak, alias("_unhandled_exception")));
00205 void Vector5C(void) __attribute__((weak, alias("_unhandled_exception")));
00206 void Vector60(void) __attribute__((weak, alias("_unhandled_exception")));
00207 void Vector64(void) __attribute__((weak, alias("_unhandled_exception")));
00208 void Vector68(void) __attribute__((weak, alias("_unhandled_exception")));
00209 void Vector6C(void) __attribute__((weak, alias("_unhandled_exception")));
00210 void Vector70(void) __attribute__((weak, alias("_unhandled_exception")));
00211 void Vector74(void) __attribute__((weak, alias("_unhandled_exception")));
00212 void Vector78(void) __attribute__((weak, alias("_unhandled_exception")));
00213 void Vector7C(void) __attribute__((weak, alias("_unhandled_exception")));
00214 void Vector80(void) __attribute__((weak, alias("_unhandled_exception")));
00215 void Vector84(void) __attribute__((weak, alias("_unhandled_exception")));
00216 void Vector88(void) __attribute__((weak, alias("_unhandled_exception")));
00217 void Vector8C(void) __attribute__((weak, alias("_unhandled_exception")));
00218 void Vector90(void) __attribute__((weak, alias("_unhandled_exception")));
00219 void Vector94(void) __attribute__((weak, alias("_unhandled_exception")));
00220 void Vector98(void) __attribute__((weak, alias("_unhandled_exception")));
00221 void Vector9C(void) __attribute__((weak, alias("_unhandled_exception")));
00222 void VectorA0(void) __attribute__((weak, alias("_unhandled_exception")));
00223 void VectorA4(void) __attribute__((weak, alias("_unhandled_exception")));
00224 void VectorA8(void) __attribute__((weak, alias("_unhandled_exception")));
00225 void VectorAC(void) __attribute__((weak, alias("_unhandled_exception")));
00226 void VectorB0(void) __attribute__((weak, alias("_unhandled_exception")));
00227 void VectorB4(void) __attribute__((weak, alias("_unhandled_exception")));
00228 void VectorB8(void) __attribute__((weak, alias("_unhandled_exception")));
00229 void VectorBC(void) __attribute__((weak, alias("_unhandled_exception")));
00230 void VectorC0(void) __attribute__((weak, alias("_unhandled_exception")));
00231 void VectorC4(void) __attribute__((weak, alias("_unhandled_exception")));
00232 void VectorC8(void) __attribute__((weak, alias("_unhandled_exception")));
00233 void VectorCC(void) __attribute__((weak, alias("_unhandled_exception")));
00234 void VectorD0(void) __attribute__((weak, alias("_unhandled_exception")));
00235 void VectorD4(void) __attribute__((weak, alias("_unhandled_exception")));
00236 void VectorD8(void) __attribute__((weak, alias("_unhandled_exception")));
00237 void VectorDC(void) __attribute__((weak, alias("_unhandled_exception")));
00238 void VectorE0(void) __attribute__((weak, alias("_unhandled_exception")));
00239 void VectorE4(void) __attribute__((weak, alias("_unhandled_exception")));
00240 void VectorE8(void) __attribute__((weak, alias("_unhandled_exception")));
00241 void VectorEC(void) __attribute__((weak, alias("_unhandled_exception")));
00242 void VectorF0(void) __attribute__((weak, alias("_unhandled_exception")));
00243 void VectorF4(void) __attribute__((weak, alias("_unhandled_exception")));
00244 void VectorF8(void) __attribute__((weak, alias("_unhandled_exception")));
00245 void VectorFC(void) __attribute__((weak, alias("_unhandled_exception")));
00246 void Vector100(void) __attribute__((weak, alias("_unhandled_exception")));
00247 void Vector104(void) __attribute__((weak, alias("_unhandled_exception")));
00248 void Vector108(void) __attribute__((weak, alias("_unhandled_exception")));
00249 void Vector10C(void) __attribute__((weak, alias("_unhandled_exception")));
00250 void Vector110(void) __attribute__((weak, alias("_unhandled_exception")));
00251 void Vector114(void) __attribute__((weak, alias("_unhandled_exception")));
00252 void Vector118(void) __attribute__((weak, alias("_unhandled_exception")));
00253 void Vector11C(void) __attribute__((weak, alias("_unhandled_exception")));
00254 void Vector120(void) __attribute__((weak, alias("_unhandled_exception")));
00255 void Vector124(void) __attribute__((weak, alias("_unhandled_exception")));
00256 
00257 /** @} */