ESP SERIAL FLASHER

pepopi
Posts: 32
Joined: Mon Apr 11, 2022 9:45 am

ESP SERIAL FLASHER

Postby pepopi » Thu Sep 29, 2022 10:31 am

Hello,

I am trying to do a esp32 that programs another esp32. On the master I have 3 different partition tables and firmware saved in the fatfs vfs in different folder and I have 3 push buttons. What should I modify on the https://github.com/espressif/esp-serial-flasher so when I press a button the chosen bootloader, firmware and partition table is transferred to the slave?

I am not asking to give the entire process but where I can look for that kind of information. There is a cmake that embeds the files from a the example/binaries directory, but I want to embed it from the esp32 virtual files system.

Thank you

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

Re: ESP SERIAL FLASHER

Postby ESP_igrr » Thu Sep 29, 2022 7:56 pm

Hi pepopi,

Please start here: https://github.com/espressif/esp-serial ... mon.c#L121

You need to modify this function to open the file, (fopen) read chunks of data from the file (fread), then pass the chunks to esp_flash_loader_write function.

Currently this function is called for bootloader, partition table, binary. You can add some code to check the button state (GPIO) and call this function with the right arguments.

pepopi
Posts: 32
Joined: Mon Apr 11, 2022 9:45 am

Re: ESP SERIAL FLASHER

Postby pepopi » Thu Oct 06, 2022 7:52 am

Thanks,

The part of pressing a push button and transferring the selected firmware, bootloader and partition table should it be included in esp32 example main or in the example commons? Calculating the size of the files also happens after pressing the push button because it folder0, folder1 and folder2 have different size of firmware and partition table. I am starting to understand what I need to change, but my doubts now are which modifications are in the commons file and which in the esp32 main.

Also, what do I have to change in the cmake? There is a cmake that takes the files from the helloworld folder, but I must take them from the vfs fatfs.


Thank you

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

Re: ESP SERIAL FLASHER

Postby ESP_igrr » Thu Oct 06, 2022 12:46 pm

pepopi wrote: The part of pressing a push button and transferring the selected firmware, bootloader and partition table should it be included in esp32 example main or in the example commons?
This is totally up to you. The example is split between the "esp32" part and "common" part just because there is some shared code for the different platforms. If you are only working with the esp32, you can combine everything inside one directory.
pepopi wrote: Also, what do I have to change in the cmake? There is a cmake that takes the files from the helloworld folder, but I must take them from the vfs fatfs.
I can't walk you through every single step (you'll have to study this yourself, sorry), but briefly you'll need the following:

username
Posts: 534
Joined: Thu May 03, 2018 1:18 pm

Re: ESP SERIAL FLASHER

Postby username » Wed Sep 04, 2024 3:13 pm

Along this concept. I saved my 3 .bin files files files to a SD card on the Master.
bootloader.bin
partitions.bin
firmware.bin

Would the correct method be for each file ?

esp_loader_flash_start
esp_loader_flash_write
esp_loader_flash_finish

Who is online

Users browsing this forum: Gaston1980 and 108 guests