public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Raja Mallik <raja.mallik@moschip.com>
To: Gary Thomas <gary@mlbassoc.com>
Cc: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] Thread not starting!
Date: Mon, 06 Jun 2005 11:40:00 -0000	[thread overview]
Message-ID: <1118057908.19118.5586.camel@mazda> (raw)
In-Reply-To: <1118054662.22823.4.camel@hermes>

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

Hi again, 

Please find the tarces.txt and twothreads.c file attaced
Let me know where am I going wrong?

regards
Raja
On Mon, 2005-06-06 at 16:14, Gary Thomas wrote:
> On Mon, 2005-06-06 at 16:01 +0530, Raja Mallik wrote:
> > hi 
> >  
> > I am trying to run a thread application.by calling cyg_thread_create
> > function.
> >  
> > In the configtool, I have enabled "ASSERT" and while loading the
> > application to my board, I get this messages!
> >  
> > I am not able understand why the thread is not getting started..
> >  
> > Kindly share your views..
> 
> Did you start the scheduler?  Maybe you could show us your code 
> instead of just this trace (it's hard to tell what you've done 
> wrong, all we can see are the results)

[-- Attachment #2: traces.txt --]
[-- Type: text/plain, Size: 10212 bytes --]

Entering twothreads' cyg_user_start() function
TRACE: mutex.cxx           [ 382] void Cyg_Mutex::unlock()                      
                                                           {{enter
TRACE: mutex.cxx           [ 447] void Cyg_Mutex::unlock()                      
                                                           }}return void
TRACE: mutex.cxx           [ 382] void Cyg_Mutex::unlock()                      
                                                           {{enter
TRACE: sched.cxx           [ 705] void Cyg_SchedThread::disinherit_priority()   
                                                             {{enter
TRACE: sched.cxx           [ 628] void Cyg_SchedThread::clear_inherited_priority
()                                                             {{enter
TRACE: sched.cxx           [ 628] void Cyg_SchedThread::clear_inherited_priority
()                                                             }}RETURNING UNSET
!
TRACE: sched.cxx           [ 705] void Cyg_SchedThread::disinherit_priority()   
                                                             }}RETURNING UNSET!
TRACE: mutex.cxx           [ 447] void Cyg_Mutex::unlock()                      
                                                           }}return void
TRACE: fputc.cxx           [  93] fputc()                                       
                                                         }}wrote char 10
TRACE: mutex.cxx           [  92] Cyg_Mutex::Cyg_Mutex()                        
                                                         {{enter
TRACE: mutex.cxx           [ 130] Cyg_Mutex::Cyg_Mutex()                        
                                                         }}return void
TRACE: mlqueue.cxx         [ 578] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                       {{enter
TRACE: mlqueue.cxx         [ 578] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                         ((sched_info=00000004
))
TRACE: mlqueue.cxx         [ 592] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                       }}return void
TRACE: sched.cxx           [ 468] Cyg_SchedThread::Cyg_SchedThread()            
                                                         {{enter
TRACE: sched.cxx           [ 468] Cyg_SchedThread::Cyg_SchedThread()            
                                                         }}RETURNING UNSET!
TRACE: clock.cxx           [ 650] Cyg_Alarm::Cyg_Alarm()                        
                                                         {{enter
TRACE: clock.cxx           [ 650] Cyg_Alarm::Cyg_Alarm()                        
                                                         }}RETURNING UNSET!
TRACE: thread.cxx          [ 200] Cyg_Thread::Cyg_Thread()                      
                                                         {{enter
TRACE: mlqueue.cxx         [ 420] void Cyg_Scheduler_Implementation::register_th
read()                                                     {{enter
TRACE: mlqueue.cxx         [ 420] void Cyg_Scheduler_Implementation::register_th
read()                                                       ((thread=00048600))
TRACE: mlqueue.cxx         [ 423] void Cyg_Scheduler_Implementation::register_th
read()                                                     }}return void
TRACE: thread.cxx          [ 238] Cyg_Thread::Cyg_Thread()                      
                                                         }}return void
TRACE: mlqueue.cxx         [ 578] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                       {{enter
TRACE: mlqueue.cxx         [ 578] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                         ((sched_info=00000004
))
TRACE: mlqueue.cxx         [ 592] Cyg_SchedThread_Implementation::Cyg_SchedThrea
d_Implementation()                                       }}return void
TRACE: sched.cxx           [ 468] Cyg_SchedThread::Cyg_SchedThread()            
                                                         {{enter
TRACE: sched.cxx           [ 468] Cyg_SchedThread::Cyg_SchedThread()            
                                                         }}RETURNING UNSET!
TRACE: clock.cxx           [ 650] Cyg_Alarm::Cyg_Alarm()                        
                                                         {{enter
TRACE: clock.cxx           [ 650] Cyg_Alarm::Cyg_Alarm()                        
                                                         }}RETURNING UNSET!
TRACE: thread.cxx          [ 200] Cyg_Thread::Cyg_Thread()                      
                                                         {{enter
TRACE: mlqueue.cxx         [ 420] void Cyg_Scheduler_Implementation::register_th
read()                                                     {{enter
TRACE: mlqueue.cxx         [ 420] void Cyg_Scheduler_Implementation::register_th
read()                                                       ((thread=000486f0))
TRACE: mlqueue.cxx         [ 423] void Cyg_Scheduler_Implementation::register_th
read()                                                     }}return void
TRACE: thread.cxx          [ 238] Cyg_Thread::Cyg_Thread()                      
                                                         }}return void
TRACE: thread.cxx          [ 611] void Cyg_Thread::resume()                     
                                                         {{enter
TRACE: mlqueue.cxx         [ 202] void Cyg_Scheduler_Implementation::add_thread(
)                                                          {{enter
TRACE: mlqueue.cxx         [ 202] void Cyg_Scheduler_Implementation::add_thread(
)                                                            ((thread=00048600))
TRACE: mlqueue.cxx         [ 263] void Cyg_Scheduler_Implementation::add_thread(
)                                                          }}return void
TRACE: thread.cxx          [ 642] void Cyg_Thread::resume()                     
                                                         }}return void
TRACE: thread.cxx          [ 611] void Cyg_Thread::resume()                     
                                                         {{enter
TRACE: mlqueue.cxx         [ 202] void Cyg_Scheduler_Implementation::add_thread(
)                                                          {{enter
TRACE: mlqueue.cxx         [ 202] void Cyg_Scheduler_Implementation::add_thread(
)                                                            ((thread=000486f0))
TRACE: mlqueue.cxx         [ 263] void Cyg_Scheduler_Implementation::add_thread(
)                                                          }}return void
TRACE: thread.cxx          [ 642] void Cyg_Thread::resume()                     
                                                         }}return void
TRACE: sched.cxx           [ 318] static void Cyg_Scheduler::start()            
                                                         {{enter
TRACE: sched.cxx           [ 344] static void Cyg_Scheduler::start_cpu()        
                                                           {{enter
TRACE: mlqueue.cxx         [ 119] Cyg_Thread* Cyg_Scheduler_Implementation::sche
dule()                                                       {{enter
TRACE: mlqueue.cxx         [ 192] Cyg_Thread* Cyg_Scheduler_Implementation::sche
dule()                                                       }}returning thread 
00048600
TRACE: strlen.cxx          [  80] __strlen()                                    
                                                             {{enter
TRACE: strlen.cxx          [  80] __strlen()                                    
                                                               ((s=000413fc))
TRACE: strlen.cxx          [ 127] __strlen()                                    
                                                             }}returning length 
15
TRACE: mutex.cxx           [ 216] cyg_bool Cyg_Mutex::lock()                    
                                                             {{enter
TRACE: mutex.cxx           [ 322] cyg_bool Cyg_Mutex::lock()                    
                                                             }}returning 1
TRACE: mutex.cxx           [ 382] void Cyg_Mutex::unlock()                      
                                                             {{enter
TRACE: sched.cxx           [ 705] void Cyg_SchedThread::disinherit_priority()   
                                                               {{enter
TRACE: sched.cxx           [ 628] void Cyg_SchedThread::clear_inherited_priority
()                                                               {{enter
TRACE: sched.cxx           [ 628] void Cyg_SchedThread::clear_inherited_priority
()                                                               }}RETURNING UNS
ET!
TRACE: sched.cxx           [ 705] void Cyg_SchedThread::disinherit_priority()   
                                                               }}RETURNING UNSET
!
TRACE: mutex.cxx           [ 447] void Cyg_Mutex::unlock()                      
                                                             }}return void
TRACE: fputc.cxx           [  78] fputc()                                       
                                                             {{enter
TRACE: fputc.cxx           [  78] fputc()                                       
                                                               ((c = 10, stream=
00045fcc))
TRACE: mutex.cxx           [ 216] cyg_bool Cyg_Mutex::lock()                    
                                                               {{enter
TRACE: mutex.cxx           [ 322] cyg_bool Cyg_Mutex::lock()                    
                                                               }}returning 1
TRACE: mutex.cxx           [ 216] cyg_bool Cyg_Mutex::lock()                    
                                                               {{enter
TRACE: mutex.cxx           [ 322] cyg_bool Cyg_Mutex::lock()                    
                                                               }}returning 1
eCos Started...

[-- Attachment #3: twothreads.c --]
[-- Type: text/x-c, Size: 1655 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 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);

  cyg_thread_delay(200);

  for (;;) {
    delay = 200 + (rand() % 50);

    /* 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_mutex_unlock(&cliblock);
    cyg_thread_delay(delay);
  }
}


[-- Attachment #4: 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

  reply	other threads:[~2005-06-06 11:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 10:11 AW: [ECOS] FLASH access from user program Neundorf, Alexander
2005-06-06 10:32 ` [ECOS] Thread not starting! Raja Mallik
2005-06-06 10:44   ` Gary Thomas
2005-06-06 11:40     ` Raja Mallik [this message]
2005-06-06 12:21       ` Gary Thomas
2005-06-06 12:03         ` Raja Mallik
2005-06-06 12:24           ` Gary Thomas
2005-06-07  4:43             ` Raja Mallik
2005-06-07  8:28 ` AW: [ECOS] FLASH access from user program Hans Berglund
2005-06-07  9:36 ` Hans Berglund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118057908.19118.5586.camel@mazda \
    --to=raja.mallik@moschip.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=gary@mlbassoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).