diff --git a/os/ports/GCC/ARMCMx/LPC11xx/vectors.c b/os/ports/GCC/ARMCMx/LPC11xx/vectors.c index c51a89e25..3d9c277ef 100644 --- a/os/ports/GCC/ARMCMx/LPC11xx/vectors.c +++ b/os/ports/GCC/ARMCMx/LPC11xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[32]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -87,19 +115,21 @@ extern void VectorBC(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC + } }; /** diff --git a/os/ports/GCC/ARMCMx/LPC13xx/vectors.c b/os/ports/GCC/ARMCMx/LPC13xx/vectors.c index 350e8d0aa..f83a4ee1d 100644 --- a/os/ports/GCC/ARMCMx/LPC13xx/vectors.c +++ b/os/ports/GCC/ARMCMx/LPC13xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[58]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -113,26 +141,28 @@ extern void Vector124(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0, VectorF4, VectorF8, VectorFC, - Vector100, Vector104, Vector108, Vector10C, - Vector110, Vector114, Vector118, Vector11C, - Vector120, Vector124 + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0, VectorF4, VectorF8, VectorFC, + Vector100, Vector104, Vector108, Vector10C, + Vector110, Vector114, Vector118, Vector11C, + Vector120, Vector124 + } }; /** diff --git a/os/ports/GCC/ARMCMx/SAM4L/vectors.c b/os/ports/GCC/ARMCMx/SAM4L/vectors.c index eafa3ff9a..2bb769291 100644 --- a/os/ports/GCC/ARMCMx/SAM4L/vectors.c +++ b/os/ports/GCC/ARMCMx/SAM4L/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[80]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -135,31 +163,33 @@ extern void Vector17C(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0, VectorF4, VectorF8, VectorFC, - Vector100, Vector104, Vector108, Vector10C, - Vector110, Vector114, Vector118, Vector11C, - Vector120, Vector124, Vector128, Vector12C, - Vector130, Vector134, Vector138, Vector13C, - Vector140, Vector144, Vector148, Vector14C, - Vector150, Vector154, Vector158, Vector15C, - Vector160, Vector164, Vector168, Vector16C, - Vector170, Vector174, Vector178, Vector17C + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0, VectorF4, VectorF8, VectorFC, + Vector100, Vector104, Vector108, Vector10C, + Vector110, Vector114, Vector118, Vector11C, + Vector120, Vector124, Vector128, Vector12C, + Vector130, Vector134, Vector138, Vector13C, + Vector140, Vector144, Vector148, Vector14C, + Vector150, Vector154, Vector158, Vector15C, + Vector160, Vector164, Vector168, Vector16C, + Vector170, Vector174, Vector178, Vector17C + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32F0xx/vectors.c b/os/ports/GCC/ARMCMx/STM32F0xx/vectors.c index 48f7ceee4..172eca6bd 100644 --- a/os/ports/GCC/ARMCMx/STM32F0xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32F0xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[32]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -87,19 +115,21 @@ extern void VectorBC(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32F1xx/vectors.c b/os/ports/GCC/ARMCMx/STM32F1xx/vectors.c index 07145f76c..474f7d8f4 100644 --- a/os/ports/GCC/ARMCMx/STM32F1xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32F1xx/vectors.c @@ -49,8 +49,46 @@ #include "board.h" #endif +#if defined(STM32F10X_MD_VL) || defined(__DOXYGEN__) +#define NUM_VECTORS 46 +#elif defined(STM32F10X_HD) || defined(STM32F10X_XL) +#define NUM_VECTORS 60 +#elif defined(STM32F10X_CL) +#define NUM_VECTORS 68 +#else +#define NUM_VECTORS 43 +#endif + +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[NUM_VECTORS]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -110,12 +148,12 @@ extern void VectorE0(void); extern void VectorE4(void); extern void VectorE8(void); #if defined(STM32F10X_MD_VL) || defined(STM32F10X_HD) || \ - defined(STM32F10X_XL) || defined(STM32F10X_CL) + defined(STM32F10X_XL) || defined(STM32F10X_CL) extern void VectorEC(void); extern void VectorF0(void); extern void VectorF4(void); #endif -#if defined(STM32F10X_HD) || defined(STM32F10X_XL) || defined(STM32F10X_CL) +#if defined(STM32F10X_HD) || defined(STM32F10X_XL) || defined(STM32F10X_CL) extern void VectorF8(void); extern void VectorFC(void); extern void Vector100(void); @@ -149,36 +187,38 @@ extern void Vector14C(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, #if defined(STM32F10X_MD_VL) || defined(STM32F10X_HD) || \ defined(STM32F10X_XL) || defined(STM32F10X_CL) - VectorEC, VectorF0, VectorF4, + VectorEC, VectorF0, VectorF4, #endif #if defined(STM32F10X_HD) || defined(STM32F10X_XL) || defined(STM32F10X_CL) - VectorF8, VectorFC, Vector100, Vector104, - Vector108, Vector10C, Vector110, Vector114, - Vector118, Vector11C, Vector120, Vector124, - Vector128, Vector12C, + VectorF8, VectorFC, Vector100, Vector104, + Vector108, Vector10C, Vector110, Vector114, + Vector118, Vector11C, Vector120, Vector124, + Vector128, Vector12C, #endif #if defined(STM32F10X_CL) - Vector130, Vector134, Vector138, Vector13C, - Vector140, Vector144, Vector148, Vector14C + Vector130, Vector134, Vector138, Vector13C, + Vector140, Vector144, Vector148, Vector14C #endif + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32F2xx/vectors.c b/os/ports/GCC/ARMCMx/STM32F2xx/vectors.c index fce885f4f..b0926a839 100644 --- a/os/ports/GCC/ARMCMx/STM32F2xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32F2xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[81]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -136,32 +164,34 @@ extern void Vector180(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0, VectorF4, VectorF8, VectorFC, - Vector100, Vector104, Vector108, Vector10C, - Vector110, Vector114, Vector118, Vector11C, - Vector120, Vector124, Vector128, Vector12C, - Vector130, Vector134, Vector138, Vector13C, - Vector140, Vector144, Vector148, Vector14C, - Vector150, Vector154, Vector158, Vector15C, - Vector160, Vector164, Vector168, Vector16C, - Vector170, Vector174, Vector178, Vector17C, - Vector180 + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0, VectorF4, VectorF8, VectorFC, + Vector100, Vector104, Vector108, Vector10C, + Vector110, Vector114, Vector118, Vector11C, + Vector120, Vector124, Vector128, Vector12C, + Vector130, Vector134, Vector138, Vector13C, + Vector140, Vector144, Vector148, Vector14C, + Vector150, Vector154, Vector158, Vector15C, + Vector160, Vector164, Vector168, Vector16C, + Vector170, Vector174, Vector178, Vector17C, + Vector180 + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32F3xx/vectors.c b/os/ports/GCC/ARMCMx/STM32F3xx/vectors.c index a4d98878c..9adda4e2c 100644 --- a/os/ports/GCC/ARMCMx/STM32F3xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32F3xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[82]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -137,32 +165,34 @@ extern void Vector184(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0, VectorF4, VectorF8, VectorFC, - Vector100, Vector104, Vector108, Vector10C, - Vector110, Vector114, Vector118, Vector11C, - Vector120, Vector124, Vector128, Vector12C, - Vector130, Vector134, Vector138, Vector13C, - Vector140, Vector144, Vector148, Vector14C, - Vector150, Vector154, Vector158, Vector15C, - Vector160, Vector164, Vector168, Vector16C, - Vector170, Vector174, Vector178, Vector17C, - Vector180, Vector184 + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0, VectorF4, VectorF8, VectorFC, + Vector100, Vector104, Vector108, Vector10C, + Vector110, Vector114, Vector118, Vector11C, + Vector120, Vector124, Vector128, Vector12C, + Vector130, Vector134, Vector138, Vector13C, + Vector140, Vector144, Vector148, Vector14C, + Vector150, Vector154, Vector158, Vector15C, + Vector160, Vector164, Vector168, Vector16C, + Vector170, Vector174, Vector178, Vector17C, + Vector180, Vector184 + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c b/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c index 6d552779d..6e545f36c 100644 --- a/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[82]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __main_stack_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -137,32 +165,34 @@ extern void Vector184(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __main_stack_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0, VectorF4, VectorF8, VectorFC, - Vector100, Vector104, Vector108, Vector10C, - Vector110, Vector114, Vector118, Vector11C, - Vector120, Vector124, Vector128, Vector12C, - Vector130, Vector134, Vector138, Vector13C, - Vector140, Vector144, Vector148, Vector14C, - Vector150, Vector154, Vector158, Vector15C, - Vector160, Vector164, Vector168, Vector16C, - Vector170, Vector174, Vector178, Vector17C, - Vector180, Vector184 + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0, VectorF4, VectorF8, VectorFC, + Vector100, Vector104, Vector108, Vector10C, + Vector110, Vector114, Vector118, Vector11C, + Vector120, Vector124, Vector128, Vector12C, + Vector130, Vector134, Vector138, Vector13C, + Vector140, Vector144, Vector148, Vector14C, + Vector150, Vector154, Vector158, Vector15C, + Vector160, Vector164, Vector168, Vector16C, + Vector170, Vector174, Vector178, Vector17C, + Vector180, Vector184 + } }; /** diff --git a/os/ports/GCC/ARMCMx/STM32L1xx/vectors.c b/os/ports/GCC/ARMCMx/STM32L1xx/vectors.c index b66222873..7bdbd4b3f 100644 --- a/os/ports/GCC/ARMCMx/STM32L1xx/vectors.c +++ b/os/ports/GCC/ARMCMx/STM32L1xx/vectors.c @@ -30,8 +30,36 @@ #include "ch.h" +/** + * @brief Type of an IRQ vector. + */ +typedef void (*irq_vector_t)(void); + +/** + * @brief Type of a structure representing the whole vectors table. + */ +typedef struct { + uint32_t *init_stack; + irq_vector_t reset_vector; + irq_vector_t nmi_vector; + irq_vector_t hardfault_vector; + irq_vector_t memmanage_vector; + irq_vector_t busfault_vector; + irq_vector_t usagefault_vector; + irq_vector_t vector1c; + irq_vector_t vector20; + irq_vector_t vector24; + irq_vector_t vector28; + irq_vector_t svcall_vector; + irq_vector_t debugmonitor_vector; + irq_vector_t vector34; + irq_vector_t pendsv_vector; + irq_vector_t systick_vector; + irq_vector_t vectors[45]; +} vectors_t; + #if !defined(__DOXYGEN__) -extern void __ram_end__(void); +extern uint32_t __main_stack_end__; extern void ResetHandler(void); extern void NMIVector(void); extern void HardFaultVector(void); @@ -100,23 +128,25 @@ extern void VectorF0(void); #if !defined(__DOXYGEN__) __attribute__ ((section("vectors"))) #endif -void (*_vectors[])(void) = { - __ram_end__, ResetHandler, NMIVector, HardFaultVector, +vectors_t _vectors = { + &__main_stack_end__,ResetHandler, NMIVector, HardFaultVector, MemManageVector, BusFaultVector, UsageFaultVector, Vector1C, Vector20, Vector24, Vector28, SVCallVector, DebugMonitorVector, Vector34, PendSVVector, SysTickVector, - Vector40, Vector44, Vector48, Vector4C, - Vector50, Vector54, Vector58, Vector5C, - Vector60, Vector64, Vector68, Vector6C, - Vector70, Vector74, Vector78, Vector7C, - Vector80, Vector84, Vector88, Vector8C, - Vector90, Vector94, Vector98, Vector9C, - VectorA0, VectorA4, VectorA8, VectorAC, - VectorB0, VectorB4, VectorB8, VectorBC, - VectorC0, VectorC4, VectorC8, VectorCC, - VectorD0, VectorD4, VectorD8, VectorDC, - VectorE0, VectorE4, VectorE8, VectorEC, - VectorF0 + { + Vector40, Vector44, Vector48, Vector4C, + Vector50, Vector54, Vector58, Vector5C, + Vector60, Vector64, Vector68, Vector6C, + Vector70, Vector74, Vector78, Vector7C, + Vector80, Vector84, Vector88, Vector8C, + Vector90, Vector94, Vector98, Vector9C, + VectorA0, VectorA4, VectorA8, VectorAC, + VectorB0, VectorB4, VectorB8, VectorBC, + VectorC0, VectorC4, VectorC8, VectorCC, + VectorD0, VectorD4, VectorD8, VectorDC, + VectorE0, VectorE4, VectorE8, VectorEC, + VectorF0 + } }; /** diff --git a/readme.txt b/readme.txt index a31dcb240..03f4d8fae 100644 --- a/readme.txt +++ b/readme.txt @@ -82,6 +82,10 @@ ***************************************************************************** *** 2.5.1 *** +- FIX: Fixed wrong stack initializations in GCC STM32L1xx port files (bug + 3591321)(backported to 2.4.3). +- FIX: Fixed different redefinition for __main_stack_end__ symbol (bug + 3591317)(backported to 2.4.3). - FIX: Fixed workaround for errata in STM32F4-A devices (bug 3586425) (backported to 2.4.3). - FIX: Fixed error in palWritePad() macro (bug 3586230)(backported to 2.2.10