Re: Re: FPU operation problem.

Rajesh <[email protected]> Wed, 26 Jul 2006 00:53:25 -0700 (PDT)
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Hi,
    Thanx Mark for your response. Right now what I did, I put the Optimization Level 1 (as my function is very large) and tried to run the code again but getting same problem. I have now following mixed instrunction:
   
  {
00002544: 942182F0  stwu     rsp,-32016(rsp)
00002548: 7C0802A6  mflr     r0
0000254C: 90017D14  stw      r0,32020(rsp)
00002550: 39617D10  addi     r11,rsp,32016
00002554: 48007B39  bl       __save_fpr (0xa08c)
00002558: 93E17C7C  stw      r31,31868(rsp)
0000255C: 93C17C78  stw      r30,31864(rsp)
00002560: 7C3F0B78  mr       r31,rsp
00002564: 80010000  lwz      r0,0(rsp)
00002568: 3D60FFFE  lis      r11,-2
0000256C: 396B19F0  addi     r11,r11,6640
00002570: 7C01596E  stwux    r0,rsp,r11 <-------- at this 
instruction  it is jumping to "machine check exception"
   
  double rtb_Abs_h;
double rtb_Sum1;
double rtb_Product3;
double rtb_Saturation3;
 .....
 .....
 ....
  }

  //machine check exception assembly code
   
  000022C8: 00000000  dc.l     0x00000000              ; Invalid opcode '....'
}
000022CC: 4E800020  blr
   
  --regards
  Rajesh
   
  
Mark Allison <[email protected]> wrote:
        oops
Should have said "I presume the address in r13 is word aligned"
(thus putting the load address on a half-word boundary)

--- In [email protected], "Mark Allison" <mark.w.allison@...> 
wrote:
>
> Hi,
> 
> I think its probably actually crashing at while attempting to run 
> the code "lfd fp2,-32696(r13)" ?
> 
> It looks to me like you are trying to load a floating point value 
> from a mis-aligned address - I presume the address in r13 is half 
> word aligned?. You need to move your floating point data so it is 
> word aligned. 
> 
> I had a lot of this sort of problems myself trying to port some 
old 
> XDADA code across to Greenhills ADA. Alot of our data was 
contained 
> in data structures which made some elements mis-aligned - not a 
> problem for a 68020 but a definite no no for a 565.
> 
> Regards
> 
> Mark
> 
> --- In [email protected], "Rajesh" <rajesh86us@> wrote:
> >
> > Dear All,
> > I am trying to execute a function "func_control" in 
main
> () 
> > that performs some floating point operations. I have set the FP 
> bit 
> > in MSR while initialization. Following is the mixed code (both 
> > assembly and C code) for that function. As soon as it is 
crossing 
> the 
> > istruction marked below, it is jumping to "machine check 
> exception".
> > This function is very large(of around 26KB) and doing a lot of 
> > floating point operations, so its not possible to mention those 
> > operations here.
> > One more thing in this is that I am using ISR and enabling the 
FP 
> bit 
> > while entering into ISR.
> > 
> > func_control()
> > {
> > 00002510: 942180E0 stwu rsp,-32544(rsp)
> > 00002514: 7C0802A6 mflr r0
> > 00002518: 90017F24 stw r0,32548(rsp)
> > 0000251C: 39617F20 addi r11,rsp,32544
> > 00002520: 48006745 bl __save_fpr (0x8c64)
> > 00002524: BDC17E48 stmw r14,32328(rsp)
> > 00002528: 7C3F0B78 mr r31,rsp
> > 0000252C: 80010000 lwz r0,0(rsp)
> > 00002530: 3D60FFFE lis r11,-2
> > 00002534: 396B19F0 addi r11,r11,6640
> > 00002538: 7C01596E stwux r0,rsp,r11 <-------- at this 
> instruction 
> > it is jumping to "machine check exception"
> > 0000253C: C84D8048 lfd fp2,-32696(r13)
> > 
> > double rtb_Abs_h;
> > double rtb_Sum1;
> > double rtb_Product3;
> > double rtb_Saturation3;
> > .....
> > .....
> > .....
> > 
> > }
> > 
> > //machine check exception assembly code
> > 
> > 00002290: 00000000 dc.l 0x00000000; Invalid opcode '....'
> > }
> > 00002294: 4E800020 blr
> > 
> > 
> > Can someone please help on this, as I am stuck with this problem 
> from 
> > a long time and not able to fix it?
> > 
> > -regards
> > Rajesh
> >
>



         

 		
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs.Try it free. 

[Non-text portions of this message have been removed]



-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MPC500/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/