RE: MPC555 branch instruction

"David Eicher" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Hi Allan,

Thanks for this response. It was indeed a missing volatile that caused the
compiler to optimize away my loop. It is missing in the Motorola Quickstart
package so users beware!!! There are ioctl( ) declarations (macros) for
accessing the hardware, these macros use peripheralMemRead( ) macros, the
parameters to these macros must be declared as volatile to let the compiler
know that the SCI status changes on it's own.

Thanks again,

Dave


________________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of
Dobbin Allan-r11834
Sent: Thursday, August 25, 2005 6:24 AM
To: [email protected]
Subject: RE: [MPC500] MPC555 branch instruction

It appears to be a "beq" instruction that is branching to itself.  So I
suspect the compiler has a compare instruction beforehand to check the
value of the SCI SR and then the beq is supposed to stall if that flag
is not set.

The problem is that the instruction branches to itself instead of
branching backwards to run the compare again.  I'm guessing that either
your code was wrong and has requested a single read of the SR register,
or you haven't declared it as volatile and so the compiler has decided
it doesn't have to read it a second time.

If you are using the freescale header files, your C code should look
something like:

while (SCI_A.SR.B.TDRE == 0) ;      /* wait for TDRE */

Send us your C code snippet if you still have the same problem.

Regards,
Allan

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of David Eicher
Sent: Wednesday, August 24, 2005 8:58 PM
To: [email protected]
Subject: [MPC500] MPC555 branch instruction


Hello list,



Has anyone seen a compiler generate an instruction for the MPC555 that
looks like this:



0x41A20000



BC 0x0D, 0x02, 0                      This is what my debugger says it
is.



Beq+    14 <outbyte+0x14>        This is what is in the disassembled
object
file.



I can't find this instruction in the programming environment manual so
can't figure out how it is suppose to work. It is branching to itself
and hanging my code. It is suppose to be polling a bit in the SCI
interface to check and see if the transmitter is free to transmit
another byte, but it never moves on from there.



Any help you might be able to offer would be appreciated.



Thanks,



Dave









[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 learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu





________________________________________
YAHOO! GROUPS LINKS 

•  Visit your group "MPC500" on the web.
  
•  To unsubscribe from this group, send an email to:
 [email protected]
  
•  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

________________________________________



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/dN_tlB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------------
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.