All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Minazzi <Paolo.Minazzi@mitrol.it>
To: xenomai@xenomai.org
Subject: [Xenomai] rt_intr_wait bug during debugging
Date: Mon, 23 Sep 2013 10:48:10 +0200	[thread overview]
Message-ID: <5240004A.6070703@mitrol.it> (raw)

Hi to all,
the problem arise when I debug an application that uses an external 
interrupt.
Below there is a sample (pseudo) code that show how I can see the problem.
The irq stuff is related on my specific machine, so I think it is not 
important
give details about GPIO programming and interrupt clear (CLEAR_IRQ).

To see the problem :
1. I put a breakpoint on the usleep
2. I countinue to send "c" to stop always in the breakpoint.

When all is OK the cnt grows up.

Sometime, after several "c", I encounter the bug.
At this point the cnt is always the same and stops to grow up.
This happen because the irq line is disabled ! I check it seeing the VIC 
register.

I verified that if I put only a breakpoint in the
     asm("nop")
the irq line in the VIC register is disabled. This means that xenomai 
disable the irq line because
I enabled the irq line before with
     rt_intr_enable(&int_desc);
When restart with "c", xenomai is able to enable again the irq line.

For some reason xenomai sometimes does not enable irq line anymore and 
the code
in blocked in the
     rt_intr_wait(&int_desc, TM_INFINITE);
line.

If I enter in the bug condition and manually enable the irq line 
(programming the VIC register)
all works again without problem. If I continue my test I will re-enter 
in the bug condition ...

Only a dubt : in the xenomai example

http://www.xenomai.org/documentation/xenomai-2.4/html/api/user__irq_8c-example.html#a1 


there is not the rt_intr_enable in the irq_server. I don't know if it is 
out problem or not.

I tried to debug and I have some log, but for me it is difficult 
understand the real source of the
bug. I have a system on which I can see the problem with a minimal effort.

To be clear, there is no problem executing the xenomai application 
without debugger.

Regards
Paolo Minazzi






######################################################################################### 

void irq_server(void *cookie)
{
         while (1)
         {
                 rt_intr_enable(&int_desc);

                 asm("nop");

                 rt_intr_wait(&int_desc, TM_INFINITE);

                 CLEAR_IRQ();

                 cnt++;
         }
}
void InitIrq(void)
{
         init_irq_fujitsu();

         rt_intr_create(&int_desc, IRQNAME, IRQNUMBER, I_PROPAGATE );

         rt_task_create(&server_desc, "Irq2ms", TASK_STKSZ, TASK_PRIO, 
TASK_MODE);

         rt_task_start(&server_desc, &irq_server, NULL);

         enable_irq_fujitsu();
}

int main(int argc, char* argv[])
{
         mlockall(MCL_CURRENT|MCL_FUTURE);

         rt_timer_set_mode ( 0 );
         rt_task_set_mode(0, 0, /* T_WARNSW ,*/ NULL);

         MapRegistersARM();

         InitIrq();

         while(1)
         {
                 printf("[ %4d ]\n",cnt);
  ======>        usleep(10000);
         }
}
######################################################################################### 



             reply	other threads:[~2013-09-23  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  8:48 Paolo Minazzi [this message]
2013-09-23 18:25 ` [Xenomai] rt_intr_wait bug during debugging Gilles Chanteperdrix
2013-09-24  7:26   ` Paolo Minazzi
2013-09-24  7:38 ` Philippe Gerum

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=5240004A.6070703@mitrol.it \
    --to=paolo.minazzi@mitrol.it \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.