RE: cpp init & machine check
"Randall" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
"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
>
>
>
>
>
>
>
------------------------ 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/