diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index fc789012a..01742c946 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -332,6 +332,7 @@ extern "C" { #endif void chSysWaitSystemState(system_state_t state); void chSysInit(void); + thread_t *chSysGetIdleThreadX(void); bool chSysIntegrityCheckI(unsigned testmask); void chSysTimerHandlerI(void); syssts_t chSysGetStatusAndLockX(void); @@ -518,25 +519,6 @@ static inline void chSysNotifyInstance(os_instance_t *oip) { } #endif -#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__) -/** - * @brief Returns a pointer to the idle thread. - * @pre In order to use this function the option @p CH_CFG_NO_IDLE_THREAD - * must be disabled. - * @note The reference counter of the idle thread is not incremented but - * it is not strictly required being the idle thread a static - * object. - * - * @return Pointer to the idle thread. - * - * @xclass - */ -static inline thread_t *chSysGetIdleThreadX(void) { - - return threadref(currcore->rlist.pqueue.prev); -} -#endif /* CH_CFG_NO_IDLE_THREAD == FALSE */ - #endif /* CHSYS_H */ /** @} */ diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c index d0f3bb68d..7b3ec3f5b 100644 --- a/os/rt/src/chsys.c +++ b/os/rt/src/chsys.c @@ -55,6 +55,7 @@ CH_SYS_CORE0_MEMORY os_instance_t ch0; */ static CH_SYS_CORE0_MEMORY THD_WORKING_AREA(ch_c0_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE); +#endif #if CH_DBG_ENABLE_STACK_CHECK == TRUE extern stkalign_t __main_thread_stack_base__, __main_thread_stack_end__; @@ -77,7 +78,6 @@ const os_instance_config_t ch_core0_cfg = { .idlethread_end = THD_WORKING_AREA_END(ch_c0_idle_thread_wa) #endif }; -#endif #if (PORT_CORES_NUMBER > 1) || defined(__DOXYGEN__) /** @@ -233,6 +233,26 @@ void chSysHalt(const char *reason) { } } +/** + * @brief Returns a pointer to the idle thread. + * @note The reference counter of the idle thread is not incremented but + * it is not strictly required being the idle thread a static + * object. + * @note This function cannot be called from the idle thread itself, + * use @p chThdGetSelfX() in that case. + * + * @return Pointer to the idle thread. + * + * @xclass + */ +thread_t *chSysGetIdleThreadX(void) { + thread_t *tp = threadref(currcore->rlist.pqueue.prev); + + chDbgAssert(tp->hdr.pqueue.prio == IDLEPRIO, "not idle thread"); + + return tp; +} + /** * @brief System integrity check. * @details Performs an integrity check of the important ChibiOS/RT data diff --git a/readme.txt b/readme.txt index 7bb0d0475..84cf0a16b 100644 --- a/readme.txt +++ b/readme.txt @@ -78,34 +78,38 @@ - NEW: EFL driver and demo for STM32F3xx. - NEW: New unit test subsystem under /os/test. Now it is officially ChibiOS/TEST. -- FIX: Fixed STM32 ADCv3 differences in headers (bug #1182) - (backported to 20.3.4). -- FIX: Fixed DMAv1 compile fail on STM32L011 (bug #1181) - (backported to 20.3.4). -- FIX: Fixed error in STM32_ADCCLK_MIN for STM32F37x/hal_lld.h (bug #1180) - (backported to 20.3.4). -- FIX: Fixed direct calls to RT in STM32 RTCv2 and RTCv3 (bug #1179) - (backported to 20.3.4). -- FIX: Fixed STM32G071 mcuconf.h template not showing TIM14/15/16/17 - (bug #1178). -- FIX: Fixed path ambiguity between STM32 USARTv2 and USARTv3 drivers - (bug #1177). -- FIX: Fixed invalid DMAMUX settings in DMAv1 for some devices (bug #1176) - (backported to 20.3.4). -- FIX: Fixed wrong macro in the demo STM32F7xx-SPI-ADXL355 (bug #1175) +- FIX: Fixed CH_CFG_NO_IDLE_THREAD option causes compiler errors (bug #1183) (backported to 21.6.1). +- FIX: Fixed STM32 ADCv3 differences in headers (bug #1182) + (backported to 21.6.1)(backported to 20.3.4). +- FIX: Fixed DMAv1 compile fail on STM32L011 (bug #1181) + (backported to 21.6.1)(backported to 20.3.4). +- FIX: Fixed error in STM32_ADCCLK_MIN for STM32F37x/hal_lld.h (bug #1180) + (backported to 21.6.1)(backported to 20.3.4). +- FIX: Fixed direct calls to RT in STM32 RTCv2 and RTCv3 (bug #1179) + (backported to 21.6.1)(backported to 20.3.4). +- FIX: Fixed STM32G071 mcuconf.h template not showing TIM14/15/16/17 + (bug #1178)(backported to 21.6.1). +- FIX: Fixed path ambiguity between STM32 USARTv2 and USARTv3 drivers + (bug #1177)(backported to 21.6.1). +- FIX: Fixed invalid DMAMUX settings in DMAv1 for some devices (bug #1176) + (backported to 21.6.1)(backported to 20.3.4). +- FIX: Fixed wrong macro in the demo STM32F7xx-SPI-ADXL355 (bug #1175) + (backported to 21.6.1(backported to 21.6.1). - FIX: Fixed problem with RC initialization mask of the GPIO for the - STM32L4x3 (bug #1174)(backported to 20.3.4). + STM32L4x3 (bug #1174)(backported to 21.6.1)(backported to 20.3.4). - FIX: Fixed problem with N25Q driver (bug #1173) (backported to 21.6.1)(backported to 20.3.4). - FIX: Fixed semaphores broken when CH_CFG_USE_SEMAPHORES_PRIORITY is enabled - (bug #1172). + (bug #1172)(backported to 21.6.1). - FIX: Fixed idle thread stack area not cleared when CH_DBG_FILL_THREADS - is enabled (bug #1171). + is enabled (bug #1171)(backported to 21.6.1). - FIX: Fixed function chRegNextThread() broken when CH_CFG_USE_DYNAMIC - is disabled (bug #1170). -- FIX: Fixed insufficient information in RT registry (bug #1169). -- FIX: Fixed code base not compatible with -Wcast-align=strict (bug #1168). + is disabled (bug #1170)(backported to 21.6.1). +- FIX: Fixed insufficient information in RT registry (bug #1169) + (backported to 21.6.1). +- FIX: Fixed code base not compatible with -Wcast-align=strict (bug #1168) + (backported to 21.6.1). - FIX: Fixed wrong chconf.h for ADuCM36x demos (bug #1167) (backported to 21.6.1). - FIX: Fixed missing constant in ADuCM36x hal_lld.c (bug #1166)