From 978e34eed2ed391f57b25e007b63f2938f8af0f6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Aug 2011 12:32:10 +0000 Subject: [PATCH] System state check verified in ARM GCC port. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3225 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-LPC214x-GCC/chconf.h | 12 ++++++------ os/ports/GCC/ARM/chcoreasm.s | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h index 6a365d96a..eb4087969 100644 --- a/demos/ARM7-LPC214x-GCC/chconf.h +++ b/demos/ARM7-LPC214x-GCC/chconf.h @@ -361,7 +361,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#define CH_DBG_SYSTEM_STATE_CHECK TRUE #endif /** @@ -372,7 +372,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_CHECKS FALSE +#define CH_DBG_ENABLE_CHECKS TRUE #endif /** @@ -384,7 +384,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_ASSERTS FALSE +#define CH_DBG_ENABLE_ASSERTS TRUE #endif /** @@ -395,7 +395,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_ENABLE_TRACE TRUE #endif /** @@ -409,7 +409,7 @@ * @p panic_msg variable set to @p NULL. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#define CH_DBG_ENABLE_STACK_CHECK TRUE #endif /** @@ -421,7 +421,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) -#define CH_DBG_FILL_THREADS FALSE +#define CH_DBG_FILL_THREADS TRUE #endif /** diff --git a/os/ports/GCC/ARM/chcoreasm.s b/os/ports/GCC/ARM/chcoreasm.s index 2266d3f1a..9b65c14b0 100644 --- a/os/ports/GCC/ARM/chcoreasm.s +++ b/os/ports/GCC/ARM/chcoreasm.s @@ -28,6 +28,9 @@ #include "chconf.h" +#define FALSE 0 +#define TRUE 1 + #if !defined(__DOXYGEN__) .set MODE_USR, 0x10 @@ -190,12 +193,24 @@ _port_irq_common: add r0, pc, #1 bx r0 .code 16 +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_lock +#endif bl chSchDoReschedule +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_unlock +#endif mov lr, pc bx lr .code 32 #else /* !THUMB_NO_INTERWORKING */ +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_lock +#endif bl chSchDoReschedule +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_unlock +#endif #endif /* !THUMB_NO_INTERWORKING */ // Re-establish the IRQ conditions again. @@ -210,12 +225,18 @@ _port_irq_common: /* * Threads trampoline code. - * NOTE: The threads always start in ARM mode then switch to the thread-function mode. + * NOTE: The threads always start in ARM mode and then switches to the + * thread-function mode. */ .balign 16 .code 32 .globl _port_thread_start _port_thread_start: +#if CH_DBG_SYSTEM_STATE_CHECK + mov r0, #0 + ldr r1, =dbg_lock_cnt + str r0, [r1] +#endif msr CPSR_c, #MODE_SYS #ifndef THUMB_NO_INTERWORKING mov r0, r5