Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

Discussion Groups | LPC2000 | problems using math.h

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

problems using math.h - oemtyo - Aug 12 7:25:00 2005

Hi everyone,

I'm programming an application for lpc2119 and need to do
complex mathematical calculations with values got from the
A/D-Converter. Therefore i need to include the math.h to be
able to call functions such as pow() or sqrt() ...

The linker-flag "-lm" to include the math-library is set.
(GNU ld version 2.14 20030612)

But using newlib version 1.12.0 and arm-elf-gcc 3.3.3 I get
several linker errors with undefined references to functions
the libm.a should provide.

<snip>
make -k all
arm-elf-ld -v -omain.prg ./crt0.o smon_main.o armVIC.o printf.o
-T./lpc2119.ld -Map map
/home/lpc2119/arm-elf/arm-elf/lib/libm.a(w_pow.o)(.text+0x80): In
function `pow':
/home/lpc2119/newlib-1.12.0/newlib/libm/math/w_pow.c:88: undefined
reference to `__eqdf2'
/home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(w_
pow.o)(.text+0x128):/home/lpc2119/newlib-1.12.0/ne
wlib/libm/math/w_pow.c:108:
undefined reference to `__eqdf2'
[...] 8 lines more
/home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_pow.o)(.text+0x4c8):
In function `__ieee754_pow':
/home/lpc2119/newlib-1.12.0/newlib/libm/math/e_pow.c:271: undefined
reference to `__gtdf2'
/home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_
pow.o)(.text+0x98c):/home/lpc2119/newlib-1.12.0/ne
wlib/libm/math/e_pow.c:277:
undefined reference to `__ledf2'
[...] 4 lines more
In function `__ieee754_sqrt':
/home/lpc2119/newlib-1.12.0/newlib/libm/math/e_sqrt.c:180: undefined
reference to `__gtdf2'
GNU ld version 2.14 20030612
make: *** [main.prg] Errors 1
make: Target »all« not compiled due to errors.
</snip>

Any idea on fixing this?

Thanks in advance.

Markus Plessing





(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: problems using math.h - wiese_matthias - Aug 12 8:20:00 2005

I had similar problems. Then I changed the order of my linker flags
(and even duplicated them like: "-lm -lc -lgcc -lstdc++ -lm")...and it
worked. Good Luck!
Matthias
--- In lpc2000@lpc2..., "oemtyo" <plessing@e...> wrote:
> Hi everyone,
>
> I'm programming an application for lpc2119 and need to do
> complex mathematical calculations with values got from the
> A/D-Converter. Therefore i need to include the math.h to be
> able to call functions such as pow() or sqrt() ...
>
> The linker-flag "-lm" to include the math-library is set.
> (GNU ld version 2.14 20030612)
>
> But using newlib version 1.12.0 and arm-elf-gcc 3.3.3 I get
> several linker errors with undefined references to functions
> the libm.a should provide.
>
> <snip>
> make -k all
> arm-elf-ld -v -omain.prg ./crt0.o smon_main.o armVIC.o printf.o
> -T./lpc2119.ld -Map map
> /home/lpc2119/arm-elf/arm-elf/lib/libm.a(w_pow.o)(.text+0x80): In
> function `pow':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/w_pow.c:88: undefined
> reference to `__eqdf2'
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(w_
> pow.o)(.text+0x128):/home/lpc2119/newlib-1.12.0/ne
> wlib/libm/math/w_pow.c:108:
> undefined reference to `__eqdf2'
> [...] 8 lines more
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_pow.o)(.text+0x4c8):
> In function `__ieee754_pow':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/e_pow.c:271: undefined
> reference to `__gtdf2'
> /home/lpc2119/arm-elf/bin/../arm-elf/lib/libm.a(e_
> pow.o)(.text+0x98c):/home/lpc2119/newlib-1.12.0/ne
> wlib/libm/math/e_pow.c:277:
> undefined reference to `__ledf2'
> [...] 4 lines more
> In function `__ieee754_sqrt':
> /home/lpc2119/newlib-1.12.0/newlib/libm/math/e_sqrt.c:180: undefined
> reference to `__gtdf2'
> GNU ld version 2.14 20030612
> make: *** [main.prg] Errors 1
> make: Target »all« not compiled due to errors.
> </snip>
>
> Any idea on fixing this?
>
> Thanks in advance.
>
> Markus Plessing





(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: problems using math.h - Markus Plessing - Aug 12 8:52:00 2005

--- In lpc2000@lpc2..., "wiese_matthias" <wiese_matthias@y...>
wrote:
> I had similar problems. Then I changed the order of my linker flags
> (and even duplicated them like: "-lm -lc -lgcc -lstdc++ -lm")...and it
> worked. Good Luck!
> Matthias

Thanks Matthias, this change made the thing ...

But:

Is lpc2119 able to do this sort of floating point operations?

At the moment my app is stopping at the point pow() is used
and the extern watchdog is rebooting.

Thanks

Markus Plessing





(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )