Re: cpp init & machine check

"coles555" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Hi Randall,
I have discovered that when I switch to another PB board (without 
external connections), the machine check would go away. However at 
memory location 0x405340 the value happens to be all 0x00000000 
instead of the 0xFB00FB00 I was having before. In the board I was 
using before, I had a LCD interfaced with the PB board. Do you think 
the machine check is caused by the external LCD interfacing? You are 
right about the PB board not having any RAM at location 0x405340. 
Perhaps the 0xFB00FB00 is generated from the external LCD? Whereas 
the PB board without the external LCD would have 0x00000000 at 
location 0x405340.

Lei 

--- In [email protected], "Randall" <ryoung@n...> wrote:
>
> Lei,
> 
> I'm not sure of the details, as I'm not a C++ programmer.  But 
based on the code
> you posted, I'm fairly sure that _ctors is a list of initializer 
functions for
> any objects that need them (eg constructors for static objects), 
and for the
> exception handling code.  That means it's not used directly for 
exceptions, it's
> only used at startup to initialize the exception handling 
routines.  I assume
> the list should be formed automagically by the C++ compiler and 
linker, but I'm
> not sure by what mechanism.
> 
> Have you verified that you have RAM at 0x405340 ?  For example, you 
could write
> a few words of garbage with your debugger and check that you read 
back the same
> garbage.
> 
> Randall
> 
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]On 
Behalf Of
> > coles555
> > Sent: Saturday, October 08, 2005 7:49 PM
> > To: [email protected]
> > Subject: [MPC500] Re: cpp init & machine check
> >
> >
> > Hi Randall,
> > Thanks for your reply to my question. I was wondering if you 
happen
> > to know what the _ctors addresses are for? In CW I see the _ctors
> > values are all 0xFB00FB00 (not terminated by a null). This 
address is
> > definitely out of range of the PB board. Can you tell me where 
these
> > addresses are generated from?
> > According to the documentation of cpp init function:
> > Calls constructors of which the cpp exception handling 
initialization
> > is the first constructor, if exceptions are used.
> > Does this mean that the _ctors addresses are used for cpp 
exception
> > handling? Any help would be greatly appreciated.
> >
> > Lei
> >
> >
> > --- In [email protected], "Randall" <ryoung@n...> wrote:
> > >
> > >
> > > "bne" is "branch not equal", and it implements the "for" loop.  
The
> > three
> > > instructions above the bne increment the pointer "constructor",
> > dereference it,
> > > and compare it to 0x0.  If it's not zero, the bne instruction
> > repeats the loop
> > > until it is.
> > >
> > > What is the value in R12 (and CTR) when you get the machine 
check ?
> > >
> > > Does the table stored at 0x405340 (_ctors) appear to contain a 
list
> > of valid
> > > function addresses, terminated by a NULL (0x0) ?  R31 should 
point
> > to one of the
> > > entries in the table, and R12 should have the address stored in 
the
> > table.
> > >
> > > At first blush, I'd guess you're trying to run this from 
internal
> > RAM, and your
> > > program is too large.  I don't have my manual handy, but ISTR
> > 0x405340 is a bad
> > > address.
> > >
> > > Randall Young
> > > Senior Software Engineer
> > > NavCom Technology, Inc
> > > A John Deere Company
> > >
> > > > Hey guys,
> > > > I'm really stuck on this constructor function in the cpp-
init. For
> > > > some reason Codewarrior keeps giving me machine check 
exceptions
> > > > during the branch command shown below:
> > > >
> > > > {
> > > > 003FA35C: 9421FFF0  stwu     SP,-16(SP)
> > > > 003FA360: 7C0802A6  mflr     r0
> > > > 003FA364: 90010014  stw      r0,20(SP)
> > > > 003FA368: 93E1000C  stw      r31,12(SP)
> > > > 	voidfunctionptr *constructor;
> > > >
> > > > 	/*
> > > > 	 *	call static initializers
> > > > 	 */
> > > > 	for (constructor = _ctors; *constructor; constructor++) {
> > > > 003FA36C: 3C600040  lis      r3,64
> > > > 003FA370: 3BE35340  addi     r31,r3,21312
> > > > 003FA374: 48000014  b        __init_cpp+0x28 (0x3fa388)
> > > > 		(*constructor)();
> > > > 003FA378: 819F0000  lwz      r12,0(r31)
> > > > 003FA37C: 7D8903A6  mtctr    r12
> > > > 003FA380: 4E800421  bctrl               //MACHINE CHECK
> > > > 	}
> > > > 003FA384: 3BFF0004  addi     r31,r31,4
> > > > 003FA388: 801F0000  lwz      r0,0(r31)
> > > > 003FA38C: 28000000  cmplwi   r0,0x0000
> > > > 003FA390: 4082FFE8  bne      __init_cpp+0x1c 
(0x3fa378)  //branch
> > > > to   003FA378
> > > >
> > > > }
> > > > 003FA394: 83E1000C  lwz      r31,12(SP)
> > > > 003FA398: 80010014  lwz      r0,20(SP)
> > > > 003FA39C: 7C0803A6  mtlr     r0
> > > > 003FA3A0: 38210010  addi     SP,SP,16
> > > > 003FA3A4: 4E800020  blr
> > > >
> > > > I'm not sure what is the bne instruction for, if anyone can 
help I
> > > > would really appreciated.
> > > >
> > > > Lei
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -----------------------------------------------------------
> > > > 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
> >
> >
> >
> >
> >
> >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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.