FOTA Upgrade

AgentSmithers
Posts: 195
Joined: Sat Apr 01, 2017 1:21 am
Contact:

FOTA Upgrade

Postby AgentSmithers » Thu Apr 27, 2017 11:27 pm

Hi everyone,
I'm a bit new to the idea but I wanted to see if I get some clarification on burring firmware to the ESP8266. A ton of examples are there for Arundio and the AT firmware from Thinker-AI are found on the web like here.
https://www.allaboutcircuits.com/projec ... easier-now

Now what I originally started off with is the Blinky Example burning it to offset 0x00000 and 0x10000 duing the Wemos D1 Pro chip.
I am however unable to find a decent example of burning Firmware over the Air using this method. It talks about using a User1 / User2 .Bin file and judging by the Grid it appears the Blinky-0x00000.bin is the bootfile and Blinky-0x10000.bin is the user code, However when leveraging the OTA api's I am unsure on how this process would work. By looking at a couple examples online it appear they are looking for a IROM Magic header with 0xEA at the start.. I can only assume thats a Magic header for the AT Firmware. The offset's for this data being burned is at 0x01000, Which I assume does not mirror my setup as my blinky-0x00000 would overwrite that if I'm correct.
Anyone have any way to enlighten me in the right direction?
Thanks,
-Agent

Update: It appears my Elf2image generates a blinky-0x10000 instead of a 0x40000 due to the eagle.app.v6.ld I am using.
I'll need to find out how to lay these images out correctly.
Flash address 0x00000: bootloader
blinky-0x00000.bin --> Bootloader written by Cesanta. It is generated by esptool.py using a dump inside itself. This is the one we will use.
eagle.flash.bin --> Bootloader supplied by Espressif. I don't know if it can launch user programs generated by ESP8266_NONOS_SDK / esp-open-sdk.
eboot --> Bootloader used by Arduino environment. It first generates eboot.elf and merges it with the user program to generate a single binary file to be written into address 0x00000.

Flash address 0x10000: user program (this location is specificied by newer linkscript "eagle.app.v6.ld")
eagle.irom0text.bin --> Default user program supplied by Espressif. I'm not sure what goes on inside it. Perhaps it is the AT-command firmware?
blinky-0x10000.bin --> Example user program that we have generated using ESP8266_NONOS_SDK / esp-open-sdk.

Flash address X (0x3FC000 in case of ESP-12F with 32 Mbit / 4 MiB flash memory): factory configuration data
esp_init_data_default.bin --> Default configuration data. Perhaps it includes something that helps RF calibration as well? - See more at: http://www.esp8266.com/viewtopic.php?f= ... wxPvx.dpuf


Update: It appears the following code is located in esptool.py, It seems maybe I need to do something to my make file to pass the correct flag for FOTA?

Code: Select all

def elf2image(args):
    e = ELFFile(args.input)
    if args.chip == 'auto':  # Default to ESP8266 for backwards compatibility
        print("Creating image for ESP8266...")
        args.chip == 'esp8266'

    if args.chip == 'esp32':
        image = ESP32FirmwareImage()
    elif args.version == '1':  # ESP8266
        image = ESPFirmwareImage()
    else:
        image = OTAFirmwareImage()
    image.entrypoint = e.entrypoint
    image.segments = e.sections  # ELFSection is a subclass of ImageSegment
    image.flash_mode = {'qio':0, 'qout':1, 'dio':2, 'dout': 3}[args.flash_mode]
    image.flash_size_freq = image.ROM_LOADER.FLASH_SIZES[args.flash_size]
    image.flash_size_freq += {'40m':0, '26m':1, '20m':2, '80m': 0xf}[args.flash_freq]

    if args.output is None:
        args.output = image.default_output_name(args.input)
    image.save(args.output)

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: FOTA Upgrade

Postby Her Mary » Sat Apr 29, 2017 11:35 am

Here is an ESP8266 FOTA Guide http://www.espressif.com/en/support/download/documents, maybe can help.

AgentSmithers
Posts: 195
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: FOTA Upgrade

Postby AgentSmithers » Mon May 01, 2017 2:46 pm

Her Majesty wrote:Here is an ESP8266 FOTA Guide http://www.espressif.com/en/support/download/documents, maybe can help.


Thank you for the response Majesty, I have been through this document before and they don't talk much about NON-Cloud NonOS-SDK. I am unsure if the layout is different then normal Blinky.C's default makefile. Judging by the looks of it, it seems like it is on Page 15/21 but Im not sure exactly how to generate User1.bin & User2.bin.

Are both these files 100% the same? Do I need to make version2 of this file then copy an exact copy of it to both parts of the SPI Flash when needed?

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: FOTA Upgrade

Postby Her Mary » Wed May 03, 2017 2:48 pm

Here is more information about Flash Layout in Chapter 4 http://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf, not sure if it can help..

AgentSmithers
Posts: 195
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: FOTA Upgrade

Postby AgentSmithers » Fri May 05, 2017 9:16 am

Thanks,
After reviewing page 20, What would the Memos D1 Pro fall under. Isn't that way larger then a 4096? It seem's its 16MB instead of 4?
Do you know where a valid makefile / commands are located that I can use to pump out the UserBin's or is my only option to use whats in the IOT demo??
Thanks for your input.

Technical specs
Microcontroller ESP-8266EX
Operating Voltage 3.3V
Digital I/O Pins 11
Analog Input Pins 1(Max input: 3.2V)
Clock Speed 80MHz/160MHz
Flash 16M bytes
Length 34.2mm
Width 25.6mm
Weight 2.5g

Who is online

Users browsing this forum: No registered users and 64 guests