In my production, I have to support DFU for main chip over I2C communication by ESP32.
But I don't want to do it in ESP32 main app. I want main app just downloading firmware from server and save to flash. After that, ESP32 reboot, boot loader will read firmware from flash and connect to main chip to do DFU.
But i found in document that boot loader can not use the drivers and functions from other components and boot loader size is also limited.
So anyone here have experience in customize boot loader can give me some advice? Thanks so much.
Support DFU for main chip
Re: Support DFU for main chip
Instead of modifying the bootloader to use the drivers, you may create a separate small application which will handle the DFU, and place it into one of the app partitions. Then in the main app, use esp_ota_set_boot_partition function to boot the DFU application, and call "esp_restart". Bootloader will boot the DFU application. In the DFU application, do the work you need and switch back to the main app using esp_ota_set_boot_partition.
-
- Posts: 10
- Joined: Tue Nov 13, 2018 8:17 am
Re: Support DFU for main chip
Thanks for your response ESP_igrr,ESP_igrr wrote: ↑Tue Dec 25, 2018 9:27 amInstead of modifying the bootloader to use the drivers, you may create a separate small application which will handle the DFU, and place it into one of the app partitions. Then in the main app, use esp_ota_set_boot_partition function to boot the DFU application, and call "esp_restart". Bootloader will boot the DFU application. In the DFU application, do the work you need and switch back to the main app using esp_ota_set_boot_partition.
With your response i have more question that if i use
Code: Select all
esp_ota_set_boot_partition
And if my DFU partition subtype is ota_x, my DFU app may be erased for ota process?
Re: Support DFU for main chip
You probably need to use another subtype, such as 'test'. I think the partition table generator will also accept other integer values which are not used by defined subtypes.
-
- Posts: 10
- Joined: Tue Nov 13, 2018 8:17 am
Re: Support DFU for main chip
I tried with subtype 'test' and 0xFF and failed.
This is my partition table
https://drive.google.com/file/d/1Tx98pW ... sp=sharing
I flash the same .bin file to ota_1 and dfu_app
When i'm in ota_0 i try to use esp_ota_set_boot_partition with dfu_app and failed, but with ota_1 is ok.
-
- Posts: 10
- Joined: Tue Nov 13, 2018 8:17 am
Re: Support DFU for main chip
So think that i will set the subtype of dfu_app to ota_2.
And the i will custom ota process.
I don't use
I will use:
to get the ota partition i want to update.
It's mean when i'm in ota_0, i update to ota_1, when i'm in ota_1 i update to ota_0,
and when i want to do dfu, i will use to boot to dfu_app (ota_2)
And the i will custom ota process.
I don't use
Code: Select all
esp_ota_get_next_update_partition
Code: Select all
esp_partition_find
esp_partition_find_first
It's mean when i'm in ota_0, i update to ota_1, when i'm in ota_1 i update to ota_0,
and when i want to do dfu, i will use
Code: Select all
esp_ota_set_boot_partition
Who is online
Users browsing this forum: Baidu [Spider] and 100 guests