public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] unexpected behaviour !!!
@ 2006-01-31  8:20 Maximus
  2006-01-31 12:05 ` Peter Menzebach
  0 siblings, 1 reply; 4+ messages in thread
From: Maximus @ 2006-01-31  8:20 UTC (permalink / raw)
  To: u-boot

Hi,
    I have designed my own protocol and am trying to include it in u-boot.


    In the Recieve Handler i am trying to dereference the pkt.

struct mypacket {
    unsigned int seqnum ;
    char data [24] ;
} ;

struct mypacket mypacket ;

void myrecieve_handler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
{
    int seqnum ;
    uchar * q ;

    if (dest != 8888)
        return ;

    printf ("pkt => %u\n", pkt) ;
    printf ("len => %d\n", len) ;


  q = pkt ;
  for (i = 0 ; i < len ; i++) {
      printf ("%d:%u=> %c\n", i, q, *q) ;
      q++ ;
  }

    memcpy (&mypacket, pkt, sizeof (mypacket)) ;
    printf ("seq:%u\n", mypacket.seq) ;
    printf ("data:%s\n", mypacket.data) ;
    printf ("before\n") ;
    seqnum = * (int *) pkt ;                /*
<------------------------   Abort - Board Hangs */
    printf ("after\n") ;

}

I am able to access the contents of pkt
   1) byte by byte
   2) memcpy

But, as soon as i try to deference it either by doing
     1) * (int *) pkt  /***************** board hangs ********/
            or
     2) mp = (struct mypacket *) pkt
           printf ("%u\n", mp -> seqnum) ;  /************* board Hangs
*************/

I get the Error shown below.

As, soon as seqnum = * (int *) pkt - is executed my board prints the message:


Why is that ?.


I dont understand this. i am using an OMAP 5912 OSK BOARD.


Is it not possible to dereference pkt ?.



data abort
pc : [<2000d6b0>]    lr : [<2000d6a8>]
sp : 1ffbfc38  ip : ffffffff  fp : 20015fc8
r10: 2001dc24  r9 : 20015fb8  r8 : 1ffbffdc
r7 : 2001dc08  r6 : 0000001c  r5 : 2001c40a  r4 : 000022b8
r3 : 00000020  r2 : 00000001  r1 : 0000000a  r0 : 00000000
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...


Regards,
Jo

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

end of thread, other threads:[~2006-02-01 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-31  8:20 [U-Boot-Users] unexpected behaviour !!! Maximus
2006-01-31 12:05 ` Peter Menzebach
2006-01-31 13:34   ` [U-Boot-Users] " Maximus
2006-02-01 14:45     ` Andreas Schweigstill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox