diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/.project b/demos/LPC21xx/RT-LPC214x-OLIMEX/.project index 2afbc5432..4e56772ff 100644 --- a/demos/LPC21xx/RT-LPC214x-OLIMEX/.project +++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/.project @@ -34,5 +34,10 @@ 2 CHIBIOS/os + + test + 2 + CHIBIOS/test + diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h b/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h index e8d5c8e9e..6b29188af 100644 --- a/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h +++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h @@ -332,7 +332,7 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#define CH_DBG_SYSTEM_STATE_CHECK TRUE /** * @brief Debug option, parameters checks. @@ -341,7 +341,7 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#define CH_DBG_ENABLE_CHECKS TRUE /** * @brief Debug option, consistency checks. @@ -351,7 +351,7 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#define CH_DBG_ENABLE_ASSERTS TRUE /** * @brief Debug option, trace buffer. @@ -372,7 +372,7 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#define CH_DBG_ENABLE_STACK_CHECK TRUE /** * @brief Debug option, stacks initialization. @@ -382,7 +382,7 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#define CH_DBG_FILL_THREADS TRUE /** * @brief Debug option, threads profiling. @@ -393,7 +393,7 @@ * @note This debug option is not currently compatible with the * tickless mode. */ -#define CH_DBG_THREADS_PROFILING FALSE +#define CH_DBG_THREADS_PROFILING TRUE /** @} */ diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/debug/RT-LPC214x-OLIMEX (OpenOCD, Flash and Run).launch b/demos/LPC21xx/RT-LPC214x-OLIMEX/debug/RT-LPC214x-OLIMEX (OpenOCD, Flash and Run).launch index 3caa1e031..8705f705f 100644 --- a/demos/LPC21xx/RT-LPC214x-OLIMEX/debug/RT-LPC214x-OLIMEX (OpenOCD, Flash and Run).launch +++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/debug/RT-LPC214x-OLIMEX (OpenOCD, Flash and Run).launch @@ -6,7 +6,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/os/rt/ports/ARM/chcore.h b/os/rt/ports/ARM/chcore.h index bcf27d719..daaea7e02 100644 --- a/os/rt/ports/ARM/chcore.h +++ b/os/rt/ports/ARM/chcore.h @@ -307,7 +307,7 @@ struct context { #if CH_DBG_ENABLE_STACK_CHECK #define port_switch(ntp, otp) { \ - register struct intctx *r13 asm ("r13"); \ + register struct port_intctx *r13 asm ("r13"); \ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \ chSysHalt("stack overflow"); \ _port_switch_thumb(ntp, otp); \ @@ -320,7 +320,7 @@ struct context { #if CH_DBG_ENABLE_STACK_CHECK #define port_switch(ntp, otp) { \ - register struct intctx *r13 asm ("r13"); \ + register struct port_intctx *r13 asm ("r13"); \ if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \ chSysHalt("stack overflow"); \ _port_switch_arm(ntp, otp); \ diff --git a/os/rt/ports/ARM/compilers/GCC/chcoreasm.s b/os/rt/ports/ARM/compilers/GCC/chcoreasm.s index 7c33135bf..18a0772e7 100644 --- a/os/rt/ports/ARM/compilers/GCC/chcoreasm.s +++ b/os/rt/ports/ARM/compilers/GCC/chcoreasm.s @@ -219,22 +219,22 @@ _port_irq_common: bx r0 .code 16 #if CH_DBG_SYSTEM_STATE_CHECK - bl dbg_check_lock + bl _dbg_check_lock #endif bl chSchDoReschedule #if CH_DBG_SYSTEM_STATE_CHECK - bl dbg_check_unlock + bl _dbg_check_unlock #endif mov lr, pc bx lr .code 32 #else /* !defined(THUMB_NO_INTERWORKING) */ #if CH_DBG_SYSTEM_STATE_CHECK - bl dbg_check_lock + bl _dbg_check_lock #endif bl chSchDoReschedule #if CH_DBG_SYSTEM_STATE_CHECK - bl dbg_check_unlock + bl _dbg_check_unlock #endif #endif /* !defined(THUMB_NO_INTERWORKING) */ @@ -258,9 +258,17 @@ _port_irq_common: .globl _port_thread_start _port_thread_start: #if CH_DBG_SYSTEM_STATE_CHECK - mov r0, #0 - ldr r1, =dbg_lock_cnt - str r0, [r1] +#if defined(THUMB_NO_INTERWORKING) + add r0, pc, #1 + bx r0 + .code 16 +#endif + bl _dbg_check_unlock +#if defined(THUMB_NO_INTERWORKING) + mov lr, pc + bx lr + .code 32 +#endif #endif msr CPSR_c, #MODE_SYS #if defined(THUMB_NO_INTERWORKING) diff --git a/test/rt/testmtx.c b/test/rt/testmtx.c index ccf7b9497..3fea7036b 100644 --- a/test/rt/testmtx.c +++ b/test/rt/testmtx.c @@ -159,7 +159,7 @@ static msg_t thread2L(void *p) { (void)p; chMtxLock(&m1); test_cpu_pulse(40); - chMtxUnlock(); + chMtxUnlock(&m1); test_cpu_pulse(10); test_emit_token('C'); return 0; @@ -182,7 +182,7 @@ static msg_t thread2H(void *p) { chThdSleepMilliseconds(40); chMtxLock(&m1); test_cpu_pulse(10); - chMtxUnlock(); + chMtxUnlock(&m1); test_emit_token('A'); return 0; } @@ -250,7 +250,7 @@ static msg_t thread3LL(void *p) { (void)p; chMtxLock(&m1); test_cpu_pulse(30); - chMtxUnlock(); + chMtxUnlock(&m1); test_emit_token('E'); return 0; } @@ -264,9 +264,9 @@ static msg_t thread3L(void *p) { test_cpu_pulse(20); chMtxLock(&m1); test_cpu_pulse(10); - chMtxUnlock(); + chMtxUnlock(&m1); test_cpu_pulse(10); - chMtxUnlock(); + chMtxUnlock(&m2); test_emit_token('D'); return 0; } @@ -278,7 +278,7 @@ static msg_t thread3M(void *p) { chThdSleepMilliseconds(20); chMtxLock(&m2); test_cpu_pulse(10); - chMtxUnlock(); + chMtxUnlock(&m2); test_emit_token('C'); return 0; } @@ -300,7 +300,7 @@ static msg_t thread3HH(void *p) { chThdSleepMilliseconds(50); chMtxLock(&m2); test_cpu_pulse(10); - chMtxUnlock(); + chMtxUnlock(&m2); test_emit_token('A'); return 0; }