Boron red sos when using EEProm read/write

Boron flashes red sos when loading program that reads and writes EEProm

Could you share the code? And what version of Device OS are you using?

#include <string.h>
#include <math.h>
unsigned long previousMillis = 0;
unsigned long currentMillis = 0;
int moisture;
int moist;
bool flag = false;
char CID[20];
String a;
String b;
String c;
//String n;
String r;
String con;
String d1;
String e1;
String t1;
String w1;
//String myString;
int d;  
int e; 
int t;
int w;  

void setup()
{
   
    pinMode(A0, INPUT);
    pinMode(D7, OUTPUT);
    pinMode(D2, OUTPUT);
    pinMode(D1, OUTPUT);
    Particle.variable("moisture",moisture);
    Particle.variable("moist",moist);
    Particle.variable("con",con);
    Particle.function("led", Led); 
    Particle.function("led1", Led1); 
    Particle.function("led2", Led2); 
    Particle.function("wtr",Wtr);
    Serial.begin(9600);
    //String c=EEPROM.get(0,CID);
    //String con=EEPROM.get(21,CID);
    Led(a);
}   


void loop()
{
  
    String c=EEPROM.get(0,CID);
    String con=EEPROM.get(21,CID);
    Serial.println(con);
       
    
int Total=0;
    
    for (int i=1; i<=100; i++)
        {  
          Total = Total+ analogRead(A0);  
          delay(10);
        }
    Total=Total/100; 
    moisture = Total; 
    int i1 = con.indexOf(',');
    int i2 = con.indexOf(',', i1+1);
    int i3 = con.indexOf(',', i2+1);
    d1 = con .substring (0,i1);
    //Serial.println(d1);
    e1 = con .substring (i1+1,i2);
   // Serial.println(e1);
    t1 = con .substring (i2+1,i3);
    //Serial.println(t1);
    w1 = con .substring (i3+1,i3+3);
    //Serial.println(w1);
    //Serial.println(t1);
    d = d1.toInt();
    e = e1.toInt();
    t = t1.toInt();
    w = w1.toInt();
    
    //Serial.println(d);
    //Serial.println(e);
    //Serial.println(t);
    //Serial.println(w);
    
    
   
    String f= c.substring(0,4);
    //Serial.println(f);
    String g= c.substring(4,8);
    
    //Serial.println(g);
    float h = f.toInt();
    float i= g.toInt();
    float m = 100/(i-h);
    float n = -(m *h);
    moist = n -( -m*moisture);
    //Serial.println(moist);
    //Serial.println(moisture);
    //Serial.println(c);
    
    if (moist >=d ){flag = false;}{}
    if (moist <d and moist>=e and flag == true){Wtr(a); }
    if (moist <e){Wtr(a); flag = true; }
    previousMillis = millis();
    //Serial.println(d);
    currentMillis = millis()+1;
    
    
    //Serial.println(e);
    //Serial.println(w);
    //Serial.println(t);
    loop1();
    
}

      

int Led(String command)
{    a = command;

int Total=0;
 Total=0;
    for (int i=1; i<=100; i++)
        {  
          Total = Total+ analogRead(A0);  
          delay(10);
        }
    Total=Total/100; 
    Serial.println(con);//Serial.println(Total);
    moisture = Total;
    String c=EEPROM.get(0,CID);
    Serial.println(c);
    String f= c.substring(0,4);
    String g= c.substring(4,8);
    Serial.println(g);
    float h = f.toInt();
    float i= g.toInt();
    float m = 100/(i-h);
    float n = -(m *h);
    moist = n -( -m*moisture);
    //Serial.println(moist);
    //Serial.println(moisture);
    if (moist >= d ){flag = false;}{}
    if (moist <d and moist>=e and flag == true){Wtr(a); }
    if (moist < e){Wtr(a); flag = true; }
    Particle.publish("moisture",String(moisture));
    Particle.publish("moist",String(moist));
    return 1;
}



int Led1 (String command)
{  
   //Particle.syncTime();
   b=command;
   Serial.println(CID);
   b.toCharArray(CID,20);
   EEPROM.put(0,CID);
   return 1;
} 

int Led2 (String command)
{
   r=command;
   Serial.println(con);
   r.toCharArray(CID,20);
   EEPROM.put(21,CID);   
   return 1; 
}

int Wtr(String command)   
    
{     
     digitalWrite(D7,HIGH); 
     digitalWrite(D2,HIGH);
     digitalWrite(D1,HIGH);Serial.println(con);
     delay(w*1000);
     digitalWrite(D7,LOW); 
     digitalWrite(D2,LOW); 
     digitalWrite(D1,LOW);
     //previousMillis=millis();
     //loop1();
     //delay(3000);   //delayloop1();
     return 1; 
}
    

void loop1()
{
   //Serial.println ("Ron");
   //currentMillis = millis()+1;
   if( currentMillis- previousMillis>= t*60000){loop();}
   currentMillis = millis();
   //
   //Serial.println (previousMillis);
   //delay(1000);//Serial.println ("Kraus");
   //Serial.println (millis());
  delay(100);
   loop1();
}

One possible issue is that when you run this the first time, the EEPROM will be all 0xff bytes (not 0x00 bytes), so when you assign String c to the contents you have an unterminated C string which could cause a SOS+1 fault.

Something like this would be safer:

String c;
EEPROM.get(0, CID);
CID[sizeof(CID) - 1] = 0;

if (CID[0] != 0xff) {
     c = CID;
}

See also the EEPROM sample code.