[ECOS] Re: Is main() a normal thread ?
Savin Zlobec
savin@elatec.si
Tue Sep 30 13:36:00 GMT 2003
Claudio Leonel wrote:
>> Claudio Leonel wrote:
>>
>>> Hi,
>>>
>>> Savin Zlobec wrote:
>>>
>>>> Claudio Leonel wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I thought main() was a normal thread but if I ran the
>>>>> following application step by step in gdb there is no
>>>>> return from the function cyg_thread_delay(). Apparently
>>>>> it hangs in the call to cyg_thread_delay().
>>>>>
>>>>
>>>> Check the CYGSEM_LIBC_STARTUP_MAIN_THREAD option -
>>>> it controls how main() is invoked (from an eCos thread or not).
>>>
>>>
>>>
>>>
>>> It is enabled: main() will be invoked as an eCos thread
>>> with 8192 bytes of stack and priority 10.
>>> If I interrupt the application in gdb and execute 'info threads'
>>> main() appears in the thread list.
>>>
>>> The most strange thing is that, I if precede 'cyg_thread_delay(100)'
>>> with a diag_printf("..."), cyg_thread_delay() works and returns
>>> after 100 ticks:
>>>
>>> ---------------------------------------------------------------
>>> int main(void) {
>>> while (1) {
>>> diag_printf("...\n"); // Works if I insert this line !
>>> cyg_thread_delay(100);
>>> } }
>>> ---------------------------------------------------------------
>>
>>
>>
>> Most strange. Maybe you should give more info about your configuration,
>> platform, eCos version and tools. Is the above all of your program or
>> are you
>> doing something else before main (in cyg_user_start) ?
>
>
> It is all my program !
> My configuration is:
> - arm-elf tools from the eCos 2.0 package (gcc 3.2.1)
> - eCos configuration 2.0
> - eCos from cvs
> - AT91EB55 evaluation board from Atmel with redboot in Flash with
> AT91M55800A CPU (ARM7TDMI).
> - Development host: Linux 2.4.20
>
> Now I am not using main() anymore and using cyg_user_start() instead
> and continuing the project, but is not confortable to know that
> something is wrong and can manifest itself in other ways.
I agree, this should probably be investigated.
Did you try enabling asserts or/and doing something else before thread
delay (diag_printf does a lot of things)?
Maybe you should try building ecos from another setup/template.
savin
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list