Provide sample to update firmware into ESP32

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Provide sample to update firmware into ESP32

Postby Ritesh » Mon Dec 05, 2016 7:01 pm

Hi,

I have started to work on ESP-IDF RTOS SDK and found that it has been released with 1.0 version as well.

I have also found that there are some changes related to OTA APIs as well.

So, please provide me sample configuration and code to implement firmware update code into existing ESP32-idf RTOS SDK.
Regards,
Ritesh Prajapati

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Provide sample to update firmware into ESP32

Postby kolban » Mon Dec 05, 2016 7:40 pm

Is this a similar question to the one you just asked?

http://esp32.com/viewtopic.php?f=13&t=623

If so, the response might be of value. The docs are behind the functions and the request is to read what docs what we have, even if they are just the header files and then come back with focused questions. As time passes, better docs will become available just through osmosis.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Provide sample to update firmware into ESP32

Postby Ritesh » Mon Dec 05, 2016 7:47 pm

Hi,

Thanks for Reply. But, it seems that you are also on same page as me to look for firmware update API documentation and how to use that.

Have you found any sample code or have you developed sample code for firmware update?

Please let me know if anyone has developed that type of sample code for firmware update.
Regards,
Ritesh Prajapati

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Provide sample to update firmware into ESP32

Postby kolban » Mon Dec 05, 2016 7:58 pm

By reading the header file, it seems to me:

1. We call esp_ota_begin() to start the beginning of an OTA image write
2. We receive data that is part of the image
3. We call esp_ota_write() to write the data we just read
4. Go back to 2 while there is more of the image to receive over the network
5. We call esp_ota_end() to flag the end of the OTA image write
6. We call esp_ota_set_boot_partition() to specify which partition will be booted on next reboot

For the sake of a working discussion (and the above may not be accurate), lets assume this to be correct and see what questions come from contemplating and testing the above.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Provide sample to update firmware into ESP32

Postby Ritesh » Tue Dec 06, 2016 1:43 am

Hi,

Thanks for quick reply.

Let me check code and understand it. I will let you know if need any help w.r.t. OTA update into ESP32.
Regards,
Ritesh Prajapati

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Provide sample to update firmware into ESP32

Postby ESP_igrr » Tue Dec 06, 2016 2:22 am

@kolban: indeed, this is how these functions are supposed to work.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Provide sample to update firmware into ESP32

Postby kolban » Tue Dec 06, 2016 5:26 am

@ESP_igrr

With those mechanics understood, now let us think of the nature of "file" to transfer to write into the OTA partition. Imagine I am using the ESP-IDF make system. This produces a binary which I flash to 0x10000 (if memory serves me). Now in the OTA world, if I produce Version1 of my app, when I produce Version2, do I need to "compile" it to a different address space or (as I may guess) the act of mapping the flash partition "puts it" in the correct address space for the CPU?

Q: Do I have to prepare my application any different?

Next comes the question of "what" do I send? If I run a compile, I get a "app.elf" file which then gets "munged" through a tool (which I don't understand) to produce an "app.bin". I am "guessing" that I send the "app.bin" ... but is the data that is written to the OTA partition the "whole" file or part of the file or something else?

Q: Do I send the "app.bin" over the network?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_Sprite
Posts: 9723
Joined: Thu Nov 26, 2015 4:08 am

Re: Provide sample to update firmware into ESP32

Postby ESP_Sprite » Tue Dec 06, 2016 5:33 am

The binaries that you feed to the OTA subsystem are the exact same binaries that you normally feed into esptool.py to flash using the serial port. For 'real' OTA, this is a bit barebones (eg there's no checking to see if the firmware supports the hardware it's flashed on, no encryption support etc) so we're thinking of adding a layer on top of it that can have embedded metadata and encryption and stuff, making it a bit more robust.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Provide sample to update firmware into ESP32

Postby WiFive » Tue Dec 06, 2016 8:51 am

ESP_Sprite wrote: so we're thinking of adding a layer on top of it that can have embedded metadata and encryption and stuff, making it a bit more robust.
Sounds good. Definitely need encryption and/or signature verification.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Provide sample to update firmware into ESP32

Postby WiFive » Tue Dec 06, 2016 9:00 am

kolban wrote:the act of mapping the flash partition "puts it" in the correct address space for the CPU?

Q: Do I have to prepare my application any different?

Q: Do I send the "app.bin" over the network?
Yes

No, other than supporting ota functions and using a suitable partition table

Data transfer is up to user. You could send it over IR to the rmt peripheral for fun.

Who is online

Users browsing this forum: Bing [Bot] and 83 guests