These are chat archives for esp8266/Arduino

30th
Jul 2016
Me No Dev
@me-no-dev
Jul 30 2016 00:13
@hagai-shatz we will see :)
@martinayotte there is inconsistency in the settings for the size which we were not aware of
Loial Otter
@LoialOtter_twitter
Jul 30 2016 04:35
eboot uses 'main' instead of 'user_init' but still has some of the xtensa libraries present (etc_putc, ets_wdt_enable) whereas the arduino core uses user_init. Is there an example of the 'main' so I can see what's missing from getting wifi working during eboot or for making a minimal working system?
Ivan Grokhotkov
@igrr
Jul 30 2016 05:43
ets_ stuff is in ROM, so it available to the application even if it doesn't link against SDK libraries.
to get WiFi working, you need the whole SDK, unfortunately for the 8266 it is monolithic so you will get e.g. TCP/IP stack even if you don't need it.
If you are interested in internal workings of the SDK, please take a look at esp-open-rtos project. It has reverse engineering startup code (e.g. call_user_start or 'main' as you call it).
*engineered
Loial Otter
@LoialOtter_twitter
Jul 30 2016 05:52
Oh, awesome, thanks!!!
also, i noticed that with a .map file you can move a lot of what's not needed over into flash... not that helps in keeping a bootloader small but...
Loial Otter
@LoialOtter_twitter
Jul 30 2016 06:00
Bit of a question on design reasoning; why not include the full API in the bootloader and then use an ld-script mapping so the sketch doesn't need to include it?
answering my own question; one reason may be because of including/not including code in the portion copied into ram for execution (though i could be wrong on this as I'm still a little foggy on how that works)
Loial Otter
@LoialOtter_twitter
Jul 30 2016 06:14
oh; sorry about the questions of 'main' vs 'call_user_start'... didn't notice the ENTRY part in the ld script
Ivan Grokhotkov
@igrr
Jul 30 2016 07:01
I have considered this option. The problem is, with wifi and tcpip parts being in sketch, you can update them over the air. If these parts are in bootloader, you can only update them together with the bootloader over serial. So I chose to have a minimal bootloader which can just copy and load stuff, and then implement update functions in the sketch.
Second point is that people actually want to customize what happens during/at the end of OTA update. Some do nice progress bar animations on OLED displays, some blink LEDs, etc. If the update function was moved to the bootloader then this customization would be hard to achieve. Worst case, you would end up with a bootloader being as large or as complex as the sketch itself.
Clemens Kirchgatterer
@everslick
Jul 30 2016 08:47
@igrr not sure if you have seen #2344... tell me, if i should change anything.
Ivan Grokhotkov
@igrr
Jul 30 2016 09:52
No, sorry, i haven't yet. Will take a look tomorrow or on Monday.
Mario Mikočević
@mozgy
Jul 30 2016 09:58
@me-no-dev I bought 8MB and 16MB chips, now I might have an incentive to solder them ;)
Clemens Kirchgatterer
@everslick
Jul 30 2016 10:41
@igrr great, thx!
Holger Lembke
@holgerlembke
Jul 30 2016 12:00
so todays bigger question is: how to check if flash is working....
Holger Lembke
@holgerlembke
Jul 30 2016 13:04
do I see it right that if nothing else is configured, everything beyond the 512k mark in flash is free and unused?
so save to change there anything?
Martin Ayotte
@martinayotte
Jul 30 2016 15:36
@me-no-dev , @igrr, about my previous issue with mDNS queries, esp8266/Arduino#2248, I've sent the fix esp8266/Arduino#2347
Me No Dev
@me-no-dev
Jul 30 2016 16:07
Cool beans! Does that fix the query now?
About flash size: will pr the changes tomorrow but esptool update is also required ;) i have that ready for pr as well
Martin Ayotte
@martinayotte
Jul 30 2016 16:15
@me-no-dev , yes, this link-list was broken since it initial commit on March, crashing when more then 2 answers were received.
Me No Dev
@me-no-dev
Jul 30 2016 16:21
I never had more than two devices, so i guess i never hit that point
Good work finding it!
Actually i did get 3 devices a few times but one was duplicate
Not that it should matter
Martin Ayotte
@martinayotte
Jul 30 2016 16:26
@me-no-dev , btw, that doesn't means your revamp version would be appreciate, I did the fix on top of it, but not included in the PR.
Holger Lembke
@holgerlembke
Jul 30 2016 16:54
Hmm. I'm to stupid to check flash writablility.... suggestions anyone?
  const unsigned int lowteststart = 0x80000;  // 512k
  const unsigned int teststep = 0x80000;      // 512k

  // Write
  for (unsigned int i = lowteststart; i < realSize; i = i + teststep) {
    Serial.printf("Write %08X\n", i);
    SPIEraseSector(i/FLASH_SECTOR_SIZE);
    SPIWrite(i, &i, sizeof(i));
  }

  // Read
  unsigned int j = 0;
  for (unsigned int i = lowteststart; i < realSize; i = i + teststep) {
    Serial.printf("Read %08X", i);
    SPIRead(i, &j, sizeof(j));
    Serial.printf(" Diff %u\n", j-i);
  }
Clemens Kirchgatterer
@everslick
Jul 30 2016 17:47
@holgerlembke suggestions: try the functions in EspClass i.e. bool EspClass::flashEraseSector(uint32_t sector) and check the return codes from these functions.
Holger Lembke
@holgerlembke
Jul 30 2016 18:19
Looks like flash write/read size is hardcoded.... if I compile with 512k writing the first data fails, if I compile with 4mb there is success. so no chance this way....
Holger Lembke
@holgerlembke
Jul 30 2016 18:25
        // Winbond
        case 0x1840EF: // W25Q128
            return (16_MB);
Martin Ayotte
@martinayotte
Jul 30 2016 18:27
What do you mean ? What are you trying to achieve ?
Holger Lembke
@holgerlembke
Jul 30 2016 18:28
I try to verify that I can access the full 16 mb of my flash memory
Martin Ayotte
@martinayotte
Jul 30 2016 18:31
Ok ! and what are the failure ? Are you using Esp.flashEraseSector() and Esp.flashWrite() ?
Holger Lembke
@holgerlembke
Jul 30 2016 18:35
if i compile with 512k ---> can't access beyond 512k, if I compile with 4mb--> can't access beyond 4mb. so there seems to be some thing inside the compilation, that limits flash access that is not related to the real flash size.
(i use above code, now switched to esp:: same result.)
Martin Ayotte
@martinayotte
Jul 30 2016 18:41
@me-no-dev could maybe answer why. maybe the LD scripts need to be tweaked.
Holger Lembke
@holgerlembke
Jul 30 2016 18:50
yepp. i think so, too
holgerlembke @holgerlembke eats a fried herring now and then.... hmmm. a beer?
Me No Dev
@me-no-dev
Jul 30 2016 20:10
@holgerlembke just keep tight another day and prep env to compile esptool from source
Holger Lembke
@holgerlembke
Jul 30 2016 20:49
I'm as tight as man can be. I only want to understand what I do and why it fails. But as far as I see, I understand it now... it is limited in the build process