Page 1 of 1
ch.rlist initialization with CH_CFG_NO_IDLE_THREAD Topic is solved
Posted: Wed Apr 13, 2016 11:46 pm
by lungj
It looks like if CH_CFG_NO_IDLE_THREAD is enabled, the thread ready list's next/prev values are set incorrectly. This causes problems when attempting to sleep: an invalid thread address is selected as the next element by queue_fifo_remove in chSchGoSleepS. Is this behaviour intentional?
Code: Select all
int main(void) {
halInit();
chSysInit();
while(1) {
chThdSleepMilliseconds(1000); // This fails if CH_CFG_NO_IDLE_THREAD is TRUE.
}
return 0;
}
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Thu Apr 14, 2016 7:54 am
by Giovanni
Hi,
When CH_CFG_NO_IDLE_THREAD is enabled then the main() function is the idle thread, you must never try to sleep in there. Doing so causes the problems you are describing.
Giovanni
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Wed Apr 10, 2019 7:08 pm
by faisal
Giovanni wrote:Hi,
When CH_CFG_NO_IDLE_THREAD is enabled then the main() function is the idle thread, you must never try to sleep in there. Doing so causes the problems you are describing.
Giovanni
Is this still the case? If so, there should be an assert somewhere to catch this. I think chSchGoSleepS is the right place.
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Wed Apr 10, 2019 8:57 pm
by Giovanni
Yes, an assertion is a good idea.
Giovanni
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Thu Jan 07, 2021 2:06 pm
by Dzarda
I got burned by this again, I think that an assertion should be very suitable.
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Thu Jan 07, 2021 2:29 pm
by Giovanni
Moving into "bug reports" so it is not lost in the noise.
Giovanni
Re: ch.rlist initialization with CH_CFG_NO_IDLE_THREAD
Posted: Sat Feb 13, 2021 10:00 am
by Giovanni
Hi,
Assertion added in thunk code.
Giovanni