Page 1 of 1

ChibiOS 19.1.0, os-less bug osalSysLock

Posted: Tue Nov 05, 2019 2:25 pm
by Shevchenko
Hi, osalSysLock does not work properly in ChibiOS 19.1.0. I tested on the stm32f429 processor.
static inline void osalSysLock (void) {

#if CORTEX_MODEL == 0
  __disable_irq ();
#else
  __set_BASEPRI (OSAL_IRQ_MAXIMUM_PRIORITY);
#endif
}


OSAL_IRQ_MAXIMUM_PRIORITY for CortexM! = 0 is defined as 1.
#if (CORTEX_MODEL == 0) || defined (__ DOXYGEN__)
#define OSAL_IRQ_MAXIMUM_PRIORITY 0
#else
#define OSAL_IRQ_MAXIMUM_PRIORITY 1
#endif


If we open the Programming manual from ST it can be seen that the first 4 bits reserved.
screen.png

After setting BASEPRI as 1, if the reader again registers then it gets its value as 0. It means that interrupts are not disabled. And after testing on stm32f429xi, interrupts are not disabled after calling the osalSysLock function. To solve this problem I have improved this function:

static inline void osalSysLock (void) {

#if CORTEX_MODEL == 0
  __disable_irq ();
#else
  __set_BASEPRI (OSAL_IRQ_MAXIMUM_PRIORITY << 4);
#endif
}

Re: ChibiOS 19.1.0, os-less bug osalSysLock

Posted: Sat Nov 09, 2019 9:08 am
by Giovanni
Hi,

Thanks for finding this.

Fixed as bug #1056.

Giovanni