public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Re: Fwd: Re: how to implement EDF scheduling in eCos
       [not found] <186ad4051001190626t25f15afds8720515cba54bc91@mail.gmail.com>
@ 2010-01-20  1:25 ` Nodir Kodirov
  2010-01-20 15:01   ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-20  1:25 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

Hello everyone,

Thank you Fabian and Friedrich, your comments are highly appreciated,
I am following them.

Now I have done with eCos thread extension for EDF support. I can
build my eCos library and link it to my application successfully. But
there is one problem, when I run my application in x86 Advantech
board, it "hangs up" without any output after thread creation (with an
extended properties).

In my void cyg_user_start(void) function I have these lines:

printf("Now thread extended with tree more properties\n");
printf("Running with EDF scheduler\n");		
cyg_mutex_init(&cliblock);
cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, "Thread A",
(void *) stack[0], 4096, &simple_threadA, &thread_s[0],	11, 12, 13);
cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, "Thread B",
(void *) stack[1], 4096, &simple_threadB, &thread_s[1],	21, 22, 23);
printf("Created threads with extended properties\n");
cyg_thread_resume(simple_threadA);
cyg_thread_resume(simple_threadB);

Here 11,12,13 (and 21,22,23) are deadline, wcet, period of the first
(second) thread respectively. In my application output I have
> Now thread extended with tree more properties;
> Running with EDF scheduler
only. Application does not output "Created threads with extended
properties", which I think to be error.

Actually, I am recording each of my modification to eCos repository in
PPT file (which I have enclosed here
http://rapidshare.com/files/338010937/eCos_EDF_implementation_-_2.pdf.html
) and I have my application code also
attached. Can anyone have a look and give me idea, why it is hanging up.

One more question is, there are kernel tests in eCos repository, are
they to check eCos kernel after such a modification?

Thank you in advance!
Regards,
Nodir.

[-- Attachment #2: sixthreads.c --]
[-- Type: application/octet-stream, Size: 2559 bytes --]

#include <cyg/kernel/kapi.h>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

/* now declare (and allocate space for) some kernel objects,
   like the six threads we will use */
cyg_thread thread_s[2];		/* space for six thread objects */

char stack[2][4096];		/* space for six 4K stacks */

/* now the handles for the threads */
cyg_handle_t simple_threadA, simple_threadB;

/* and now variables for the procedure which is the thread */
cyg_thread_entry_t simple_program;

/* and now a mutex to protect calls to the C library */
cyg_mutex_t cliblock;

/* we install our own startup routine which sets up threads */
void cyg_user_start(void)
{
	printf("After thread extension with EDF data structure\n");
	printf("and with underlying file support (edf.cxx, edf.hxx)\n");
	printf("Now thread extended with tree more properties\n");
	printf("Running with EDF scheduler\n");
	printf("Entering sixthreads' cyg_user_start() function\n");
	
	cyg_mutex_init(&cliblock);
	
	cyg_thread_create(4, simple_program, (cyg_addrword_t) 0,
		"Thread A", (void *) stack[0], 4096,
		 &simple_threadA, &thread_s[0],
		11, 12, 13);
	cyg_thread_create(4, simple_program, (cyg_addrword_t) 1,
		"Thread B", (void *) stack[1], 4096,
		&simple_threadB, &thread_s[1],
		21, 22, 23);
	
	printf("Created threads with extended properties\n");
	cyg_thread_resume(simple_threadA);
	cyg_thread_resume(simple_threadB);
}

/* this is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
	int message = (int) data;
	int delay;
	
	printf("Beginning execution; thread data is %d\n", message);
	
	cyg_thread_delay(200);
	cyg_thread_info info;
	cyg_handle_t cur_thread;
	
	for (;;) {
		delay = 400 + (rand() % 50);
		cur_thread = cyg_thread_self();
		/* note: printf() must be protected by a
			call to cyg_mutex_lock() */
		cyg_mutex_lock(&cliblock); {
			printf("Thread %d: and now a delay of %d clock ticks\n",
				message, delay);
			cyg_thread_get_info(cur_thread, cyg_thread_get_id( cyg_thread_self() ), &info);
			printf("ID: %d, name: %10s, ser pri: %d cur pri: %d stack use: %d\n\n", 
				info.id, info.name,  info.set_pri, info.cur_pri, info.stack_used);
			
			printf("ID: %d, name: %10s, ser pri: %d cur pri: %d stack use: %d\n\n", 
				info.id, info.name,  info.set_pri, info.cur_pri, info.stack_used);
			/* printf("Name of the thread is %d\n",
				cyg_thread_get_id( cyg_thread_self() ));*/
		}
		
		cyg_mutex_unlock(&cliblock);
		cyg_thread_delay(delay);
	}
}

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-20  1:25 ` [ECOS] Re: Fwd: Re: how to implement EDF scheduling in eCos Nodir Kodirov
@ 2010-01-20 15:01   ` John Dallaway
  2010-01-20 15:19     ` Nodir Kodirov
  2010-01-20 15:25     ` Fabian Scheler
  0 siblings, 2 replies; 17+ messages in thread
From: John Dallaway @ 2010-01-20 15:01 UTC (permalink / raw)
  To: Nodir Kodirov; +Cc: ecos-discuss

Hi Nodir

Nodir Kodirov wrote:

[ snip ]

> cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, "Thread A",
> (void *) stack[0], 4096, &simple_threadA, &thread_s[0],	11, 12, 13);
> cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, "Thread B",
> (void *) stack[1], 4096, &simple_threadB, &thread_s[1],	21, 22, 23);
> printf("Created threads with extended properties\n");
> 
> Here 11,12,13 (and 21,22,23) are deadline, wcet, period of the first
> (second) thread respectively.

To avoid changing the kernel API, I suggest that you pass the deadline,
wcet and period by using the sched_info parameter of the
cyg_thread_create() call as the address of a scheduler-specific data
structure.

> One more question is, there are kernel tests in eCos repository, are
> they to check eCos kernel after such a modification?

Many of the kernel tests will exercise the scheduler. Some of the
existing kernel tests require a specific scheduler implementation, but
many should be scheduler-independent.

Unfortunately, the tests are written to assume that the sched_info
parameter of the cyg_thread_create() call contains the initial thread
priority. Some minor changes to the tests will therefore be necessary.
You can always use cyg_thread_set_priority() to set an initial priority
following thread creation.

You should also consider writing your own scheduler-specific test(s).

I hope this helps...

John Dallaway
eCos maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-20 15:01   ` [ECOS] " John Dallaway
@ 2010-01-20 15:19     ` Nodir Kodirov
  2010-01-21  8:41       ` John Dallaway
  2010-01-20 15:25     ` Fabian Scheler
  1 sibling, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-20 15:19 UTC (permalink / raw)
  To: John Dallaway; +Cc: ecos-discuss

Hi John,

> by using the sched_info parameter of the
> cyg_thread_create() call as the address of a scheduler-specific data
> structure.

Can you give more detail explanation how to do it? Example will be great!

Thanks,
Nodir.


2010/1/21 John Dallaway <john@dallaway.org.uk>
>
> [ snip ]
>
> > cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, "Thread A",
> > (void *) stack[0], 4096, &simple_threadA, &thread_s[0],       11, 12, 13);
> > cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, "Thread B",
> > (void *) stack[1], 4096, &simple_threadB, &thread_s[1],       21, 22, 23);
> > printf("Created threads with extended properties\n");
> >
> > Here 11,12,13 (and 21,22,23) are deadline, wcet, period of the first
> > (second) thread respectively.
>
> To avoid changing the kernel API, I suggest that you pass the deadline,
> wcet and period by using the sched_info parameter of the
> cyg_thread_create() call as the address of a scheduler-specific data
> structure.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-20 15:01   ` [ECOS] " John Dallaway
  2010-01-20 15:19     ` Nodir Kodirov
@ 2010-01-20 15:25     ` Fabian Scheler
  1 sibling, 0 replies; 17+ messages in thread
From: Fabian Scheler @ 2010-01-20 15:25 UTC (permalink / raw)
  To: John Dallaway; +Cc: Nodir Kodirov, ecos-discuss

>> cyg_thread_create(4, simple_program, (cyg_addrword_t) 0, "Thread A",
>> (void *) stack[0], 4096, &simple_threadA, &thread_s[0],       11, 12, 13);
>> cyg_thread_create(4, simple_program, (cyg_addrword_t) 1, "Thread B",
>> (void *) stack[1], 4096, &simple_threadB, &thread_s[1],       21, 22, 23);
>> printf("Created threads with extended properties\n");
>>
>> Here 11,12,13 (and 21,22,23) are deadline, wcet, period of the first
>> (second) thread respectively.
>
> To avoid changing the kernel API, I suggest that you pass the deadline,
> wcet and period by using the sched_info parameter of the
> cyg_thread_create() call as the address of a scheduler-specific data
> structure.

Well, I think this part of the API is scheduler specific and an EDF
scheduler just differs from a MLQ scheduler. So, IMO it would be ok
the provide an API that is specific for the EDF scheduler. I believe,
the idea to *just* replace the MLQ scheduler by an EDF scheduler in
some application is not a wise one, so a different API should not hurt
that bad.

>> One more question is, there are kernel tests in eCos repository, are
>> they to check eCos kernel after such a modification?
>
> Many of the kernel tests will exercise the scheduler. Some of the
> existing kernel tests require a specific scheduler implementation, but
> many should be scheduler-independent.
>
> Unfortunately, the tests are written to assume that the sched_info
> parameter of the cyg_thread_create() call contains the initial thread
> priority. Some minor changes to the tests will therefore be necessary.
> You can always use cyg_thread_set_priority() to set an initial priority
> following thread creation.
>
> You should also consider writing your own scheduler-specific test(s).

I would not even consider to get all the existing scheduler tests
running. Many testcases won't work because the concepts of static
priorities and the EDF scheduler differ to much.

Just replacing the scheduler also is not enough, if you want to
provide EDF scheduling within eCos, e.g. the synchronisation protocols
implemented within the mutex have to be adapted for dynamic
priorities, too.

Ciao, Fabian

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-20 15:19     ` Nodir Kodirov
@ 2010-01-21  8:41       ` John Dallaway
  2010-01-21  8:58         ` Fabian Scheler
  2010-01-23  7:28         ` Nodir Kodirov
  0 siblings, 2 replies; 17+ messages in thread
From: John Dallaway @ 2010-01-21  8:41 UTC (permalink / raw)
  To: Nodir Qodirov; +Cc: eCos Discussion

Hi Nodir

Nodir Kodirov wrote:

>> by using the sched_info parameter of the
>> cyg_thread_create() call as the address of a scheduler-specific data
>> structure.
> 
> Can you give more detail explanation how to do it? Example will be great!

I was envisaging something like this:

  struct cyg_edf_sched_info_t {
    cyg_tick_count_t deadline;
    cyg_tick_count_t wcet;
    cyg_tick_count_t period;
  };

  cyg_edf_sched_info_t myinfo = {11, 12, 13};
  cyg_thread_create((cyg_addrword_t) &myinfo, simple_program, ...

John Dallaway
eCos maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-21  8:41       ` John Dallaway
@ 2010-01-21  8:58         ` Fabian Scheler
  2010-01-23  7:28         ` Nodir Kodirov
  1 sibling, 0 replies; 17+ messages in thread
From: Fabian Scheler @ 2010-01-21  8:58 UTC (permalink / raw)
  To: eCos Discussion

>>> by using the sched_info parameter of the
>>> cyg_thread_create() call as the address of a scheduler-specific data
>>> structure.
>>
>> Can you give more detail explanation how to do it? Example will be great!
>
> I was envisaging something like this:
>
>  struct cyg_edf_sched_info_t {
>    cyg_tick_count_t deadline;
>    cyg_tick_count_t wcet;
>    cyg_tick_count_t period;
>  };
>
>  cyg_edf_sched_info_t myinfo = {11, 12, 13};
>  cyg_thread_create((cyg_addrword_t) &myinfo, simple_program, ...

ah, sorry - the first parameter is meant to be some kind of generic
scheduler information parameter not necessarily a static priority. I
should have taken a closer look into the documentation before my first
comment.

Ciao, Fabian

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-21  8:41       ` John Dallaway
  2010-01-21  8:58         ` Fabian Scheler
@ 2010-01-23  7:28         ` Nodir Kodirov
  2010-01-23 10:08           ` Nodir Kodirov
  1 sibling, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-23  7:28 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]

Hi John, Fabian and all,

> Fabian wrote:
> ah, sorry - the first parameter is meant to be some kind of generic
> scheduler information parameter not necessarily a static priority. I
> should have taken a closer look into the documentation before my first
> comment.

Me too, I thought it to be priority. Thank you for light John! I am
following your advice.

Now, I added:

typedef struct
{
    cyg_tick_count deadline;
    cyg_tick_count wcet;
    cyg_tick_count period;
} cyg_edf_sched_info;
typedef cyg_edf_sched_info cyg_edf_sched_info_t;

to cyg/kernel/ktypes.h
Next, I built eCos library and linked my application to it. Run on my
x86 Advantech target board and it works fine.

Next, I defined additional member variable (to be used in
Cyg_SchedThread_Implementation class Constructor, to extract
[deadline, wcet and period] properties from *sched_info* generic
parameter and use it for schedule() method)
> cyg_edf_sched_info_t *thread_edf_info;
to Cyg_SchedThread_Implementation class, where we can define scheduler
specific members for threads (file src/sched/edf.hxx line #252). You
can have a look at the same place with mlqueue.hxx.

But, there is problem.
When I include thread_edf_info to Cyg_SchedThread_Implementation
class, I can build my eCos library, link it my eCos application and
port it to board. But, when I run eCos application in target board,
application halts after thread creation. However, I didn't modify any
place of neither Cyg_SchedThread_Implementation class constructor nor
cyg_thread_create() function yet.

So, my question is, can I modify Cyg_SchedThread_Implementation class
(just adding one more class member variable)?

Herein I have attached my simple eCos application source file also.
Note: in my target board application halts before printf("Threads are
created\n"); line.

Any help is highly appreciated!

Thanks,
Nodir.

> I was envisaging something like this:
>
>  struct cyg_edf_sched_info_t {
>    cyg_tick_count_t deadline;
>    cyg_tick_count_t wcet;
>    cyg_tick_count_t period;
>  };
>
>  cyg_edf_sched_info_t myinfo = {11, 12, 13};
>  cyg_thread_create((cyg_addrword_t) &myinfo, simple_program, ...
>
> John Dallaway
> eCos maintainer

[-- Attachment #2: edf_threads.c --]
[-- Type: application/octet-stream, Size: 2331 bytes --]

#include <cyg/kernel/kapi.h>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

/* now declare (and allocate space for) some kernel objects,
   like the edf threads we will use */
cyg_thread thread_s[2];		/* space for EDF thread objects */

char stack[2][4096];		/* space for EDF 4K stacks */

/* now the handles for the threads */
cyg_handle_t simple_threadA, simple_threadB;

/* and now variables for the procedure which is the thread */
cyg_thread_entry_t simple_program;

/* and now a mutex to protect calls to the C library */
cyg_mutex_t cliblock;

/* we install our own startup routine which sets up threads */
void cyg_user_start(void)
{
	printf("With underlying file support (edf.cxx, edf.hxx)\n");
	printf("Just running with EDF scheduler in CDL v2.5\n");
	printf("Now we have cyg_edf_sched_info type in ktypes.h\n");
	printf("+ thread_edf_info prop in Cyg_SchedThread_Implementation of edf.hxx\n");
	
	cyg_mutex_init(&cliblock);
	
	cyg_thread_create(4, simple_program, (cyg_addrword_t) 0,
		"Thread A", (void *) stack[0], 4096,
		 &simple_threadA, &thread_s[0]);
	cyg_thread_create(5, simple_program, (cyg_addrword_t) 1,
		"Thread B", (void *) stack[1], 4096,
		&simple_threadB, &thread_s[1]);
	
	printf("Threads are created\n");
	cyg_thread_resume(simple_threadA);
	cyg_thread_resume(simple_threadB);
}

/* this is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
	int message = (int) data;
	int delay;
	
	printf("Beginning execution; thread data is %d\n", message);
	
	cyg_thread_delay(200);
	cyg_thread_info info;
	cyg_handle_t cur_thread;
	
	for (;;) {
		delay = 400 + (rand() % 50);
		cur_thread = cyg_thread_self();
		/* note: printf() must be protected by a
			call to cyg_mutex_lock() */
		cyg_mutex_lock(&cliblock); {
			printf("Thread %d: and now a delay of %d clock ticks\n",
				message, delay);
			cyg_thread_get_info(cur_thread, cyg_thread_get_id( cyg_thread_self() ), &info);
			printf("ID: %d, name: %10s, ser pri: %d cur pri: %d stack use: %d\n\n", 
				info.id, info.name,  info.set_pri, info.cur_pri, info.stack_used);
			
			/* printf("Name of the thread is %d\n",
				cyg_thread_get_id( cyg_thread_self() ));*/
		}
		
		cyg_mutex_unlock(&cliblock);
		cyg_thread_delay(delay);
	}
}

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-23  7:28         ` Nodir Kodirov
@ 2010-01-23 10:08           ` Nodir Kodirov
  2010-01-23 11:23             ` John Dallaway
  0 siblings, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-23 10:08 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

Back after enabling Assertion.

Last line of the assertion is:

*** ASSERT FAIL: <1> kapi.cxx [1250]
Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes() Size check
failed

Seems that kernel is checking Cyg_SchedThread_Implementation class
size and as I modified it it throws error. Is it safe, if I disable
size check? Or is there any other way to overcome this problem?

Regards,
Nodir.


On 23 January 2010 16:28, Nodir Kodirov <nodir.qodirov@gmail.com> wrote:
>
> Hi John, Fabian and all,
>
> > Fabian wrote:
> > ah, sorry - the first parameter is meant to be some kind of generic
> > scheduler information parameter not necessarily a static priority. I
> > should have taken a closer look into the documentation before my first
> > comment.
>
> Me too, I thought it to be priority. Thank you for light John! I am
> following your advice.
>
> Now, I added:
>
> typedef struct
> {
>    cyg_tick_count deadline;
>    cyg_tick_count wcet;
>    cyg_tick_count period;
> } cyg_edf_sched_info;
> typedef cyg_edf_sched_info cyg_edf_sched_info_t;
>
> to cyg/kernel/ktypes.h
> Next, I built eCos library and linked my application to it. Run on my
> x86 Advantech target board and it works fine.
>
> Next, I defined additional member variable (to be used in
> Cyg_SchedThread_Implementation class Constructor, to extract
> [deadline, wcet and period] properties from *sched_info* generic
> parameter and use it for schedule() method)
> > cyg_edf_sched_info_t *thread_edf_info;
> to Cyg_SchedThread_Implementation class, where we can define scheduler
> specific members for threads (file src/sched/edf.hxx line #252). You
> can have a look at the same place with mlqueue.hxx.
>
> But, there is problem.
> When I include thread_edf_info to Cyg_SchedThread_Implementation
> class, I can build my eCos library, link it my eCos application and
> port it to board. But, when I run eCos application in target board,
> application halts after thread creation. However, I didn't modify any
> place of neither Cyg_SchedThread_Implementation class constructor nor
> cyg_thread_create() function yet.
>
> So, my question is, can I modify Cyg_SchedThread_Implementation class
> (just adding one more class member variable)?
>
> Herein I have attached my simple eCos application source file also.
> Note: in my target board application halts before printf("Threads are
> created\n"); line.
>
> Any help is highly appreciated!
>
> Thanks,
> Nodir.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-23 10:08           ` Nodir Kodirov
@ 2010-01-23 11:23             ` John Dallaway
  2010-01-24  5:42               ` Nodir Kodirov
  0 siblings, 1 reply; 17+ messages in thread
From: John Dallaway @ 2010-01-23 11:23 UTC (permalink / raw)
  To: Nodir Kodirov; +Cc: eCos Discussion

Hi Nodir

Nodir Kodirov wrote:

> Last line of the assertion is:
> 
> *** ASSERT FAIL: <1> kapi.cxx [1250]
> Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes() Size check
> failed
> 
> Seems that kernel is checking Cyg_SchedThread_Implementation class
> size and as I modified it it throws error. Is it safe, if I disable
> size check? Or is there any other way to overcome this problem?

It looks like you will need to add a new definition of
CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS in kapidata.h which matches the
Cyg_SchedThread_Implementation for your new scheduler.

John Dallaway
eCos maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-23 11:23             ` John Dallaway
@ 2010-01-24  5:42               ` Nodir Kodirov
  2010-01-24  7:45                 ` John Dallaway
  0 siblings, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-24  5:42 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

Hi John,

You are right, I added EDF specific block

> #elif defined(CYGSEM_KERNEL_SCHED_EDF)
> # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS                                    \
>    cyg_thread *next;                                                        \
>    cyg_thread *prev;                                                        \
>    cyg_priority_t      priority;            /* current thread priority */     \
>    cyg_edf_sched_info_t *edf_thread_info;  /* thread specific EDF properties */
> #else

to kapidata.h

Next, I could add:
> cyg_edf_sched_info_t *thread_edf_info;
member variable to my Cyg_SchedThread_Implementation class at my edf.hxx file.

At the same time I have:
> typedef struct
> {
>    cyg_tick_count deadline; /* abs ddl of the thread, 2b changed to rel */
>    cyg_tick_count wcet; /* Worst Case Execution time of the thread */
>    cyg_tick_count period; /* Call frequency of the thread */
> } cyg_edf_sched_info;

> typedef cyg_edf_sched_info cyg_edf_sched_info_t;  /* EDF scheduling info type */

in ktypes.h file.

Now my Cyg_SchedThread_Implementation class constructor looks like:
> Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation
> (
>    CYG_ADDRWORD sched_info
> )
> {
>    CYG_REPORT_FUNCTION();
>    CYG_REPORT_FUNCARG1("sched_info=%08x", sched_info);
	
>    thread_edf_info = (cyg_edf_sched_info_t *) sched_info;

>    // Set priority to the supplied value.
>    priority = (cyg_priority) thread_edf_info->deadline;

>    CYG_TRACE1(1, "thread_edf_info->deadline = %d\n", thread_edf_info->deadline);
>    CYG_TRACE1(1, "thread_edf_info->wcet = %d\n", thread_edf_info->wcet);
>    CYG_TRACE1(1, "thread_edf_info->period = %d\n", thread_edf_info->period);
>    ...

I included #include <cyg/kernel/ktypes.h> to my eCos application and I
am creating threads:
> void cyg_user_start(void)
> {
>	cyg_edf_sched_info_t my_edf_info_A = {7, 11, 12};
>	cyg_mutex_init(&cliblock);
>	cyg_thread_create((cyg_addrword_t) &my_edf_info_A, simple_program, (cyg_addrword_t) 0,
>		"Thread A", (void *) stack[0], 4096, &simple_threadA, &thread_s[0]);
>	printf("Threads are created\n");
>	cyg_thread_resume(simple_threadA);

There is no problem in building eCos library, application compile and
running on the board.
But, my eCos application is TRACE ing me wrong values.

Output which I give on my board is:
*** TRACE: edf.cxx [595] <nofunc>() 'thread_edf_info->deadline = 16688624'
*** TRACE: edf.cxx [596] <nofunc>() 'thread_edf_info->wcet = 15691760'
*** TRACE: edf.cxx [597] <nofunc>() 'thread_edf_info->period = 15691760'

However, according to
>	cyg_edf_sched_info_t my_edf_info_A = {7, 11, 12};
values should be: "deadline=7; wcet=11, period=12".

I think I am doing something wrong at *struct* creation or accessing
its fields. But, I tried again and again, still having same output...

I know it is hard to answer this question without having application
on hand, but, any ideas how this come?

Regards,
Nodir.

On 23 January 2010 20:23, John Dallaway <john@dallaway.org.uk> wrote:
>
> > Last line of the assertion is:
> >
> > *** ASSERT FAIL: <1> kapi.cxx [1250]
> > Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes() Size check
> > failed
> >
> > Seems that kernel is checking Cyg_SchedThread_Implementation class
> > size and as I modified it it throws error. Is it safe, if I disable
> > size check? Or is there any other way to overcome this problem?
>
> It looks like you will need to add a new definition of
> CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS in kapidata.h which matches the
> Cyg_SchedThread_Implementation for your new scheduler.
>
> John Dallaway
> eCos maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-24  5:42               ` Nodir Kodirov
@ 2010-01-24  7:45                 ` John Dallaway
  2010-01-24  8:19                   ` Nodir Kodirov
  0 siblings, 1 reply; 17+ messages in thread
From: John Dallaway @ 2010-01-24  7:45 UTC (permalink / raw)
  To: Nodir Kodirov; +Cc: eCos Discussion

Hi Nodir

Nodir Kodirov wrote:

>>    CYG_TRACE1(1, "thread_edf_info->deadline = %d\n", thread_edf_info->deadline);
>>    CYG_TRACE1(1, "thread_edf_info->wcet = %d\n", thread_edf_info->wcet);
>>    CYG_TRACE1(1, "thread_edf_info->period = %d\n", thread_edf_info->period);

[ snip ]

> Output which I give on my board is:
> *** TRACE: edf.cxx [595] <nofunc>() 'thread_edf_info->deadline = 16688624'
> *** TRACE: edf.cxx [596] <nofunc>() 'thread_edf_info->wcet = 15691760'
> *** TRACE: edf.cxx [597] <nofunc>() 'thread_edf_info->period = 15691760'
> 
> However, according to
>> 	cyg_edf_sched_info_t my_edf_info_A = {7, 11, 12};
> values should be: "deadline=7; wcet=11, period=12".

cyg_tick_count_t is a 64-bit unsigned integer. You are treating these
values as 32-bit signed (using "%d") in your CYG_TRACE() calls.

I hope this helps...

John Dallaway
eCOs maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-24  7:45                 ` John Dallaway
@ 2010-01-24  8:19                   ` Nodir Kodirov
       [not found]                     ` <186ad4051001260801n195d7543i48855912327f1fe@mail.gmail.com>
  0 siblings, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-24  8:19 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

Thank you John!

Per your advice I changed cyg_tick_count_t to cyg_count32 in
cyg_edf_sched_info structure fields. As:

> typedef struct
> {
>    cyg_count32 deadline; /* abs ddl of the thread, 2b changed to rel */
>    cyg_count32 wcet; /* Worst Case Execution time of the thread */
>    cyg_count32 period; /* Call frequency of the thread */
> } cyg_edf_sched_info;

But, it couldn't solve the problem, still I have the same output.
> *** TRACE: edf.cxx [595] <nofunc>() 'thread_edf_info->deadline = 16688624'
> *** TRACE: edf.cxx [596] <nofunc>() 'thread_edf_info->wcet = 15691760'
> *** TRACE: edf.cxx [597] <nofunc>() 'thread_edf_info->period = 15691760'

Any other hints?

Thanks,
Nodir.

On 24 January 2010 16:45, John Dallaway <john@dallaway.org.uk> wrote:
>
> cyg_tick_count_t is a 64-bit unsigned integer. You are treating these
> values as 32-bit signed (using "%d") in your CYG_TRACE() calls.
>
> I hope this helps...
>
> John Dallaway
> eCOs maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
       [not found]                       ` <186ad4051001260913pffb9d5bk5d529ffda7252c82@mail.gmail.com>
@ 2010-01-26 17:15                         ` Nodir Kodirov
  2010-01-27  8:38                           ` John Dallaway
  0 siblings, 1 reply; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-26 17:15 UTC (permalink / raw)
  To: eCos Discussion

Hello all,

I tried various ways to overcome, but, still couldn't solve the problem.

But, interesting thing to tell is that, always I am having the same
value for the first (thread_edf_info->deadline) field of the
*thread_edf_info* structure. E.g. when I am tracing it via:
> CYG_TRACE1(1, "edf_info->deadline = %d", edf_info->deadline);
It always outputs me value *edf_info->deadline=16688624*

But for the other two fields I have *edf_info->wcet = 15304688* and
*edf_info->period = 15691760*.
Maybe it can help to have you some idea, about what is going inside...

Here is link for the all files which I created/modified for eCos
EDF support.
http://rapidshare.com/files/341448817/modified_files_at_eCos_kernel_for_EDF_sched.zip.html
Can anyone make a time to have a look and help me to
figure out "hiding bug"?

Here is the structure, where files should be put into:

Header files: ECOS_REPOSITORY/ecos-3.0/packages/kernel/v3_0/include
Source file (edf.cxx only):
ECOS_REPOSITORY/ecos-3.0/packages/kernel/v3_0/source/sched
CDL files: ECOS_REPOSITORY/ecos-3.0/packages/kernel/v3_0/cdl

I have attached my *eCos application* and *makefile* also.

Thank you for the help!
Regards,
Nodir.

2010/1/24 Nodir Kodirov
>
> Thank you John!
>
> Per your advice I changed cyg_tick_count_t to cyg_count32 in
> cyg_edf_sched_info structure fields. As:
>
> > typedef struct
> > {
> >    cyg_count32 deadline; /* abs ddl of the thread, 2b changed to rel */
> >    cyg_count32 wcet; /* Worst Case Execution time of the thread */
> >    cyg_count32 period; /* Call frequency of the thread */
> > } cyg_edf_sched_info;
>
> But, it couldn't solve the problem, still I have the same output.
> > *** TRACE: edf.cxx [595] <nofunc>() 'thread_edf_info->deadline = 16688624'
> > *** TRACE: edf.cxx [596] <nofunc>() 'thread_edf_info->wcet = 15691760'
> > *** TRACE: edf.cxx [597] <nofunc>() 'thread_edf_info->period = 15691760'
>
> Any other hints?
>
> Thanks,
> Nodir.
>
> On 24 January 2010 16:45, John Dallaway
> >
> > cyg_tick_count_t is a 64-bit unsigned integer. You are treating these
> > values as 32-bit signed (using "%d") in your CYG_TRACE() calls.
> >
> > I hope this helps...
> >
> > John Dallaway
> > eCOs maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-26 17:15                         ` Nodir Kodirov
@ 2010-01-27  8:38                           ` John Dallaway
  2010-01-28 18:13                             ` Nodir Kodirov
  0 siblings, 1 reply; 17+ messages in thread
From: John Dallaway @ 2010-01-27  8:38 UTC (permalink / raw)
  To: Nodir Kodirov; +Cc: eCos Discussion

Hi Nodir

Nodir Kodirov wrote:

> I tried various ways to overcome, but, still couldn't solve the problem.
> 
> But, interesting thing to tell is that, always I am having the same
> value for the first (thread_edf_info->deadline) field of the
> *thread_edf_info* structure. E.g. when I am tracing it via:
>> CYG_TRACE1(1, "edf_info->deadline = %d", edf_info->deadline);
> It always outputs me value *edf_info->deadline=16688624*
> 
> But for the other two fields I have *edf_info->wcet = 15304688* and
> *edf_info->period = 15691760*.
> Maybe it can help to have you some idea, about what is going inside...

Try moving "edf_info" to be immediately following "priority" in
CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS so that the ordering of members in
cyg_thread match the ordering in the Cyg_Thread class.

I hope this helps...

John Dallaway
eCos maintiner

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-27  8:38                           ` John Dallaway
@ 2010-01-28 18:13                             ` Nodir Kodirov
  2010-01-28 21:29                               ` John Dallaway
  2010-01-31  8:57                               ` Nodir Kodirov
  0 siblings, 2 replies; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-28 18:13 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

Hello John and all!

On 27 January 2010 17:37, John Dallaway wrote:

> Try moving "edf_info" to be immediately following "priority" in
> CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS so that the ordering of members in
> cyg_thread match the ordering in the Cyg_Thread class.
>
> I hope this helps...
>
> John Dallaway
> eCos maintiner

Tried, does not have any positive effect, output is the same.

Now, I want to describe all of my main steps for discussion. If there
is no solution, then, I think, I would better to move to another way
to *deliver* EDF specific information to schedule method.

So, in ktypes.h I have:

> typedef struct cyg_edf_info_t
> {
>	cyg_count32 deadline;
>	cyg_count32 wcet;
>	cyg_count32 period;
> };

In kapidata.h I added:

> #elif defined(CYGSEM_KERNEL_SCHED_EDF)
> # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS    \
>    cyg_thread *next;                                                        \
>    cyg_thread *prev;                                                        \
>    cyg_priority_t      priority;             /* current thread priority */  \
>    struct cyg_edf_info_t * edf_info;
> #else
> # error Undefined scheduler type

In Cyg_SchedThread_Implementation class of edf.hxx I added *edf_info*:

> class Cyg_SchedThread_Implementation
>    : public Cyg_DNode_T<Cyg_Thread>
> {
>    friend class Cyg_Scheduler_Implementation;
>    friend class Cyg_ThreadQueue_Implementation;

> protected:
>    cyg_priority        priority;       // current thread priority
>    struct cyg_edf_info_t * edf_info; // added by me
> ...
> }

In the constructor of Cyg_SchedThread_Implementation class at edf.cxx
file, I added followings:

> Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation
> (
>    CYG_ADDRWORD sched_info
> )
> {
>    CYG_REPORT_FUNCTION();
>    CYG_REPORT_FUNCARG1("sched_info=%08x", sched_info);
>    edf_info = (cyg_edf_info_t *) &sched_info;
>    priority = (cyg_priority) edf_info->deadline;
>
>    CYG_TRACE1(1, "edf_info->deadline = %d", edf_info->deadline);
>    CYG_TRACE1(1, "edf_info->wcet = %d", edf_info->wcet);
>    CYG_TRACE1(1, "edf_info->period = %d", edf_info->period);
> ...
> }

In my eCos application I am passing arguments in these way:

> #include <cyg/kernel/ktypes.h>
> ...
> void cyg_user_start(void)
> {
>	struct cyg_edf_info_t my_edf_info_A = {4, 11, 12};
>	struct cyg_edf_info_t my_edf_info_B = {5, 21, 22};
>
>	cyg_thread_create((cyg_addrword_t) &my_edf_info_A, simple_program, (cyg_addrword_t) 0,
>		"Thread A", (void *) stack[0], 32768,
>		 &simple_threadA, &thread_s[0]);
>	cyg_thread_create((cyg_addrword_t) &my_edf_info_B, simple_program, (cyg_addrword_t) 1,
>		"Thread B", (void *) stack[1], 32768,
>		&simple_threadB, &thread_s[1]);
>
>	printf("Threads are created\n");
>	cyg_thread_resume(simple_threadA);
>	cyg_thread_resume(simple_threadB);
> }

And output which I am getting is:

> TRACE: edf.cxx [602] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->deadline = 31'
> TRACE: edf.cxx [603] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->wcet = 0'
> TRACE: edf.cxx [604] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->period = 0'

> TRACE: edf.cxx [602] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->deadline = 10'
> TRACE: edf.cxx [603] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->wcet = 0'
> TRACE: edf.cxx [604] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'edf_info->period = 0'

> TRACE: cstartup.cxx [91] void cyg_iso_c_start()   'Resuming cyg_libc_main_thread'
> TRACE: kapi.cxx [1238] void Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    'Size of C struct cyg_thread != size of C++ struct Cyg_Thread'
> ASSERT FAIL: <1> kapi.cxx [1250] Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    Size check failed
> ASSERT FAIL: kapi.cxx [1250] Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    Size check failed

I hope these codes and outputs could help to catch the bug. Any idea,
comment appreciated!

Regards,
Nodir.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-28 18:13                             ` Nodir Kodirov
@ 2010-01-28 21:29                               ` John Dallaway
  2010-01-31  8:57                               ` Nodir Kodirov
  1 sibling, 0 replies; 17+ messages in thread
From: John Dallaway @ 2010-01-28 21:29 UTC (permalink / raw)
  To: Nodir Kodirov; +Cc: eCos Discussion

Hi Nodir

Nodir Kodirov wrote:

>> TRACE: cstartup.cxx [91] void cyg_iso_c_start()   'Resuming cyg_libc_main_thread'
>> TRACE: kapi.cxx [1238] void Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    'Size of C struct cyg_thread != size of C++ struct Cyg_Thread'
>> ASSERT FAIL: <1> kapi.cxx [1250] Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    Size check failed
>> ASSERT FAIL: kapi.cxx [1250] Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes()    Size check failed

First, focus on eliminating the structure size mismatch. Whatever member
variables are added to the C++ classes must be mirrored by definitions
in kapidata.h or nothing else will make any sense. Add your changes for
EDF one at a time and ensure the structure sizes match with each change.

Second, are you sure you need to take the address of sched_info in the
following line:

>>    edf_info = (cyg_edf_info_t *) &sched_info;
>>    priority = (cyg_priority) edf_info->deadline;

sched_info should already be a pointer to a struct cyg_edf_info_t.

I hope this helps...

John Dallaway
eCos maintainer

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [ECOS] Re: how to implement EDF scheduling in eCos
  2010-01-28 18:13                             ` Nodir Kodirov
  2010-01-28 21:29                               ` John Dallaway
@ 2010-01-31  8:57                               ` Nodir Kodirov
  1 sibling, 0 replies; 17+ messages in thread
From: Nodir Kodirov @ 2010-01-31  8:57 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos Discussion

Hello John and all!

I think finally I got out of previous problem, facing another one...
But, John, I thank you very much, for being together all the time!

Now I have more interesting picture and one *puzzle*.
Let me explain picture first, next I will explain *puzzle*.

As the last time In ktypes.h I have:

> typedef cyg_count32     cyg_priority;   // priority value
> typedef struct cyg_edf_info_t
> {
>       cyg_count32 deadline;
>       cyg_count32 wcet;
>       cyg_count32 period;
> };

In kapidata.h I added:

> #elif defined(CYGSEM_KERNEL_SCHED_EDF)
> # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS                                    \
>    cyg_thread *next;                                                        \
>    cyg_thread *prev;                                                        \
>    cyg_priority_t      priority;             /* current thread priority */  \
>    struct cyg_sched_edf_info_t *edf_info;                                     \
>    CYG_SCHEDTHREAD_CPU_MEMBER                          \
>    CYG_SCHEDTHREAD_TIMESLICE_MEMBER                    \
>    CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER
> #else ...

In Cyg_SchedThread_Implementation class of edf.hxx I added *edf_info*:

> class Cyg_SchedThread_Implementation
>    : public Cyg_DNode_T<Cyg_Thread>
> {
>    friend class Cyg_Scheduler_Implementation;
>    friend class Cyg_ThreadQueue_Implementation;

> protected:
>    cyg_priority        priority;       // current thread priority
>    struct cyg_sched_edf_info_t *edf_info; // added by me
> ...
> }

In my eCos application I am passing arguments in this way:

> #include <cyg/kernel/ktypes.h>
> ...
> void cyg_user_start(void)
> {
>       struct cyg_edf_info_t my_edf_info_A = {4, 11, 12};
>
>       cyg_thread_create((cyg_addrword_t) &my_edf_info_A, simple_program, (cyg_addrword_t) 0,
>               "Thread A", (void *) stack[0], 4096,
>                &simple_threadA, &thread_s[0]);
>       printf("Threads are created\n");
>       cyg_thread_resume(simple_threadA);
> }

Now, *puzzle*. Depending on my code in the constructor of the
Cyg_SchedThread_Implementation class at edf.cxx I have two different
outputs.

In the first scenario (result is the same as in the previous post,
*priority* with *edf_info->deadline* value):
> Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation
> (
>    CYG_ADDRWORD sched_info
> )
> {
>    edf_info = (cyg_sched_edf_info_t *) sched_info;
>    CYG_TRACE1(1, "deadline = %d", edf_info->deadline);
>    CYG_TRACE1(1, "wcet = %d", edf_info->wcet);
>    CYG_TRACE1(1, "period = %d", edf_info->period);
>    priority = (cyg_priority) edf_info->deadline; // important
>    CYG_TRACE1(1, "Priority = %d ", priority);
> ...	
> }

Output is:
> TRACE: edf.cxx [590] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'deadline = 16688624'
> TRACE: edf.cxx [591] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'wcet = 15304688'
> TRACE: edf.cxx [592] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'period = 15691760'
> TRACE: edf.cxx [594] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'priority = 16688624'
> ASSERT FAIL: <1> edf.cxx [211] Cyg_Scheduler_Implementation::add_thread()  Priority out of range!

In the second scenario (just changing *priority* assign value to *sched_info*):

> Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation
> (
>    CYG_ADDRWORD sched_info
> ) {
>    edf_info = (cyg_sched_edf_info_t *) sched_info;
>    CYG_TRACE1(1, "deadline= %d", edf_info->deadline);
>    CYG_TRACE1(1, "wcet = %d", edf_info->wcet);
>    CYG_TRACE1(1, "period = %d", edf_info->period);
>    priority = (cyg_priority) sched_info; // important
>    CYG_TRACE1(1, "Priority = %d ", priority);
> ...	
> }

Output is:
> TRACE: prestart.cxx [77] void cyg_prestart()  'This is the system default cyg_prestart()'
> TRACE: pkgstart.cxx [87] void cyg_package_start()  'This is the system default cyg_package_start()'
> TRACE: edf.cxx [590] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'deadline = 4'
> TRACE: edf.cxx [591] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'wcet = 11'
> TRACE: edf.cxx [592] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'period = 12'
> TRACE: edf.cxx [594] Cyg_SchedThread_Implementation::Cyg_SchedThread_Implementation()   'priority = 1162644'
> Threads are created
> ASSERT FAIL: <1> edf.cxx [211] Cyg_Scheduler_Implementation::add_thread()  Priority out of range!

I think, the value to which *edf_info->deadline* pointing is changing
depending on which value has the *priority*. But, I don't no why?

Can anyone help me to find an answer?

Regards,
Nodir.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-01-31  8:57 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <186ad4051001190626t25f15afds8720515cba54bc91@mail.gmail.com>
2010-01-20  1:25 ` [ECOS] Re: Fwd: Re: how to implement EDF scheduling in eCos Nodir Kodirov
2010-01-20 15:01   ` [ECOS] " John Dallaway
2010-01-20 15:19     ` Nodir Kodirov
2010-01-21  8:41       ` John Dallaway
2010-01-21  8:58         ` Fabian Scheler
2010-01-23  7:28         ` Nodir Kodirov
2010-01-23 10:08           ` Nodir Kodirov
2010-01-23 11:23             ` John Dallaway
2010-01-24  5:42               ` Nodir Kodirov
2010-01-24  7:45                 ` John Dallaway
2010-01-24  8:19                   ` Nodir Kodirov
     [not found]                     ` <186ad4051001260801n195d7543i48855912327f1fe@mail.gmail.com>
     [not found]                       ` <186ad4051001260913pffb9d5bk5d529ffda7252c82@mail.gmail.com>
2010-01-26 17:15                         ` Nodir Kodirov
2010-01-27  8:38                           ` John Dallaway
2010-01-28 18:13                             ` Nodir Kodirov
2010-01-28 21:29                               ` John Dallaway
2010-01-31  8:57                               ` Nodir Kodirov
2010-01-20 15:25     ` Fabian Scheler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).