public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] need debugging help
@ 2004-08-04 17:42 harmon
  2004-08-04 18:59 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: harmon @ 2004-08-04 17:42 UTC (permalink / raw)
  To: ecos-discuss

I am developing a USB 2.0 driver using eCos 2.0 and an i386 PC
architecture.  I am currently in the debugging stage.

My target application has three threads:
       one to read commands send from a USB host (Cmd),
       one to send responses back to the host(Rsp) and
       one that does nothing but delay for 1000 ticks then printfs "I'm
alive"

When I run the target application, the host PC enumerates the target
then an application sends successfully sends a command and gets a
response! :)
However, the target application seems to go off into the weeds. :(
At this point, as far as I can tell, none of my threads are running,
including the thread that does nothing!

With experimentation I have found that if I run either the Cmd or Rsp
thread without the other they seem to work fine.

I have bumped the stack sizes up and the ISR stack also, but no luck.

Who's stack does a DSR use??  Could my DSR be overflowing?

At this point I don't quite know how to debug the problem.  I would like
to be able to determine where each of my three threads are executing.  I
would like to be able to check the stacks.

Can anyone give me some advice on this type of debugging?

Thanks in advance!

Larry



-- 
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] 5+ messages in thread

* Re: [ECOS] need debugging help
  2004-08-04 17:42 [ECOS] need debugging help harmon
@ 2004-08-04 18:59 ` Andrew Lunn
  2004-08-05 15:29   ` harmon
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2004-08-04 18:59 UTC (permalink / raw)
  To: harmon; +Cc: ecos-discuss

> Can anyone give me some advice on this type of debugging?

Do you have asserts enabled. That might show up something.

        Andrew

-- 
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] 5+ messages in thread

* RE: [ECOS] need debugging help
  2004-08-04 18:59 ` Andrew Lunn
@ 2004-08-05 15:29   ` harmon
  2004-08-05 16:24     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: harmon @ 2004-08-05 15:29 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: ecos-discuss

Thanks for the advice.  I figured out how to enable asserts, enabled
them, ran my application and asserted where I was having a problem:

The message is:
ASSERT FAIL: <6>mutex.cxx[249]cyg_bool Cyg_Mutex::lock() Locking mutex I
already own
ASSERT FAIL: <6>mutex.cxx  [249] cyg_bool Cyg_Mutex::lock()


This problem occurs where I call
	cyg_flag_setbits(&UsbRspStateFlag,
(1<<USB_STATE_IN_MESSAGE_DONE));
from a DSR.

I believe this might be a point where my DSR calls cyg_flag_setbits
twice, once for each thread, and the second call results in problems.

At least now I know where to look.

Thanks again,

Larry

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Wednesday, August 04, 2004 2:50 PM
To: harmon
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] need debugging help

> Can anyone give me some advice on this type of debugging?

Do you have asserts enabled. That might show up something.

        Andrew

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


-- 
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] 5+ messages in thread

* Re: [ECOS] need debugging help
  2004-08-05 15:29   ` harmon
@ 2004-08-05 16:24     ` Andrew Lunn
  2004-08-05 17:20       ` harmon
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2004-08-05 16:24 UTC (permalink / raw)
  To: harmon; +Cc: 'Andrew Lunn', ecos-discuss

On Thu, Aug 05, 2004 at 11:29:23AM -0400, harmon wrote:
> Thanks for the advice.  I figured out how to enable asserts, enabled
> them, ran my application and asserted where I was having a problem:
> 
> The message is:
> ASSERT FAIL: <6>mutex.cxx[249]cyg_bool Cyg_Mutex::lock() Locking mutex I
> already own
> ASSERT FAIL: <6>mutex.cxx  [249] cyg_bool Cyg_Mutex::lock()
> 
> 
> This problem occurs where I call
> 	cyg_flag_setbits(&UsbRspStateFlag,
> (1<<USB_STATE_IN_MESSAGE_DONE));
> from a DSR.
> 
> I believe this might be a point where my DSR calls cyg_flag_setbits
> twice, once for each thread, and the second call results in problems.

No, that does not sound right. cyg_flash_setbits should not be doing
anything with mutex's. Also, you should not be using mutex's inside a
DSR. I think the mutex problem is being triggered from some other
location. You should be able to put a breakpoint in cyg_assert_failed
and then get a backtrace from gdb.

        Andrew

-- 
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] 5+ messages in thread

* RE: [ECOS] need debugging help
  2004-08-05 16:24     ` Andrew Lunn
@ 2004-08-05 17:20       ` harmon
  0 siblings, 0 replies; 5+ messages in thread
From: harmon @ 2004-08-05 17:20 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: ecos-discuss

Thanks again!

I did as you suggested, breaking at the assert.  A thread's callback
function, called at DSR level, called printf which eventually tried to
lock a mutex.  I removed the printf and now all appears to work well!!
:)

Larry


-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Thursday, August 05, 2004 12:22 PM
To: harmon
Cc: 'Andrew Lunn'; ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] need debugging help

On Thu, Aug 05, 2004 at 11:29:23AM -0400, harmon wrote:
> Thanks for the advice.  I figured out how to enable asserts, enabled
> them, ran my application and asserted where I was having a problem:
> 
> The message is:
> ASSERT FAIL: <6>mutex.cxx[249]cyg_bool Cyg_Mutex::lock() Locking mutex
I
> already own
> ASSERT FAIL: <6>mutex.cxx  [249] cyg_bool Cyg_Mutex::lock()
> 
> 
> This problem occurs where I call
> 	cyg_flag_setbits(&UsbRspStateFlag,
> (1<<USB_STATE_IN_MESSAGE_DONE));
> from a DSR.
> 
> I believe this might be a point where my DSR calls cyg_flag_setbits
> twice, once for each thread, and the second call results in problems.

No, that does not sound right. cyg_flash_setbits should not be doing
anything with mutex's. Also, you should not be using mutex's inside a
DSR. I think the mutex problem is being triggered from some other
location. You should be able to put a breakpoint in cyg_assert_failed
and then get a backtrace from gdb.

        Andrew

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


-- 
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] 5+ messages in thread

end of thread, other threads:[~2004-08-05 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-04 17:42 [ECOS] need debugging help harmon
2004-08-04 18:59 ` Andrew Lunn
2004-08-05 15:29   ` harmon
2004-08-05 16:24     ` Andrew Lunn
2004-08-05 17:20       ` harmon

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