I run into the following compilation error trying to compile my experimental radon sensor plugin with latest mega-20200929 release:
`.text1' will not fit in region `iram1_0_seg'
With very novice programming skills, I am afraid I am stuck here. Does anyone have any suggestions on how to fix this?
Detailed error message on compilation:
Compiling .pio\build\dev_ESP8266_4M1M\src\ESPEasy.ino.cpp.o
Linking .pio\build\dev_ESP8266_4M1M\ESP_Easy_mega_20201002_dev_ESP8266_4M1M.elf
c:/users/YT/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\dev_ESP8266_4M1M\ESP_Easy_mega_20201002_dev_ESP8266_4M1M.elf section `.text1' will not fit in region `iram1_0_seg'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\dev_ESP8266_4M1M\ESP_Easy_mega_20201002_dev_ESP8266_4M1M.elf] Error 1
========================================= [FAILED] Took 24.81 seconds =========================================
Thanks!
Plugin code:
Code: Select all
/*
//#######################################################################################################
//#################################### Plugin NNN: RD200M Radon Sensor ##################################
//#######################################################################################################
// RD200M Radon Sensor from FTLab
// https://www.radonshop.com/mediafiles/Anleitungen/Sensor/datasheet_RD200M_v1.2_eng.pdf
// Plugin is based upon MHZ19 plugin by Dmitry (rel22 ___ inbox.ru)
// and SenseAir plugin by Daniel Tedenljung (info__AT__tedenljungconsulting.com)
*/
#ifdef USES_P214
#define PLUGIN_214
#define PLUGIN_ID_214 214
#define PLUGIN_NAME_214 "Radon RD200M [TESTING]"
#define PLUGIN_VALUENAME1_214 "1 - Status"
#define PLUGIN_VALUENAME2_214 "2 - Bq/m3"
#define PLUGIN_VALUENAME3_214 "3 - Counter"
#define PLUGIN_READ_TIMEOUT 300
boolean Plugin_214_init = false;
#include <SoftwareSerial.h>
SoftwareSerial *Plugin_214_SoftSerial;
// RD200M commands and response
byte radonCmdReadRequest[4] = {0x02,0x01,0x00,0xFE}; // Command for requesting data from RD200M
byte radonCmdReset[4] = {0x02,0xA0,0x00,0x5F}; // Command for resetting RD200M
byte radonResponse[8]; // 8 bytes bytes response from RD200M
boolean Plugin_214(byte function, struct EventStruct *event, String& string)
{
bool success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_214;
Device[deviceCount].Type = DEVICE_TYPE_DUAL;
Device[deviceCount].VType = SENSOR_TYPE_TRIPLE;
Device[deviceCount].Ports = 0;
Device[deviceCount].PullUpOption = false;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = true;
Device[deviceCount].ValueCount = 3;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = true;
Device[deviceCount].GlobalSyncOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_214);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_214));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_214));
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[2], PSTR(PLUGIN_VALUENAME3_214));
break;
}
case PLUGIN_INIT:
{
/* WiFi.disconnect(true); */
Plugin_214_SoftSerial = new SoftwareSerial(Settings.TaskDevicePin1[event->TaskIndex], Settings.TaskDevicePin2[event->TaskIndex]);
Plugin_214_SoftSerial->begin(19200);
addLog(LOG_LEVEL_INFO, F("Radon RD200M: Initialization OK"));
Plugin_214_init = true;
success = true;
break;
}
case PLUGIN_WRITE:
{
String command = parseString(string, 1);
if (command == F("radonreset"))
{
Plugin_214_SoftSerial->write(radonCmdReset, 4);
addLog(LOG_LEVEL_INFO, F("Radon RD200M: Sensor reset command sent"));
success = true;
}
break;
}
case PLUGIN_READ:
{
Plugin_214_init = true; //Can this line be deleted?
if (Plugin_214_init)
{
//send Read valueBqm3 command
addLog(LOG_LEVEL_INFO, F("Radon RD200M: Sensor read command sent"));
int nbBytesSent = Plugin_214_SoftSerial->write(radonCmdReadRequest, 4);
if (nbBytesSent != 4) {
String log = F("Radon RD200M: Error, nb bytes sent != 4 : ");
log += nbBytesSent;
addLog(LOG_LEVEL_INFO, log);
}
// get response
memset(radonResponse, 0, sizeof(radonResponse));
long start = millis();
int counter = 0;
while (((millis() - start) < PLUGIN_READ_TIMEOUT) && (counter < 8)) {
if (Plugin_214_SoftSerial->available() > 0) {
radonResponse[counter++] = Plugin_214_SoftSerial->read();
String log = F("Radon RD200M: Reading data from sensor");
} else {
String log = F("Radon RD200M: An error occured while trying to read");
delay(10);
}
}
if (counter < 8){
addLog(LOG_LEVEL_INFO, F("Radon RD200M: Error, timeout while trying to read"));
}
unsigned int valueBqm3 = 0;
int i;
signed int valueCounter = 0;
unsigned int valueStatuscode = 0;
byte crc = 0;
for (i = 1; i < 7; i++) crc+=radonResponse[i];
crc = 255 - crc;
crc++;
if (radonResponse[0] == 0x02 ) {
//calculate RADON READING IN BQ/M3
unsigned int radonResponseHigh = (unsigned int) radonResponse[5];
unsigned int radonResponseLow = (unsigned int) radonResponse[6];
valueBqm3 = ((100*radonResponseHigh) + radonResponseLow)*37; //converting from PCi to Bq by multiplier *37
// USED FOR COUNTER VALUE (UPTIME MINUTES)
unsigned int radonResponseCount = (unsigned int) radonResponse[4];
valueCounter = radonResponseCount;
// USED FOR STATUS CODE VALUE
unsigned int radonResponseS = (unsigned int) radonResponse[3];
valueStatuscode= radonResponseS;
String log = F("Radon RD200M: ");
if (valueStatuscode == 0) {
log += F("Bootup detected! ");
success = false;
} else if (valueStatuscode > 0) {
log += F("Values read! ");
log += radonResponse[0];
log += radonResponse[1];
log += radonResponse[2];
log += F(" ");
log += radonResponse[3];
log += F(" ");
log += radonResponse[4];
log += F(" ");
log += radonResponse[5];
log += radonResponse[6];
log += F(" ");
log += radonResponse[7];
log += F(" ");
log += F("Bq/m3 calculated as ");
log += (float)valueBqm3/100;
addLog(LOG_LEVEL_INFO, log);
// Readings are used for variables
UserVar[event->BaseVarIndex] = valueStatuscode;
UserVar[event->BaseVarIndex + 1] = (float)valueBqm3/100;
UserVar[event->BaseVarIndex + 2] = valueCounter;
}
success = true;
break;
return success;
}
else {
String log = F("Radon RD200M: Unknown response: ");
log += String(radonResponse[0], HEX);
log += F(" ");
log += String(radonResponse[1], HEX);
log += F(" ");
log += String(radonResponse[2], HEX);
log += F(" ");
log += String(radonResponse[3], HEX);
log += F(" ");
log += String(radonResponse[4], HEX);
log += F(" ");
log += String(radonResponse[5], HEX);
log += F(" ");
log += String(radonResponse[6], HEX);
log += F(" ");
log += String(radonResponse[7], HEX);
addLog(LOG_LEVEL_INFO, log);
success = false;
break;
}
}
break;
}
}
return success;
}
#endif