Chat freely about anything...

User avatar
By donnib
#38230 Hi,
I have following code :

Code: Select all#include "ESP8266WiFi.h"

extern "C" {
#include <user_interface.h>
}

byte rtcStore[1];
const char trial[] = "[{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"},{\"T\":\"20\",\"H\":\"40\"}]";

void setup() {
  // Start Serial
  Serial.begin(115200);
  delay(10);

  Serial.println("Hello");
  // put your setup code here, to run once:
}

void loop() {
  delay(1000);
  rtcStore[0] = 10;
  Serial.println("Mem write rtcStore:");
  Serial.println(system_rtc_mem_write(65, rtcStore, sizeof(rtcStore)));
  Serial.println("Mem write trial:");
  Serial.println(system_rtc_mem_write(68, trial, sizeof(trial)));

  char t[sizeof(trial)];
  byte r[1];
  Serial.println("Mem read rtcStore:");
  Serial.println(system_rtc_mem_read(65, &r, sizeof(r)));
  Serial.println("Mem read trial:");
  Serial.println(system_rtc_mem_read(68, &t, sizeof(trial)));

  Serial.print('<');
  Serial.print(t);
  Serial.println('>');
  Serial.print('<');
  Serial.print(r[0]);
  Serial.println('>');

}


The above code outputs on Mac wrong:

Code: Select allr...lœ˜rß.Œc.ân€..à..Œ..‚ì.pŒ<Ž‚Ÿ.ìx.’ßǒÜäl.p...ònnä.Ä;ònĒÜä..Ž.bŽ#l`.$`.üpònàÃÜ...à‚ÇÀl.€ŒœÀ..€.b€.nâãnÀ$ŽŒŒŽØ.bÀľ~ònî.ÄÁŒŽ.l`.ü.Ü#‚nÀ.Žr....nrŽ’ß;.ÄÀ..Œ.r...rßےnÀ..à‚ÇÄl`.üü‚nÄbàHello
Mem write rtcStore:
1
Mem write trial:
0
Mem read rtcStore:
0
Mem write trial:
1
<¨;N.š.ü÷æ%¨A.Fkޛì.I$0½ÇûY...èŸ~.­..!.?܁凰.ü›l..ð.:Y±í¦@–.Cý®.£LÁ…­«'"Ìim(ž—Éð-Qƒî..™L҂,%Gµûv ]såþy£@.>
<192>


and on windows correct :

Code: Select allr...lœ˜rß.Œ#.ânÀ.ˆà..Œ..‚ì.pŒ|Ž‚ß.ìx.’ŸÇ’œäl.p...ònnä.„;ònĒœä..Ž.bŽcl`.$`.üpònàÃ܀..à‚ÇÀl.€Œœ€..€.bÀ.nâãnÀ$ŽŒŒŽØ.bÀÄ>~ònî.ÄÁŒŽ.l`.ü.Ü#‚nÀ..r....nrŽ’ß;.ÄÀ.?Œ.r...rßےnÀ..à‚ÇÄl`.üü‚nÄbàHello
Mem write rtcStore:
1
Mem write trial:
1
Mem read rtcStore:
0
Mem read trial:
1
<[{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"},{"T":"20","H":"40"}]>
<0>


The xtensa compiler is the same 4.8.2, why do i see this difference ? I can take the bin from windows and flash with esptool on mac and that works fine. It's driving me nuts. Any ideas what is wrong ?

donnib