-->
Page 1 of 2

Bin (same code) size different on mac vs windows

PostPosted: Fri Jan 08, 2016 4:24 pm
by donnib
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

Re: Bin (same code) size different on mac vs windows

PostPosted: Fri Jan 08, 2016 5:34 pm
by martinayotte
That could be caused by "esptool" itself, since it is not only used to upload firmware, but also to generate the final binary from the elf.

Re: Bin (same code) size different on mac vs windows

PostPosted: Sat Jan 09, 2016 8:40 am
by donnib
Ok so that could explain the size difference although i am not sure why same code doesnt work on mac but works on windows, any ideas ?

Re: Bin (same code) size different on mac vs windows

PostPosted: Sat Jan 09, 2016 10:51 am
by martinayotte
Unfortunately, I don't have any Mac to investigate.
Maybe someone else can provide clues.