Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: How to declare RAM functions in GCC

2005-01-17 by Anton Erasmus

On 14 Jan 2005 at 19:15, sig5534 wrote:

> 
> 
> Thanks sjo.  Exactly what I was looking for.
> 
> I'm trying to get your last method to would, using the attribute. 
> This is what I did for a test function:
> 
> void __attribute__((section(".data"))) IAP_Test( void ) {
>   U32 N;
>   N=IOPIN;
> }  // IAP_Test
> 
> When I make I get:
> 
> main.o(.text+0x150): In function `main':
> /cygdrive/d/GNUARM/Projects/Vader/main.c:96: relocation truncated to
> fit: R_ARM_PC24 IAP_Test collect2: ld returned 1 exit status
> D:\GNUARM\bin\make: *** [vader.elf] Error 1
> 
> The line #96 in main is where I put the call to IAP_Test().  GCC is
> taking the attribute, and seems to be doing something with it, but it
> is giving me this relocation error.  I don't know what R_ARM_PC24 is.
> 
> Do I need to allocate extra space for this in my startup.s file?
> 
> Can you give any help on this?  This would be great to get working
> with this method.  
> 
> Thanks,  Chris.
> 
> 

The following seems to work:

void foo(void) __attribute__ ((section ("data")));
void bar(void);



void foo(void)
{

}

int global1;

void bar(void)
{
   foo();
}             

Both function foo and global int global1 is put into the data section.

Regards
   Anton Erasmus
-- 
A J Erasmus

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.