[U-Boot-Users] unexpected behaviour !!!
Maximus
john.maximus at gmail.com
Tue Jan 31 09:20:37 CET 2006
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
More information about the U-Boot
mailing list