OTA: can't start loaded firmware. Advices needed.
Posted: Mon Mar 28, 2022 11:34 pm
Hi, I'm trying to go through OTA process and stuck. Probably I miss something and cant figure out what exactly
IDF v4.4 (release) is using if this matters.
My partition table is default from sdkconfig: one factory (1M), two OTA (each 1M too).
So, here is my steps.
My "core" project (where all OTA stuff is included) flashed on factory partition.
Its running successfully.
Its loading new OTA binary and save too (I've checked with flash dump, new bin file saved on OTA_0 partition correctly)
Rebooting and...
then it continues execution of "core" project.
0x106 code stands for:
Here is piece of code in "core" project:
I thought something is wrong with special partition "ota_data", but its seems fine. Al least its not empty
So...
1. Can firmware be completely different at factory, OTA_0, OTA_1 partitions?
I mean, what if I just compile "hello_world" example and load its binary over the air once? Can OTA_0 get ESP_OTA_IMG_VALID state in this case?
This is what I'm actually trying to do in all described above.
2. Can I just load any suitable by size firmware to OTA_0 and OTA_1 without project preparation?
For example, do I need add some ota-specific code at the top of new firmware (checking partitions, build with some special sdkconfig etc...)?
3. Seems its possible to make OTA updates only in case firmware binary is less then ~1.3M.
In other words, need free size on flash equal of my firmware x3.
Does it make sense to keep relatively small app with OTA-only stuff as bare updater? And when I want update over the air:
Hope for help with this questions, thanks in advance!
IDF v4.4 (release) is using if this matters.
My partition table is default from sdkconfig: one factory (1M), two OTA (each 1M too).
So, here is my steps.
My "core" project (where all OTA stuff is included) flashed on factory partition.
Its running successfully.
Its loading new OTA binary and save too (I've checked with flash dump, new bin file saved on OTA_0 partition correctly)
Rebooting and...
Code: Select all
I (494) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (505) main: Running partition type 0 subtype 0 (offset 0x00010000)
E (515) main: esp_ota_get_state_partition failed! err code [0x106]
0x106 code stands for:
Code: Select all
#define ESP_ERR_NOT_SUPPORTED 0x106 /*!< Operation or feature not supported */
Code: Select all
const esp_partition_t *partition = esp_ota_get_running_partition();
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)",
partition->type, partition->subtype, partition->address);
esp_ota_img_states_t ota_state;
esp_err_t ret = esp_ota_get_state_partition(partition, &ota_state);
if (ret == ESP_OK)
{
...
// do all stuff here from example
...
}
else
{
ESP_LOGE(TAG, "esp_ota_get_state_partition failed! err code [0x%X]", ret);
}
1. Can firmware be completely different at factory, OTA_0, OTA_1 partitions?
I mean, what if I just compile "hello_world" example and load its binary over the air once? Can OTA_0 get ESP_OTA_IMG_VALID state in this case?
This is what I'm actually trying to do in all described above.
2. Can I just load any suitable by size firmware to OTA_0 and OTA_1 without project preparation?
For example, do I need add some ota-specific code at the top of new firmware (checking partitions, build with some special sdkconfig etc...)?
3. Seems its possible to make OTA updates only in case firmware binary is less then ~1.3M.
In other words, need free size on flash equal of my firmware x3.
Does it make sense to keep relatively small app with OTA-only stuff as bare updater? And when I want update over the air:
- erase ota_data partition
- ESP should load as "factory"
- make update over the air
- check and run "big" firmware that is located in OTA partition.
Hope for help with this questions, thanks in advance!