More below...
On Monday 17 January 2005 13:34, sig5534 wrote:
> Hold the phone, something funny is going on here. The debugger says
> that IAP_Test() is at adr 0x40000000. However when I look at the
> dissassembly I see this:
>
> pramfunc:
> 0x40000000 E321F0D1 DD 0xE321F0D1 ; DATA SECTION
> 14: return IOPIN|n;
pramfunc is supposed to be a pointer, so it should be holding 0x40000004 or
something (ie. a pointer to the actual function).
Try consting the pointer... this should shift it into the literal pool. This
will alter the code slightly and maybe make it work.
> IAP_Test:
> 0x40000004 E59FD05C LDR SP,[PC,#+0x5c]
> 0x40000008 E321F0D2 MSR CPSR_c,#0xd2
> 0x4000000C E59FD054 LDR SP,[PC,#+0x54]
> 15: }
> 0x40000010 E321F0D7 MSR CPSR_c,#0xd7
> 0x40000014 E59FD04C LDR SP,[PC,#+0x4c]
>
> This looks like there is some kind of data or segment marker right at
> 0x40000000. However, the actual code is at 0x40000004.
>
> So it appears the adr being loaded into the PC is 0x40000000 and that
> does not appear to be code.
>
> What's going on here? Why did the compiler/linker do this?
What seems strange to me is that the code you showed was
LDR PC,[R5,#0]
This is not what I'd expect unless the previous instruction was
MOV LR,PC
This would syntesize a branch and link.
I'd expect more to see something like:
MOV or LDR to get address into a register Rx
BL Rx
What version compiler/linker are you using? Could be an older broken one.
>
> It is placing this RAM function before the variables. The RAM
> variables have been moved to 0x40000020.
>
> I'd rather have it the other way around. The RAM functions after the
> variables. That might solve this problem too.
>
> Any thoughts on how to get the RAM functions after the RAM
> variables? Do I need to define some more segments and the the linker
> how to order them?
To control the placement you really need to use an ldscript and if you're
doing that you might as well then use the ldscript to do the placement for
you.
I do this with a section that looks like:
/* Code goes into internal RAM */
__textram_VMA__ = .; /* Where code is to be located */
.ram_text __textram_VMA__ : AT ( __textram_bLMA__ )
{
ramfunc.o(.text)
}
This makes a whole seperate section that I copy in maincrt.s, just like the
.data section is copied.
You could also place this at the end of the .data section and see if that
works.
>
> Chris.
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>Message
Re: [lpc2000] Re: How to declare RAM functions in GCC
2005-01-17 by Charles Manning
Attachments
- No local attachments were found for this message.