Closed avrs-admin closed 2 years ago
Joerg Wunsch
Which errors do you get? Just claiming "compile/link errors" is way too generic to judge about anything.
Also, did you include -lm to the end of the linker commandline? (It's always best to quote the complete commandline used to compile your test program.)
Please answer these questions until 2010-04-10 so we can proceed.
Simco - R.Fischer
Hello Joerg,
It seems a link error. The attached Studio4 screendump show the folowing message:
rm -rf FloatTest.o FloatTest.elf dep/* FloatTest.hex
FloatTest.eep FloatTest.lss FloatTest.map
Build succeeded with 0 Warnings...
avr-gcc -mmcu=atxmega128a1 -Wall -gdwarf-2 -Os -std=gnu99
-funsigned-char -funsigned-bitfields -fpack-struct
-fshort-enums -MD -MP -MT FloatTest.o -MF
dep/FloatTest.o.d -c ../FloatTest.c
avr-gcc -mmcu=atxmega128a1 -Wl,-Map=FloatTest.map
FloatTest.o -o FloatTest.elf
c:/program files/winavr-
20100110/bin/../lib/gcc/avr/4.3.3/../../../../
avr/lib/avrxmega7\libc.a(floatsisf.o): In function
__floatunsisf': (.text.avr-libc.fplib+0x0): multiple definition of
__floatunsisf'
c:/program files/winavr-
20100110/bin/../lib/gcc/avr/4.3.3/avrxmega7\libgcc.a
(_usi_to_sf.o):c:\avrdev\gcc\build-avr\avr\avrxmega7
\libgcc/../../.././gcc/fp-bit.c:1391: first defined
here
make: *** [FloatTest.elf] Error 1
Build failed with 1 errors and 0 warnings...
I compile with Studio4, I do not know how to add the -ml option.
Regards, Robert.
Simco - R.Fischer
Anitha solved my problem:
I think you haven't included libm.a. Please revisit you project configuration. This has built fine for me when I made the change.
http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_libm
Anitha
And yes, this seems to work. Because I didn't get the 'undefined reference' error, I didn't found this solution is the FAQ.
Thanks!
Regards, Robert.
Joerg Wunsch
This is essentially just another incarnation of bug #3485.
Georg-Johann Lay
This is essentially just another incarnation of bug #3485.
I'd rather say it's a duplicate of bug #33698.
-lm might mask the very problem in most situations, but the root problem is still there: explicit use of cross-module RCALL/RJMP.
Wed 07 Apr 2010 08:16:41 AM CEST
Hello,
Using the folowing code results to compile/link errors:
include
/ Project: SHTxx / typedef union { unsigned int i; float f; } value;
//-------------------------------------------------------------- // calculates dew point // input:humidity [%RH], temperature [] // output: dew point //-------------------------------------------------------------- float calc_dewpoint(float h, float t) { float logEx; float dew_point;
// // Original code (ERROR!!!): logEx = 0.66077 + 7.5 t / (237.3 + t) + (log10(h) - 2); dew_point = (logEx - 0.66077) 237.3 / (0.66077 + 7.5 - logEx); //
/ // Modified code (just for the test): logEx = 0.66077 + 7.5 t / (237.3 + t) + (1.0 - 2); dew_point = (logEx - 0.66077) 237.3 / (0.66077 + 7.5 - logEx); /
return dew_point; }
//-------------------------------------------------------------- // sample program that shows how to use SHT11 functions //-------------------------------------------------------------- int main(void) { value humi_val; value temp_val; float dew_point;
while (1) { converts integer to float humi_val.f = (float)humi_val.i; temp_val.f = (float)temp_val.i;
calculate dew point dew_point = calc_dewpoint(humi_val.f, temp_val.f); }
return 0; }
I'm using the WinAVR20100110 compiler, but the WinAVR20090313 has the same problem. I also use Studio4 4.18 SP2 build 700. The used micro is a ATXmega128A1.
See function calc_dewpoint(). When I compile with the original code, it results in an compile error, so I modified the code and replaced the log10(h) code into 1.0. Now it is compiled without any errors.
Hope this problem will be fixed soon.
Regards, Robert.
file #20144: FloatTest_20100406c.zip file #20145: WinAvrBug.JPG
This issue was migrated from https://savannah.nongnu.org/bugs/?29458