From fb439b48b91534c3dd00f204b5023d0528d93ad8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 13:49:28 +0000 Subject: [PATCH] Fixed bug Fixed bug 3064274. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2176 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARMCMx/old/chcore_v7m.h | 26 ++++++++++++++++---------- readme.txt | 4 +++- todo.txt | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/os/ports/GCC/ARMCMx/old/chcore_v7m.h b/os/ports/GCC/ARMCMx/old/chcore_v7m.h index 9b92b851a..480542db1 100644 --- a/os/ports/GCC/ARMCMx/old/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/old/chcore_v7m.h @@ -263,17 +263,23 @@ struct intctx { * @param[in] ntp the thread to be switched in * @param[in] otp the thread to be switched out */ -static INLINE void port_switch(Thread *ntp, Thread *otp) { - register Thread *_ntp asm ("r0") = (ntp); - register Thread *_otp asm ("r1") = (otp); -#if CH_DBG_ENABLE_STACK_CHECK - register char *sp asm ("sp"); - if (sp - sizeof(struct intctx) - sizeof(Thread) < (char *)_otp) - asm volatile ("movs r0, #0 \n\t" - "b chDbgPanic"); -#endif /* CH_DBG_ENABLE_STACK_CHECK */ - asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); +#if !CH_DBG_ENABLE_STACK_CHECK || defined(__DOXYGEN__) +#define port_switch(ntp, otp) { \ + register Thread *_ntp asm ("r0") = (ntp); \ + register Thread *_otp asm ("r1") = (otp); \ + asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \ } +#else /* CH_DBG_ENABLE_STACK_CHECK */ +#define port_switch(ntp, otp) { \ + register Thread *_ntp asm ("r0") = (ntp); \ + register Thread *_otp asm ("r1") = (otp); \ + register struct intctx *r13 asm ("r13"); \ + if ((void *)(r13 - 1) < (void *)(_otp + 1)) \ + asm volatile ("movs r0, #0 \n\t" \ + "b chDbgPanic"); \ + asm volatile ("svc #0" : : "r" (_otp), "r" (_ntp) : "memory"); \ +} +#endif /* CH_DBG_ENABLE_STACK_CHECK */ #ifdef __cplusplus extern "C" { diff --git a/readme.txt b/readme.txt index dd43d05e4..591789598 100644 --- a/readme.txt +++ b/readme.txt @@ -62,6 +62,8 @@ ***************************************************************************** *** 2.1.2 *** +- FIX: Fixed broken CH_DBG_ENABLE_STACK_CHECK option in legacy CM3 port (bug + 3064274)(backported to 2.0.5). - FIX: Fixed CAN_USE_SLEEP_MODE setting (bug 3064204)(backported to 2.0.5). - FIX: Fixed potential issue with GCC reorganizing instructions around "asm volatile" statements (bug 3058731)(backported in 2.0.4). @@ -83,7 +85,7 @@ - NEW: Added board files for the Olimex STM32-H103. - NEW: New kernel APIs chSysGetIdleThread() and chThdGetTicks(), the new APIs are simple macros so there is no footprint overhead. -- NEW: New I2C device driver model (no implementations yet). +- NEW: New I2C device driver model (not complete and no implementations yet). - NEW: Added to the UART driver the capability to return the number of not yet transferred frames when stopping an operation. - NEW: Added more compile-time checks to the various STM32 device drivers. diff --git a/todo.txt b/todo.txt index 72aac6c09..2d95a603b 100644 --- a/todo.txt +++ b/todo.txt @@ -13,11 +13,11 @@ Within 2.1.x (hopefully) "last byte transmitted (RS485)", simple implementation, verifiable. * Rework STM32 drivers to use friendly IRQ names and centralized DMA macros. +* I-class functions for the ADC/PWM drivers. X Resist doing more changes and optimizations in the kernel, fixes only. X File System infrastructure. X General HAL improvements. X I2C device driver class support. -X I-class functions for the ADC/PWM drivers. - Evaluate making SPI and CAN drivers callback-based. - MAC driver for STM32F105/STM32F107 (hardware missing). - Device drivers for STM8 (SPI, ADC, PWM, bring it on par with STM32).