Skip to content

xtensa error #3216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Supersimo88 opened this issue May 8, 2017 · 9 comments
Closed

xtensa error #3216

Supersimo88 opened this issue May 8, 2017 · 9 comments

Comments

@Supersimo88
Copy link

Supersimo88 commented May 8, 2017

Hardware

Hardware: ESP8266

Description

I'm getting this errors

c:/users/super/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-e_fmod.o):(.literal+0x0): undefined reference to `__ieee754_remainder'

c:/users/super/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-e_fmod.o): In function `__ieee754_fmod':

e_fmod.c:(.text+0x48): undefined reference to `__ieee754_remainder'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Generic ESP8266 Module.

Settings in IDE

Module: Generic ESP8266 module
Flash Size: 1M (128K SPIFFS)
CPU Frequency: ?80Mhz?
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: ck

Sketch

#include <ESPHelper.h>
//#include <HSBColor.h>

#include <my9291.h>

#include "math.h"

//#include <hsi2rgbw.h>

#define TOPIC "/light/rgb"
#define STATUS TOPIC "/status"
#define NETWORK_HOSTNAME "rgblight"
#define OTA_PASSWORD "ENOMIS55"

//#define RED_PIN D7
//#define GREEN_PIN D6
//#define BLUE_PIN D5
//#define BLINK_PIN D4

#define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15

my9291 _my9291 = my9291(MY9291_DI_PIN, MY9291_DCKI_PIN, MY9291_COMMAND_DEFAULT);

#define DEG_TO_RAD(X) (M_PI*(X)/180)

typedef struct lightState{
double hue;
double saturation;
double brightness;
int red;
int redRate;
int green;
int greenRate;
int blue;
int blueRate;
//int fadePeriod;
//int updateType;
int white;
int whiteRate;
};

lightState nextState;

boolean newCommand = false;

char* lightTopic = TOPIC;
char* statusTopic = STATUS;
char* hostnameStr = NETWORK_HOSTNAME;

//const int redPin = RED_PIN;
//const int greenPin = GREEN_PIN;
//const int bluePin = BLUE_PIN;
//const int blinkPin = BLINK_PIN;

char statusString[50]; //string containing the current setting for the light

//set this info for your own network
netInfo homeNet = {.name = "rgblight", .mqtt = "192.168.1.19", .ssid = "Telecom-19250793", .pass = "yxsplyuvMmEMlS5vbg67MPK3"};

ESPHelper myESP(&homeNet);

void setup() {
//initialize the light as an output and set to LOW (off)
//pinMode(redPin, OUTPUT);
//pinMode(bluePin, OUTPUT);
//pinMode(greenPin, OUTPUT);

//all off
//digitalWrite(redPin, LOW); //all off
//digitalWrite(greenPin, LOW);
//digitalWrite(bluePin, LOW);

_my9291.setColor((my9291_color_t) { 0, 0, 0, 255 }); // W 100% duty cycle
_my9291.setState(true);

delay(1000);

//setup ota on esphelper
myESP.OTA_enable();
myESP.OTA_setPassword(OTA_PASSWORD);
myESP.OTA_setHostnameWithVersion(hostnameStr);

//myESP.enableHeartbeat(blinkPin);
//subscribe to the lighttopic
myESP.addSubscription(lightTopic);
myESP.begin();
myESP.setCallback(callback);

}
void loop() {

static bool connected = false; //keeps track of connection state

if(myESP.loop() == FULL_CONNECTION){

//if the light was previously not connected to wifi and mqtt, update the status topic with the light being off
if(!connected){
  connected = true; //we have reconnected so now we dont need to flag the setting anymore
  myESP.publish(statusTopic, "h0.00,0.00,0.00", true);
}

lightHandler();
}

yield();
}

void hsi2rgbw(float H, float S, float I, int* rgbw) {
int r, g, b, w;
float cos_h, cos_1047_h;
H = fmod(H,360); // cycle H around to 0-360 degrees
H = 3.14159*H/(float)180; // Convert to radians.
S = S>0?(S<1?S:1):0; // clamp S and I to interval [0,1]
I = I>0?(I<1?I:1):0;

if(H < 2.09439) {
cos_h = cos(H);
cos_1047_h = cos(1.047196667-H);
r = S255I/3*(1+cos_h/cos_1047_h);
g = S255I/3*(1+(1-cos_h/cos_1047_h));
b = 0;
w = 255*(1-S)I;
} else if(H < 4.188787) {
H = H - 2.09439;
cos_h = cos(H);
cos_1047_h = cos(1.047196667-H);
g = S
255I/3(1+cos_h/cos_1047_h);
b = S255I/3*(1+(1-cos_h/cos_1047_h));
r = 0;
w = 255*(1-S)I;
} else {
H = H - 4.188787;
cos_h = cos(H);
cos_1047_h = cos(1.047196667-H);
b = S
255I/3(1+cos_h/cos_1047_h);
r = S255I/3*(1+(1-cos_h/cos_1047_h));
g = 0;
w = 255*(1-S)*I;
}

rgbw[0]=r;
rgbw[1]=g;
rgbw[2]=b;
rgbw[3]=w;
}

void lightHandler(){
//new and current lightStates
static lightState newState;
static lightState currentState;

lightUpdater(&newState, currentState);
lightChanger(newState, &currentState);
}

int lightChanger(lightState newState, lightState *currentState){

currentState->red =newState.red;
currentState->green =newState.green;
currentState->blue =newState.blue;
currentState->white =newState.white;
//analogWrite(redPin, currentState->red);
//analogWrite(greenPin, currentState->green);
//analogWrite(bluePin, currentState->blue);
_my9291.setColor((my9291_color_t) { currentState->red, currentState->green, currentState->blue, currentState->white });
_my9291.setState(true);
}

void lightUpdater (lightState *newState, lightState currentState){

//calculate new vars only if there is a new command
if (newCommand){

  //convert from HSB to RGB
  /*int newRGB[3];
  H2R_HSBtoRGBfloat(nextState.hue, nextState.saturation, nextState.brightness, newRGB);
  newState->red = newRGB[0];
  newState->green = newRGB[1];
  newState->blue = newRGB[2]; 
  */
  int rgbw[4];
  hsi2rgbw(nextState.hue, nextState.saturation, nextState.brightness, rgbw);

newState->red = rgbw[0];
newState->green = rgbw[1];
newState->blue = rgbw[2];
newState->white = rgbw[3];
}
}
//MQTT callback
void callback(char* topic, byte* payload, unsigned int length) {

//convert topic to string to make it easier to work with
String topicStr = topic;

char newPayload[40];
memcpy(newPayload, payload, length);
newPayload[length] = '\0';

//handle HSB updates
if(payload[0] == 'h'){
nextState.hue = atof(&newPayload[1]);
nextState.saturation = atof(&newPayload[7]);
nextState.brightness = atof(&newPayload[13]);

newCommand = true;

}

//package up status message reply and send it back out to the status topic
strcpy(statusString, newPayload);
myESP.publish(statusTopic, statusString, true);
}

@igrr
Copy link
Member

igrr commented May 8, 2017

Originally reported in #612.
Fixed in master branch.

@igrr igrr closed this as completed May 8, 2017
@igrr igrr added the duplicate label May 8, 2017
@Supersimo88
Copy link
Author

I've already seen it but it still does not work for me

@igrr
Copy link
Member

igrr commented May 8, 2017

Which version of Arduino ESP8266 core are you using?

@Supersimo88
Copy link
Author

2.3.0

@igrr
Copy link
Member

igrr commented May 8, 2017

As mentioned, this is only fixed in master branch, not in any release, which explains why you are having this issue in 2.3.0. As a workaround, you can use git version of the core (instructions given in README.md).

@Supersimo88
Copy link
Author

I think I've done something wrong because I now get this error

exec: "D:\Arduino\arduino-1.8.1\hardware\esp8266com\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++": file does not exist

@igrr
Copy link
Member

igrr commented May 8, 2017

Probably forgot to run get.py?

@Supersimo88
Copy link
Author

yes... i'm so stupid.
Compiled succesfully
Thanks a lot you made my day!

@jack23233
Copy link

jack23233 commented Jul 6, 2017

Having the same #612 error.
deleted Arduino 1.6.x and installed Arduino 1.8.3 today
Boards Manager 'removed' esp8266 2.1.0 and installed 2.3.0 today
the same error appears. e_fmod.c:(.text+0x48): undefined reference to `__ieee754_remainder'

I am in a Win10 system (not linux) and am unable to execute the 'git' command, even after creating the ../hardware/esp8266com folder.

After adding the esp8266com folder, my compile error now also reports:
WARNING: Error loading hardware folder C:\Program Files\Arduino\hardware\esp8266com
No valid hardware definitions found in folder esp8266com.
WARNING: Error loading hardware folder C:\Program Files\Arduino\hardware\esp8266com
No valid hardware definitions found in folder esp8266com.

I think thats understandable given that I could not execute a 'git' command.
I have downloaded a new Arduino-master.zip, but am reluctant to 'unzip' it .

other .ino files that do not use "exotic math" code will compile, download and run to the nodemcu 1.0 esp8266 device.

It seems that the Board Manager does not load the appropriate files into
C:\Program Files\Arduino\hardware\esp8266com

I would really appreciate some help resolving this.

UPDATE
I'm used to running GIT in linux. woops, sorry.
downloaded GIT for Windows and Python 2.7.13.
ran the git-clone mentioned above. Ran get.py (that took a long time to do its download!)
Opened Arduino 1.8.3 and confirmed that the Nodemcu 1.0 was loaded and tried to compile the code.
same error!
update--update

I reconfigured to Arduino board to a UNO, and after closing the Arduino IDE and restarting it, confirmed that it ran the UNO compile fine.
Then I threw up my hands!
I closed all my apps and powered down/restarted the win10 pc .
on power up, the pc started normally, and I opened the arduino IDE, confirmed that the board type was for UNO and ran the UNO compile successfully.

Then I set the Board type to Nodemcu 1.0, and the nodemcu compile ran succesfully.
Downloading to the nodemcu failed to operate as expected. the info on the Serial Monitor is:

sys⸮⸮⸮⸮param error, use last saved param!

ets Jan 8 2013,rst cause:4, boot mode:(1,4)

wdt reset


a download results in the following comments
Archiving built core (caching) in: C:\Users\jack2\AppData\Local\Temp\arduino_cache_780845\core\core_esp8266com_esp8266_nodemcuv2_CpuFrequency_80,UploadSpeed_115200,FlashSize_4M3M_b7be100c7de3a8564be4267c7f7c798e.a
Sketch uses 255721 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 33844 bytes (41%) of dynamic memory, leaving 48076 bytes for local variables. Maximum is 81920 bytes.
Uploading 259872 bytes from C:\Users\jack2\AppData\Local\Temp\arduino_build_984445/az_el_JS1.ino.ino.bin to flash at 0x00000000
................................................................................ [ 31% ]
................................................................................ [ 62% ]
................................................................................ [ 94% ]
.............. [ 100% ]
the code is pasted
/*
This program calculates solar positions as a function of location, date, and time.
The equations are from Jean Meeus, Astronomical Algorithms, Willmann-Bell, Inc., Richmond, VA
(C) 2015, David Brooks, Institute for Earth Science Research and Education.
*/

#define DEG_TO_RAD 0.01745329
#define PI 3.141592654
#define TWOPI 6.28318531
#include <Servo.h>
#include "math.h"

//Servo el;
//Servo az;

void setup() {
int hour=22,minute=55,second=0,month=7,day=5,year=2017,zone=7;

//az.attach(10);
//el.attach(9);

float Lon=-117.425*DEG_TO_RAD, Lat=+47.65889 *DEG_TO_RAD;
float T,JD_frac,L0,M,e,C,L_true,f,R,GrHrAngle,Obl,RA,Decl,HrAngle,elev,azimuth;
long JD_whole,JDx;
Serial.begin(9600);
Serial.print("Longitude and latitude "); Serial.print(Lon/DEG_TO_RAD,3);
Serial.print(" "); Serial.println(Lat/DEG_TO_RAD,3);
Serial.println("year,month,day,local hour,minute,second,elevation,azimuth");

// Changes may be required in for… loop to get complete
// daylight coverage in time zones farther west.

// for (hour=7; hour<=24; hour++) {
JD_whole=JulianDate(year,month,day);
JD_frac=(hour+minute/60.+second/3600.)/24.-.5;
T=JD_whole-2451545; T=(T+JD_frac)/36525.;
L0=DEG_TO_RADfmod(280.46645+36000.76983T,360);
M=DEG_TO_RADfmod(357.5291+35999.0503T,360);
e=0.016708617-0.000042037T;
C=DEG_TO_RAD
((1.9146-0.004847T)sin(M)+(0.019993-0.000101T)sin(2M)+0.00029sin(3M));
f=M+C;
Obl=DEG_TO_RAD
(23+26/60.+21.448/3600.-46.815/3600T);
JDx=JD_whole-2451545;
GrHrAngle=280.46061837+(360
JDx)%360+.98564736629JDx+360.98564736629JD_frac;
GrHrAngle=fmod(GrHrAngle,360.);
L_true=fmod(C+L0,TWOPI);
R=1.000001018*(1-ee)/(1+ecos(f));
RA=atan2(sin(L_true)*cos(Obl),cos(L_true));
Decl=asin(sin(Obl)sin(L_true));
HrAngle=DEG_TO_RAD
GrHrAngle+Lon-RA;
elev=asin(sin(Lat)sin(Decl)+cos(Lat)(cos(Decl)*cos(HrAngle)));
// Azimuth measured eastward from north.
azimuth=PI+atan2(sin(HrAngle),cos(HrAngle)*sin(Lat)-tan(Decl)*cos(Lat));
Serial.print(year); Serial.print(","); Serial.print(month);
Serial.print(","); Serial.print(day); Serial.print(", ");
Serial.print(hour-zone); Serial.print(",");
Serial.print(minute); Serial.print(","); Serial.print(second);
// (Optional) display results of intermediate calculations.
//Serial.print(","); Serial.print(JD_whole);
//Serial.print(","); Serial.print(JD_frac,7);
//Serial.print(","); Serial.print(T,7);
//Serial.print(","); Serial.print(L0,7);
//Serial.print(","); Serial.print(M,7);
//Serial.print(","); Serial.print(e,7);
//Serial.print(","); Serial.print(C,7);
//Serial.print(","); Serial.print(L_true,7);
//Serial.print(","); Serial.print(f,7);
//Serial.print(","); Serial.print(R,7);
//Serial.print(","); Serial.print(GrHrAngle,7);
//Serial.print(","); Serial.print(Obl,7);
//Serial.print(","); Serial.print(RA,7);
//Serial.print(","); Serial.print(Decl,7);
//Serial.print(","); Serial.print(HrAngle,7);
Serial.print(","); Serial.print(elev/DEG_TO_RAD,3);
Serial.print(","); Serial.print(azimuth/DEG_TO_RAD,3); Serial.println();
//}
//el.write(elev/DEG_TO_RAD);
//az.write(azimuth/DEG_TO_RAD);

}
void loop() {}

long JulianDate(int year, int month, int day) {
long JD_whole;
int A,B;
if (month<=2) {
year--; month+=12;
}
A=year/100; B=2-A+A/4;
JD_whole=(long)(365.25*(year+4716))+(int)(30.6001*(month+1))+day+B-1524;
return JD_whole;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants