Linker errors on #define CH_CFG_NO_IDLE_THREAD TRUE
Posted: Fri Sep 03, 2021 4:32 pm
Hello Giovanni.
I have been playing with a demo RT-STM32F303RE-NUCLEO64. Having defined CH_CFG_NO_IDLE_THREAD as TRUE I get compiler warning "chDbgAssert(otp != chSysGetIdleThreadX(), "sleeping in idle thread");" and later linker errors with undefined references to "ch_core0_cfg" and "chSysGetIdleThreadX".
I tried to fix linker errors by wrapping missing symbols into #if CH_CFG_NO_IDLE_THREAD == FALSE
1) in chschd.c
+#if CH_CFG_NO_IDLE_THREAD == FALSE
chDbgAssert(otp != chSysGetIdleThreadX(), "sleeping in idle thread");
chDbgAssert(otp->owner == oip, "invalid core");
+#endif
2) in chsys.c.
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
/**
* @brief Working area for core 0 idle thread.
*/
static CH_SYS_CORE0_MEMORY THD_WORKING_AREA(ch_c0_idle_thread_wa,
PORT_IDLE_THREAD_STACK_SIZE);
+#endif // < moved here from after definition of const os_instance_config_t ch_core0_cfg = {};
With that it can be linked, but the program crashes just after entering the main-loop.
hal
ChibiOS: 21.6.x
Kernel: 7.0.0
Compiler: GCC 10.2.1 20201103 (release)
Architecture: ARMv7E-M
Core Variant: Cortex-M4
Port Info: Advanced kernel mode
Platform: STM32F303xE Analog & DSP
Board: STMicroelectronics STM32 Nucleo64-F303RE
Build time: Sep 3 2021 - 16:44:26
I have been playing with a demo RT-STM32F303RE-NUCLEO64. Having defined CH_CFG_NO_IDLE_THREAD as TRUE I get compiler warning "chDbgAssert(otp != chSysGetIdleThreadX(), "sleeping in idle thread");" and later linker errors with undefined references to "ch_core0_cfg" and "chSysGetIdleThreadX".
I tried to fix linker errors by wrapping missing symbols into #if CH_CFG_NO_IDLE_THREAD == FALSE
1) in chschd.c
+#if CH_CFG_NO_IDLE_THREAD == FALSE
chDbgAssert(otp != chSysGetIdleThreadX(), "sleeping in idle thread");
chDbgAssert(otp->owner == oip, "invalid core");
+#endif
2) in chsys.c.
#if (CH_CFG_NO_IDLE_THREAD == FALSE) || defined(__DOXYGEN__)
/**
* @brief Working area for core 0 idle thread.
*/
static CH_SYS_CORE0_MEMORY THD_WORKING_AREA(ch_c0_idle_thread_wa,
PORT_IDLE_THREAD_STACK_SIZE);
+#endif // < moved here from after definition of const os_instance_config_t ch_core0_cfg = {};
With that it can be linked, but the program crashes just after entering the main-loop.
hal
ChibiOS: 21.6.x
Kernel: 7.0.0
Compiler: GCC 10.2.1 20201103 (release)
Architecture: ARMv7E-M
Core Variant: Cortex-M4
Port Info: Advanced kernel mode
Platform: STM32F303xE Analog & DSP
Board: STMicroelectronics STM32 Nucleo64-F303RE
Build time: Sep 3 2021 - 16:44:26