| Author |
Message |
|
|
Posted: Jul 29, 2007 - 04:58 AM |
|

Joined: May 21, 2007
Posts: 88
Location: John Day, Oregon, US
|
|
I've got a program that uses sin, cos, pow, and sqrt functions to calculate IIR filter coefficients based on specifications. Although the math.h include file has definitions for these the linker complains:
Severity and Description Path Resource Location Creation Time Id
undefined reference to `cos' Seneca libfilters.c line 664 1185678363046 49100
undefined reference to `pow' Seneca libfilters.c line 664 1185678363046 49101
undefined reference to `sin' Seneca libfilters.c line 664 1185678363046 49099
undefined reference to `sqrt' Seneca libfilters.c line 459 1185678363046 49098
Can anyone verify if these functions are supposed to be available for the AVR32UC3A?
In a related note, is the source for the C library available, stuff like floating point operations on the AVR32? I found those very helpful when I was doing ADSP-2189 development. |
|
|
| |
|
|
|
|
|
Posted: Jul 29, 2007 - 07:48 AM |
|


Joined: Jul 27, 2001
Posts: 7429
Location: St. Leonards-on-Sea (UK)
|
|
Have you used -lm in the linker command line to link in the maths library?
Leon |
_________________ Leon Heller
G1HSM
|
| |
|
|
|
|
|
Posted: Jul 29, 2007 - 08:27 AM |
|

Joined: Apr 01, 2004
Posts: 3812
Location: New Mexico
|
|
|
|
|
|
|
Posted: Jul 29, 2007 - 02:35 PM |
|


Joined: Sep 14, 2003
Posts: 4228
Location: Queanbeyan, Australia
|
|
uClibc runs on top of Linux, for UC3 dev the library to use is Newlib but doesn't have AVR32 optimized floating point.
I don't know of any optimized libraries around, maybe someone else has more details.
-S. |
|
|
| |
|
|
|
|
|
Posted: Jul 29, 2007 - 06:20 PM |
|

Joined: Apr 01, 2004
Posts: 3812
Location: New Mexico
|
|
|
|
|
|
|
Posted: Jul 30, 2007 - 10:43 AM |
|

Joined: Jun 26, 2007
Posts: 72
|
|
|
certsoft wrote:
I've got a program that uses sin, cos, pow, and sqrt functions to calculate IIR filter coefficients based on specifications. Although the math.h include file has definitions for these the linker complains:
...
Can anyone verify if these functions are supposed to be available for the AVR32UC3A?
I've made a test example with calls to sin, cos, pow and sqrt running on the EVK1100, printing results to USART0. Looks ok. Which compiler are you using?
certsoft wrote:
In a related note, is the source for the C library available, stuff like floating point operations on the AVR32? I found those very helpful when I was doing ADSP-2189 development.
I don't know if you're using GCC, but the source code for the 1.1.0 AVR32 GNU Toolchain is here: http://www.atmel.com/dyn/resources/prod_documents/avr32_gnu_toolchain_source_1.1.0.zip
I never took the time to look into it, but this should contain the floating point operations emulation.
Cyr.
. |
|
|
| |
|
|
|
|
|
Posted: Jul 30, 2007 - 09:20 PM |
|

Joined: May 21, 2007
Posts: 88
Location: John Day, Oregon, US
|
|
|
cboulang wrote:
I've made a test example with calls to sin, cos, pow and sqrt running on the EVK1100, printing results to USART0. Looks ok. Which compiler are you using?
Gcc. Did you add anything to the linker options in AVRStudio?
Quote:
I don't know if you're using GCC, but the source code for the 1.1.0 AVR32 GNU Toolchain is here: http://www.atmel.com/dyn/resources/prod_documents/avr32_gnu_toolchain_source_1.1.0.zip
I never took the time to look into it, but this should contain the floating point operations emulation.
Thanks for the link. I'm over my download limit over the satellite for this month but will take a look at that in a couple of days. Hopefully it has the runtime support source for the compiler for stuff like floating point operations. When trying to do FIR and IIR filters you have to very careful to make sure things like multiply are done in the best way. |
|
|
| |
|
|
|
|
|
Posted: Jul 31, 2007 - 09:28 AM |
|

Joined: Jun 26, 2007
Posts: 72
|
|
|
certsoft wrote:
cboulang wrote:
I've made a test example with calls to sin, cos, pow and sqrt running on the EVK1100, printing results to USART0. Looks ok. Which compiler are you using?
Gcc. Did you add anything to the linker options in AVRStudio?
You mean AVR32Studio?
I added -lm (to link with the math library).
Cyr.
. |
|
|
| |
|
|
|
|
|
Posted: Jul 31, 2007 - 11:14 PM |
|

Joined: May 21, 2007
Posts: 88
Location: John Day, Oregon, US
|
|
|
cboulang wrote:
I added -lm (to link with the math library).
Didn't help here. I tried:
1) -lm on the gcc command line.
2) -lm on the linker command line.
3) -Wl,-lm on the linker command line.
Doesn't do any good. If I can't find the magical gnu incantation I'll just translate the routines from the OmegaSoft Pascal runtime library  |
|
|
| |
|
|
|
|
|
Posted: Aug 01, 2007 - 10:10 AM |
|

Joined: Jun 26, 2007
Posts: 72
|
|
This is the linker command line of the example i used:
Code:
Linking to `uc3a0512-example.elf'.
avr32-gcc -march=uc -mpart=uc3a0512 -T../../../../../UTILS/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds -Wl,--gc-sections ../../../../../DRIVERS/USART/usart.o ../../../../../DRIVERS/INTC/intc.o ../../../../../DRIVERS/GPIO/gpio.o ../../../../../DRIVERS/PM/pm.o ../../../../../UTILS/DEBUG/print_funcs.o ../../example.o ../../../../../DRIVERS/INTC/exception.o -lm -o uc3a0512-example.elf
In case you use a Makefile/config.mk scheme (from the Software Framework), you should write a single 'm' to the LIBS variable in config.mk; the Makefile adds the -l.
Cyr.
. |
|
|
| |
|
|
|
|
|
Posted: Aug 02, 2007 - 03:26 AM |
|

Joined: May 21, 2007
Posts: 88
Location: John Day, Oregon, US
|
|
|
cboulang wrote:
In case you use a Makefile/config.mk scheme (from the Software Framework), you should write a single 'm' to the LIBS variable in config.mk; the Makefile adds the -l.
Thanks! |
|
|
| |
|
|
|
|
|
Posted: Dec 19, 2007 - 09:30 AM |
|

Joined: Oct 24, 2007
Posts: 10
|
|
Hi, I have a similar problem with including math.h in AVR32 Studio.
I have tried to include math.h in source file and next to add the option -lm adding in Menù Project-> Properties -> C/C++ Build -> Tool Settings -> AVR32/GNU C Linker -> Libraries -> Libraries (-l) only the letter "m".
But when i start the Build process, in the console I have this error
Quote:
**** Build of configuration Debug for project anello ****
**** Internal Builder is used for build ****
**** NOTE: Internal Builder is experimental currently ****
avr32-gcc -LD:\Documents and Settings\Miccino\Documenti\workspace\anello -LD:\Documents and Settings\Miccino\Documenti\workspace\anello\EVK1100 -Wl,-e,_trampoline -mpart=uc3a0512 -oanello.elf usart.o trampoline.o tc.o spi.o sdramprova.o sdramc.o sdram_log.o pwm.o provva.o print_funcs.o pm.o pi.o pi+logging.o logging_sdram.o intc.o gpio.o exception.o adc.o EVK1100\led.o Campionamento fitto.o
provva.o: In function `tc_irq':
/cygdrive/d/Documents and Settings/Miccino/Documenti/workspace/anello/Debug/..\provva.c:140: undefined reference to `sin'
/cygdrive/d/Documents and Settings/Miccino/Documenti/workspace/anello/Debug/..\provva.c:140: undefined reference to `trunc'
collect2: ld returned 1 exit status
Build error occured, build is stopped
Any ideas?
Thanks! |
|
|
| |
|
|
|
|
|
Posted: Dec 19, 2007 - 11:06 PM |
|


Joined: Sep 14, 2003
Posts: 4228
Location: Queanbeyan, Australia
|
|
|
mitchcortinueviz wrote:
...
avr32-gcc -LD:\Documents and Settings\Miccino\Documenti\workspace\anello -LD:\Documents and Settings\Miccino\Documenti\workspace\anello\EVK1100 -Wl,-e,_trampoline -mpart=uc3a0512 -oanello.elf usart.o trampoline.o tc.o spi.o sdramprova.o sdramc.o sdram_log.o pwm.o provva.o print_funcs.o pm.o pi.o pi+logging.o logging_sdram.o intc.o gpio.o exception.o adc.o EVK1100\led.o Campionamento fitto.o
...
You may add the maths library in the avr32studio linker settings but the switch still isn't there on the command line. Try adding it to the C/C++ compiler page instead of the linker one.
-S. |
|
|
| |
|
|
|
|
|
Posted: Dec 20, 2007 - 09:53 AM |
|

Joined: Oct 24, 2007
Posts: 10
|
|
Hi,
I've solved the problem disabling the Esperimental Internal Builder.
Thanks,
Mitch |
|
|
| |
|
|
|
|
|
Posted: Jul 26, 2010 - 12:10 PM |
|

Joined: Jul 03, 2007
Posts: 9
|
|
| For AVR32Studio the way to enable math routines is to add a string with only letter 'm' in the pane "Libraries (-l)" in Project-> Properties -> C/C++ Build -> Settings -> Tool Settings -> AVR32/GNU C Linker -> Libraries |
|
|
| |
|
|
|
|
|