This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Idle thread vanished!!!


Brendan Fennell <brendan.fennell@gmail.com> writes:

> Hello,
> 
> I'm trying to bring up eCos on an ARM9 board, the starting point I
> have is a port for Redboot but I would like to use the full feature
> set of eCos. I have put together a configuration which I can program
> to the board and have basic I/O over serial.
> The main entry point for my code 'cyg_start' runs as expected but the
> thread I create does not start. I enabled debug trace and the first
> assert I get is "ASSERT FAIL: <2>mlqueue.cxx[265]void
> Cyg_Scheduler_Implementation::add_thread() Idle thread vanished!!!"
> 
> Can anyone tell me why I would get the ASSERT above?
> 
> thanks,
> Brendan.
> 
> ========= code ===========
> voidÂcyg_start(void)
> {
> ÂÂ ÂunsignedÂcyg_start_count = 0;
> ÂÂ Âdiag_printf("Hello from cyg_start: #%u\n", cyg_start_count++);
> ÂÂ Âcyg_thread_create(1,Âtestthd_main, (cyg_addrword_t) 0, "testthd",
> ÂÂ Â Â Â Â Â Â Â Â Â Â(void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
> ÂÂ Âcyg_thread_resume(thread[0]);
> ÂÂ Âfor(;;)
> ÂÂ Â{
> ÂÂ Â Â Âcyg_thread_delay (100);
> ÂÂ Â}
> }

You cannot do the above. cyg_start() runs before the scheduler
starts. In fact, you have to start it yourself here. So replace the
for(;;) loop with:

    cyg_scheduler_start();


Your program should then run as expected.


-- 
Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]