Yahoo Groups archive

Lpc2000

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

Message

Re: arm-elf-ld trouble

2006-05-26 by brendanmurphy37

--- In lpc2000@yahoogroups.com, "dgaydou" <dgaydou@...> wrote:
>
> Hi group,
> i`m doing my first steps with LPC2114 and gnuarm. I´ve found a 
trouble 
> when i try to link the objects files from c-sources and as-sources 
with 
> arm-elf-ld and the following parameters : -Map main.map -
TPruebaLPC.ld -
> t. The linker tell me: Undefined reference to `THOSE FUNCTIONS 
THAT ARE 
> WROTE IN ASSEMBLER`; although i´ve declared those functions in my 
> headers files and properly included. Hope someone can help me. 
Thanks.
>

Do you have the assembler directive ".global" in the assembler 
source file? Without it the function name is not visible to the 
linker. This behaviour is different from 'C' in that the default is 
NOT to make function names visible.

Example:

/* list functions exported from this file */

.global	GetCPSR, SomeOtherFunction

/* implementation of GetCPSR */

GetCPSR:
    mrs  r0, cpsr  /* Get CPSR */
    bx   lr        /* return to caller */

This can be declared in 'C' as:

unsigned int GetCPSR(void);

and used as:

unsigned int cpsr = GetCPSR();

My guess is that this is your problem.

Brendan

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.