From f03a012a2d196dd26b0c8ae38bcd397956346352 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 5 Jul 2010 12:48:35 +0000 Subject: Fixed bug 3025133. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2054 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARMCMx/chcore.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'os') diff --git a/os/ports/GCC/ARMCMx/chcore.h b/os/ports/GCC/ARMCMx/chcore.h index 7ccc59290..c0396c1d5 100644 --- a/os/ports/GCC/ARMCMx/chcore.h +++ b/os/ports/GCC/ARMCMx/chcore.h @@ -128,7 +128,7 @@ * to user in the ARMv6-M port. */ #ifndef CORTEX_PRIORITY_SVCALL -#define CORTEX_PRIORITY_SVCALL (CORTEX_MAXIMUM_PRIORITY + 1) +#define CORTEX_PRIORITY_SVCALL (CORTEX_MAXIMUM_PRIORITY + 1) #else /* If it is externally redefined then better perform a validity check on it.*/ #if !CORTEX_IS_VALID_PRIORITY(CORTEX_PRIORITY_SVCALL) @@ -146,7 +146,7 @@ * the minimum priority level. */ #ifndef CORTEX_PRIORITY_PENDSV -#define CORTEX_PRIORITY_PENDSV CORTEX_MINIMUM_PRIORITY +#define CORTEX_PRIORITY_PENDSV CORTEX_MINIMUM_PRIORITY #else /* If it is externally redefined then better perform a validity check on it.*/ #if !CORTEX_IS_VALID_PRIORITY(CORTEX_PRIORITY_PENDSV) @@ -164,6 +164,17 @@ #define CORTEX_BASEPRI_KERNEL CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SVCALL+1) #endif +/** + * @brief Stack alignment enforcement. + * @note The default value is 64 in order to comply with EABI, reducing + * the value to 32 can save some RAM space if you don't care about + * binary compatibility with EABI compiled libraries. + * @note Allowed values are 32 or 64. + */ +#ifndef CORTEX_STACK_ALIGNMENT +#define CORTEX_STACK_ALIGNMENT 64 +#endif + /*===========================================================================*/ /* Port exported info. */ /*===========================================================================*/ @@ -211,9 +222,15 @@ /*===========================================================================*/ /** - * @brief 32 bits stack and memory alignment enforcement. + * @brief Stack and memory alignment enforcement. */ -typedef uint32_t stkalign_t; +#if (CORTEX_STACK_ALIGNMENT == 64) || defined(__DOXYGEN__) +typedef uint64_t stkalign_t __attribute__ ((aligned (8))); +#elif CORTEX_STACK_ALIGNMENT == 32 +typedef uint32_t stkalign_t __attribute__ ((aligned (4))); +#else +#error "invalid stack alignment selected" +#endif /** * @brief Generic ARM register. -- cgit v1.2.3