Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By easy123
#16815 Hello,
I'm also interested in doing OTA with Arduino.
I've looked at the source code of SMING, where the implementation use the HttpFirmwareUpdate class.
The class downloads 2 files 0x000... and 0X400... and saves it to SPIFFS file system, after that call the UpdateFirmware function of the SDK.
Is the Spiffs implementation compatible with Arduino ?
Arduino has got the EEPROM class, which encapsulate spi_flash, but isn't it too low level to download and store the files?

This is how I understand OTA :
1. Dowload the files to the flash
2. Move the files to the expected location ? Or point the files ?
3. call system_upgrade_start.

What about the arduino bootloader ? does it gets dowloaded and updated as well ? (there's maybe no arduino bootloader at all : ESPtool)
User avatar
By easy123
#17221 @Chen
Yes, 2 Hex files are needed to flash ESP one at 0x00000 and the other at 0x40000, as in ESPFlasher tool.
I'm not sure why, Bootloader and program ?
FW_FILE_1 = 0x00000
FW_FILE_1_ARGS = -bo $@ -bs .text -bs .data -bs .rodata -bc -ec
FW_FILE_2 = 0x40000
FW_FILE_2_ARGS = -es .irom0.text $@ -ec

Knowing that :
#define ICACHE_FLASH_ATTR __attribute__((section(“.irom0.text”)))
Found something here : http://tech.scargill.net/memory-use-esp8266/

@AcmeUK
Frankenstein's readme gives some clues :
Firmware you're flashing is <=256KiB (SPI_FLASH_SIZE /2 )
Firmware is made up of ONE file that will be burned at 0x0000

Now, I want to do OTA with Arduino, the result will be an arduino Library that can handle the downloading and the flashing.
Just as in SMING viewtopic.php?f=6&t=2133

BTW, Why don't ESP Arduino and SMING merge ?
What's the the core difference ? One use Arduino IDE (text editor) and the other Eclipse ?

To sum up I need to know :

1. OTA working mecanism precisely.

2. What should I add to arduino to implement the OTA :
A. Is a file System absolutely needed like SPIFFS ? Can EEPROM class do the job ?
B. Download mecanism (HTTP CLient).
C. Copy file to specific adress.
Decompress ?
D. Call the ESP specific functions to update / reset ESP.