Jump to content
fughilli

Issue with sqrt()

Recommended Posts

Hi,

 

I'm having an issue with the sqrt() function. The following code compiles and runs:

#include <math.h>

void setup()
{
  Serial.begin(9600); 
  delay(100);
  Serial.println(sqrt(1.5f));
}

void loop()
{
  
}

It gives the following output on the serial console:

1.22

The following code, however, does not compile:

#include <math.h>

void setup()
{
  Serial.begin(9600);
  randomSeed(analogRead(A0));
  delay(100);
  Serial.println(sqrt(random(0.0, 1.0f)));
}

void loop()
{
  
}

Energia spits out the following:

D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-g++ -c -g -Os -Wall -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -DF_CPU=80000000L -MMD -DARDUINO=101 -DENERGIA=9 -ID:\Energia\hardware\lm4f\cores\lm4f -ID:\Energia\hardware\lm4f\variants\stellarpad C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sketch_jun01b.cpp -o C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sketch_jun01b.cpp.o 
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\itoa.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\random.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\startup_gcc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WInterrupts.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_analog.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_digital.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_pulse.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_shift.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\adc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\can.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\comp.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\cpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\eeprom.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\epi.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\ethernet.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\fan.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\flash.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\fpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\gpio.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\hibernate.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\i2c.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\i2s.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\interrupt.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\lpc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\mpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\peci.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\pwm.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\qei.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\ssi.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sysctl.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sysexc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\systick.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\timer.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\uart.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\udma.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\usb.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\watchdog.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\HardwareSerial.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\main.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\new.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Print.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Stream.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Tone.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WMath.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WString.cpp.o
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\itoa.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\random.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\startup_gcc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WInterrupts.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_analog.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_digital.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_pulse.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\wiring_shift.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\adc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\can.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\comp.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\cpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\eeprom.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\epi.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\ethernet.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\fan.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\flash.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\fpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\gpio.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\hibernate.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\i2c.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\i2s.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\interrupt.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\lpc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\mpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\peci.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\pwm.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\qei.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\ssi.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sysctl.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sysexc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\systick.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\timer.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\uart.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\udma.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\usb.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\watchdog.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\HardwareSerial.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\main.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\new.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Print.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Stream.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\Tone.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WMath.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\WString.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-g++ -Os -nostartfiles -nostdlib -Wl,--gc-sections -T D:\Energia\hardware\lm4f\cores\lm4f\lm4fcpp.ld --entry=ResetISR -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -o C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sketch_jun01b.cpp.elf C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\sketch_jun01b.cpp.o C:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp\core.a -LC:\Users\<my username>\AppData\Local\Temp\build1872331821301160683.tmp -lc -lm -lgcc 
d:/energia/hardware/tools/lm4f/bin/../lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/lib/thumb/armv7e-m/fpu/fpv4-sp-d16\libm.a(lib_a-w_sqrt.o): In function `sqrt':
C:\MinGW\msys\1.0\home\a0273864\yagarto\newlib-build\arm-none-eabi\thumb\armv7e-m\fpu\fpv4-sp-d16\newlib\libm\math/../../../../../../../../../newlib-1.20.0/newlib/libm/math/w_sqrt.c:83: undefined reference to `__errno'
C:\MinGW\msys\1.0\home\a0273864\yagarto\newlib-build\arm-none-eabi\thumb\armv7e-m\fpu\fpv4-sp-d16\newlib\libm\math/../../../../../../../../../newlib-1.20.0/newlib/libm/math/w_sqrt.c:86: undefined reference to `__errno'
collect2.exe: error: ld returned 1 exit status

(JSYK, I have Energia on D:/, an external drive.)

 

 

Does anyone know how to fix this? I did a little digging around the interwebs and saw some stuff on compiler options having to do with some "ld" but I couldn't figure out how that would help me fix it.

 

Any help would be awesome!

 

Thanks,

fughilli

Share this post


Link to post
Share on other sites

Have you tested your use of the random function to be sure it works with the values you are feeding it, and returns a value of the type you expect?

 

I have not tried this in Energia, but according to the documentation, random appears to take int (or maybe long) arguments, and returns a long value.

http://energia.nu/Random.html

 

I would guess that the compiler might be converting the float arguments to ints/longs for you (random number between 0 and 1-1), then converting the result of 

the random call to a float.  Which may not be what you had in mind.

 

(No idea about what the linker problem is.)

Share this post


Link to post
Share on other sites

Okay, so I've changed the code a bit to remove any ambiguity that may have been presented by the use of Random. The new code is as follows:

#include <math.h>

float test_arg = 1.0f;

void setup ()
{
  Serial.begin(9600);
  delay(100);
  for(int i = 0; i < 10; i++)
  {
    Serial.println(sqrt(test_arg));
    test_arg += 0.1f;
  }
}

void loop ()
{

}

It still doesn't compile and spits out the same error:











D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-g++ -c -g -Os -Wall -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -DF_CPU=80000000L -MMD -DARDUINO=101 -DENERGIA=9 -ID:\Energia\hardware\lm4f\cores\lm4f -ID:\Energia\hardware\lm4f\variants\stellarpad C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sketch_jun02a.cpp -o C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sketch_jun02a.cpp.o 
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\itoa.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\random.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\startup_gcc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WInterrupts.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_analog.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_digital.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_pulse.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_shift.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\adc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\can.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\comp.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\cpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\eeprom.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\epi.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\ethernet.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\fan.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\flash.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\fpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\gpio.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\hibernate.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\i2c.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\i2s.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\interrupt.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\lpc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\mpu.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\peci.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\pwm.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\qei.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\ssi.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sysctl.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sysexc.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\systick.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\timer.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\uart.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\udma.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\usb.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\watchdog.c.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\HardwareSerial.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\main.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\new.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Print.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Stream.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Tone.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WMath.cpp.o
  Using previously compiled: C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WString.cpp.o
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\itoa.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\random.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\startup_gcc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WInterrupts.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_analog.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_digital.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_pulse.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\wiring_shift.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\adc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\can.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\comp.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\cpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\eeprom.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\epi.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\ethernet.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\fan.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\flash.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\fpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\gpio.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\hibernate.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\i2c.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\i2s.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\interrupt.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\lpc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\mpu.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\peci.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\pwm.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\qei.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\ssi.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sysctl.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sysexc.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\systick.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\timer.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\uart.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\udma.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\usb.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\watchdog.c.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\HardwareSerial.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\main.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\new.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Print.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Stream.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\Tone.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WMath.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-ar rcs C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\WString.cpp.o 
D:\ENERGIA\HARDWARE\TOOLS\LM4F\BIN\arm-none-eabi-g++ -Os -nostartfiles -nostdlib -Wl,--gc-sections -T D:\Energia\hardware\lm4f\cores\lm4f\lm4fcpp.ld --entry=ResetISR -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -o C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sketch_jun02a.cpp.elf C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\sketch_jun02a.cpp.o C:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp\core.a -LC:\Users\<my username>\AppData\Local\Temp\build92750122632519614.tmp -lc -lm -lgcc 
d:/energia/hardware/tools/lm4f/bin/../lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/lib/thumb/armv7e-m/fpu/fpv4-sp-d16\libm.a(lib_a-w_sqrt.o): In function `sqrt':
C:\MinGW\msys\1.0\home\a0273864\yagarto\newlib-build\arm-none-eabi\thumb\armv7e-m\fpu\fpv4-sp-d16\newlib\libm\math/../../../../../../../../../newlib-1.20.0/newlib/libm/math/w_sqrt.c:83: undefined reference to `__errno'
C:\MinGW\msys\1.0\home\a0273864\yagarto\newlib-build\arm-none-eabi\thumb\armv7e-m\fpu\fpv4-sp-d16\newlib\libm\math/../../../../../../../../../newlib-1.20.0/newlib/libm/math/w_sqrt.c:86: undefined reference to `__errno'
collect2.exe: error: ld returned 1 exit status

Any other possibilities?

 

Okay, wait, I just found this:

 

http://mhonarc.axis.se/dev-etrax/msg00675.html

 

The guy there just defined "__errno" in his code body and it compiled:

int __errno;

I feel like that hack shouldn't be necessary. It compiled and is a workable solution for now. I would still like to know what causes the bug in the first place, though. If anyone can find a solution that doesn't require hacking in variables like this, please reply!

Edited by fughilli

Share this post


Link to post
Share on other sites

I get the same link error + one other when I compile the broken wiring.c to properly handle the 64 bits from the timer long long is needed. To get around the link eror  I had to hack and split to two 32-bit timers to make it work for freqs other than 80Mhz. (for some reason my I2C  BMP085 does not like 80mhz but runs at 50mhz.. May be problem with I2C libs as I don't do anything special).

 

The current code limits millis to 53000+ due to long divides instead of long long. This causes delays like 1 minute or reading millis to do something every minute to have major problems).

.In addition if you use/need a frequency != 80,000,000 everything breaks. I have a revised wiring.c that uses F_CPU passed on the command line.   I will try the __errorno have and if that works post the new wiring.c.

 

Regards

JohnK

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×