As a general suggestion, try and get something very simple working,
and work from there. In this case, I'd suggest:
- one 'C' file, with one function
- one assembler file, with one function
- one link file to link the two
Does that work?
If no, then you have something simple to figure out what's wrong
(try posting the relevant files here, and I'm sure someone will
suggest something).
If yes, then try adding stuff a bit at a time until you're back to
where you started from.
This is a general, well-known and effective strategy for locating
the source of problems.
A couple of more specific suggestions:
- does the linker require files to be in order? if so, then maybe
the file order is wrong
- are you 100% sure it's picking up the right files from the right
locations?
Brendan.
--- In lpc2000@yahoogroups.com, "dgaydou" <dgaydou@...> wrote:
>
> --- In lpc2000@yahoogroups.com, Richard Duits <yahoo@> wrote:
> >
> > Make sure the identifier from your error message is exactly the
> same as
> > the identifier after the .global. I used to code x86 assembler
in
> masm
> > or tasm and there you had to prefix the identifier with an
> underscore (
> > _ ). When I started with ARM also did this and it gave the same
> errors
> > you are getting now.
>
> It´s verified, there is absolute coincidence. I´ve pased -
> y "Problematic function" to the linker, and it confirms that they
are
> declare properly in those assembler object files. I´ve also made
> tests with underscores (_), and it didn´t work.
>
>
> >
> > Make sure you use extern "C" { ..... } if you are coding in c++,
> > otherwise the identifiers are decorated (to make overloading
> possible
> > and add some extra error checking).
>
> I´m coding in "C", I´ve declare the functions: extern void
> ProblematicFunction (void);
>
>
> I´ve brought together some .c and.s files plus a makefile in a
folder
> to debug this problem. I could upload or email it if someone wants
to
> test and see the problem. I´m sure i´m making an obviously
mistake :).
>
> Thanks again.
>
> >
> > Regards,
> > Richard.
> >
> >
> > dgaydou wrote:
> > > i´m afraid, i´ve already done it, as you tell me in your
example.
> It
> > > must be something else... another idea, please.
> > > Thanks for your help
> > >
> > > --- In lpc2000@yahoogroups.com, "brendanmurphy37"
> > > <brendanmurphy37@> wrote:
> > > >
> > > > --- 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
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > SPONSORED LINKS
> > > Microcontrollers
> > > <http://groups.yahoo.com/gads?
>
t=ms&k=Microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Inte
l
> +microprocessors&c=3&s=69&.sig=c-HXthtbZy4TZbI3ib0PMg>
> > > Microprocessor
> > > <http://groups.yahoo.com/gads?
>
t=ms&k=Microprocessor&w1=Microcontrollers&w2=Microprocessor&w3=Intel+
m
> icroprocessors&c=3&s=69&.sig=ijt0SspWtjogcHCuFD0lUQ>
> > > Intel microprocessors
> > > <http://groups.yahoo.com/gads?
>
t=ms&k=Intel+microprocessors&w1=Microcontrollers&w2=Microprocessor&w3
=
> Intel+microprocessors&c=3&s=69&.sig=WOZdpklkgHbXR5quAgrl5w>
> > >
> > >
> > >
> > > ---------------------------------------------------------------
---
> ------
> > > YAHOO! GROUPS LINKS
> > >
> > > * Visit your group "lpc2000
> > > <http://groups.yahoo.com/group/lpc2000>" on the web.
> > >
> > > * To unsubscribe from this group, send an email to:
> > > lpc2000-unsubscribe@yahoogroups.com
> > > <mailto:lpc2000-unsubscribe@yahoogroups.com?
> subject=Unsubscribe>
> > >
> > > * Your use of Yahoo! Groups is subject to the Yahoo!
Terms of
> > > Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> > > ---------------------------------------------------------------
---Show quoted textHide quoted text