[ECOS] problem in thread creation and scheduling

Andrew Lunn andrew@lunn.ch
Thu Dec 2 13:21:00 GMT 2004

On Thu, Dec 02, 2004 at 06:37:44PM +0530, Vijay Padiyar wrote:
> Hi Nick
> Hey yeh you were right! Somehow we overlooked the vital fact that the
> priority levels need to be between 0 and 31 for eCos!!! Actually we're
> developing code to run on both VxWorks and eCos, so we have common variables
> that are passed to the equivalent functions in all the files. Here, we
> passed the 'priority' variable directly to 'cyg_thread_create()' without
> realizing that its value ranges between 0 and 255.
> I now added the following lines to my code:
> #ifdef ECOS
> ..
> priority = (int)(priority/8);

This might not be the best solution, depending on your code.  You
might find somebody has written code which uses the fact that VxWorks
priority 9 and 10 are different. With eCos this will not be true.  You
probably need to check all your code to see how prorities are actually
used. You might need to map each unique priority your application is
using to a unique eCos priority.

> ..
> cyg_thread_create(priority,...)
> ..
> #endif

I suggest you enable assertions. eCos will then tell you about things
like this where you are using the API wrongly.


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

More information about the Ecos-discuss mailing list