Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: How to declare RAM functions in GCC

2005-01-17 by sig5534

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;
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?  

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?

Chris.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.