RE: Load an MPC555 register using GNU C
"David Eicher" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
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]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/