Open flameboss opened 4 years ago
I have a work-around which does not use esp_ota_get_next_update_partition().
static const esp_partition_t *find_partition(char *label)
{
const esp_partition_t *p;
esp_partition_iterator_t it = esp_partition_find(ESP_PARTITION_TYPE_APP,
ESP_PARTITION_SUBTYPE_ANY,
NULL);
while (it != NULL) {
p = esp_partition_get(it);
if (strcmp(p->label, label) == 0) {
esp_partition_iterator_release(it);
return p;
}
it = esp_partition_next(it);
}
return NULL;
}
...
const esp_partition_t *p;
p = esp_ota_get_boot_partition();
printf("Boot partition: label %s, offset x%x, len x%x\n", p->label, p->address, p->size);
char *label = strcmp(p->label, "ota_0") == 0 ? "ota_1" : "ota_0";
p = find_partition(label);
next_update_partition = p;
Whole file attached. user_main.c.txt
The other work around was to configure partitions so that start of ota_1 is exactly 1M after start of ota_0. If that is a requirement it would be nice to enforce it at build time instead of just crashing.
I passed by the same problem. I reconfigured my partition tables to get the same as you probably wold. You can take a look at https://github.com/nsfilho/E12AIO3 -- where you can see my partition table.
Best regards,
Environment
git rev-parse --short HEAD
to get the commit id.): ESP8266_RTOS_SDK commit 9c72c21b563576ed7f9d54a4358422109f747b29 release/v3.3Problem Description
I will attach a simple program that simply switches boot partition to other ota partition when the user enters a u on the console.
This program works OK when I use the default OTA partitions generated by make menuconfig, in which ota_1 starts at 0x110000. However, since I need to save flash space for a user partition, on a 2MB flash, I made my custom partition table have ota_1 start at 0x90000, allowing 512K for each app.
Expected Behavior
When running in ota_1, app should output on console:
Boot partition: label ota_1, offset x90000, len x80000 Running partition: label ota_1, offset x90000, len x80000 Next update partition: label ota_0, offset x10000, len x80000
Actual Behavior
When running in ota_1, app does output on console (including boot loader messages which prove it is booting from ota_1 at 0x90000):
... I (271) boot: Loaded app from partition at offset 0x90000 ... Boot partition: label ota_1, offset x90000, len x80000 Running partition: label ota_0, offset x10000, len x80000 Next update partition: label ota_1, offset x90000, len x80000
Note: the first line is correct, but the 2nd two lines are not correct.
Steps to repropduce
Code to reproduce this issue
Full files attached.
Debug Logs
All console output from failing app on ota_1:
Other items if possible
sdkconfig.txt
user_main.c.txt