Skip to content

Commit 960b1c8

Browse files
committed
add instruction for reset to factory app
1 parent da10ddf commit 960b1c8

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,27 @@ Change offset for other apps:
4040
- ota_1 - 0x4E0000
4141
- ota_2 - 0x7A0000
4242
- ota_3 - 0xA60000
43-
- ota_4 - 0xD20000
43+
- ota_4 - 0xD20000
44+
45+
## Updating apps to fallback to bootloader
46+
47+
The bootloader is using OTA mechanism. It's necessary to add following code to the application
48+
in order to reboot to bootloader:
49+
50+
```
51+
// Get the partition structure for the factory partition
52+
const esp_partition_t *factory_partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
53+
if (factory_partition != NULL) {
54+
if (esp_ota_set_boot_partition(factory_partition) == ESP_OK) {
55+
printf("Set boot partition to factory, restarting now.\n");
56+
} else {
57+
printf("Failed to set boot partition to factory.\n");
58+
}
59+
} else {
60+
printf("Factory partition not found.\n");
61+
}
62+
63+
fflush(stdout);
64+
printf("Restarting now.\n");
65+
esp_restart();
66+
```

0 commit comments

Comments
 (0)