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
Linker errors on #define CH_CFG_NO_IDLE_THREAD TRUE Topic is solved
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Linker errors on #define CH_CFG_NO_IDLE_THREAD TRUE
Hi,
The fix is OK, note that if you disable the idle thread then the main() function IS the idle thread, you cannot perform chThdSleep() in there, you need to create your 1st thread then enter an infinite loop with nothing inside.
Look at NIL demos for this, NIL uses this mode by default.
Giovanni
The fix is OK, note that if you disable the idle thread then the main() function IS the idle thread, you cannot perform chThdSleep() in there, you need to create your 1st thread then enter an infinite loop with nothing inside.
Look at NIL demos for this, NIL uses this mode by default.
Giovanni
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Who is online
Users browsing this forum: No registered users and 55 guests