[ECOS] Help me please...

Mike A embeddedeng@hotmail.com
Tue Jul 23 22:38:00 GMT 2002


Hi,

I tried ecos (latest code from repository) on my ATLAS (MIPS 4Kc). I built 
the example code that came along with the ecos 1.3

Dumped the twothread.rec using the parallel cable after converting it to .fl 
into the Flash. When I run it I get the following results:

Entering twothreads' cyg_user_start() function
Sched: start
Sched: Schedule
Beginning execution; thread data is 0
Sched: Schedule
Beginning execution; thread data is 1
Sched: Schedule
Sched: Schedule

Here I have modified the sched.cxx & mlqueue.cxx
The “Sched: start” is printed by diag_printf from Cyg_Scheduler::start() in 
sched.cxx
The “Sched: Schedule” is printed by diag_printf from 
Cyg_Scheduler_Implementation::schedule() in mlqueue.cxx

I modified the twothread.c as below:

#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 two threads we will use */
cyg_thread thread_s[2];		/* space for two thread objects */

char stack[2][4096];		/* space for two 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("Entering twothreads' 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]);
  cyg_thread_create(4, simple_program, (cyg_addrword_t) 1,
		    "Thread B", (void *) stack[1], 4096,
		    &simple_threadB, &thread_s[1]);

  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);

  while(1)
  {
      cyg_thread_delay(200);
  }
}


I am planning to do GDB. In the ideal case the terminal should be printing 
“Sched: Schedule” pair continuously at a constant interval. But here it is 
printing only one set & it simply stops with no news. Let me know if there 
is a known bug or some issue with the ATLAS port or there is some problem 
with this application. Thanks a lot & have a very nice day.

Cheers,
-Michael.

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
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