RE: RE: Load an MPC555 register with address

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

 

New thought on this,  I tried the following assembly code for the MPC555, it
gave me an error that reads something like:

 

Error: Unsupported relocation against __SP_INIT.

 

            lis                     r1,__SP_INIT@ha

            ori                     r1, r1,__SP_INIT

 

Does anyone know what this error means?

Does anyone know how to load a register in the MPC555 with the address of a
label? For example:

 

Here:

            Lwz      r1,here

 

Oh, just occurred to me, the assembler is trying to assemble this code and
"here" is an unresolved symbol who's value will not be known until link
time. Hmmmm, what does one do in cases like this? I'm trying to load the
value the linker comes up with for the stack into the stack pointer register
(r1).

 

Thanks for any help you might be able to offer.

 

Dave

 

  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of
David Eicher
Sent: Sunday, April 17, 2005 9:02 AM
To: [email protected]
Subject: [MPC500] RE: Load an MPC555 register using GNU C

 

Hello again list,



I just confirmed that this works:



            /*

             *          initialize stack pointer

             */



                        asm ("lis                       r1,%0" : : "g"
(0x0040));                                      /* __SP_INIT is generated by
linker */

                        asm ("ori                       r1, r1,%0" : : "g"
(0x0000));



This gets the stack set at 0x00400000 which is what I need. But I can't
figure out how to do it using the linker generated symbol (shown below),
seems like it should be so simple, and yet it eludes me.



Thanks for any help you might be able to offer,



Dave





  _____  

From: David Eicher [mailto:[email protected]] 
Sent: Saturday, April 16, 2005 4:45 PM
To: '[email protected]'
Subject: Load an MPC555 register using GNU C



Hello list,



I'm still having trouble properly loading the address of a linker generated
symbol into a register (r1) in the 555. This is a GNU C environment. My code
so far looks like this:



                        UWord32 tmp;



                        tmp = &(__SP_INIT);

                        asm ("lis                       r1,%0" : : "g" ((tmp
>> 16) & 0xFFFF));   /* __SP_INIT is generated by linker */

                        asm ("ori                       r1, r1,%0" : : "g"
((tmp) & 0xFFFF));



I'm trying to load the "address of" __SP_INIT which is the top of the stack
into register GPR1 (or r1).  But this code doesn't get it done, I'm not sure
what I'm doing wrong. The seems to be some little sutle point I'm missing.



Thanks for any insight you might be able to offer,



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 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]
<mailto:[email protected]?subject=Unsubscribe> 
  
*	Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/>  Terms of Service. 



[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/
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.