esp32 factory+双OTA分区
# Name, Type, SubType, Offset, Size, Flags # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap,,,, nvs,data, nvs, 0x4000, otadata,data,ota, 0x4000, phy_init, data, phy, 0x1000, factory, app, factory, 1M, ota_0, app,ota_0, 1M, ota_1, app,ota_1, 1M,
[0;32mI (47) boot: Partition Table:[0m [0;32mI (50) boot: ## Label Usage Type ST Offset Length[0m [0;32mI (58) boot: 0 nvs WiFi data 01 02 00009000 00004000[0m [0;32mI (65) boot: 1 otadata OTA data 01 00 0000d000 00002000[0m [0;32mI (73) boot: 2 phy_init RF data 01 01 0000f000 00001000[0m [0;32mI (80) boot: 3 factory factory app 00 00 00010000 00100000[0m [0;32mI (87) boot: 4 ota_0 OTA app 00 10 00110000 00100000[0m [0;32mI (95) boot: 5 ota_1 OTA app 00 11 00210000 00100000[0m [0;32mI (102) boot: End of partition table[0m
无factory分区(partitions.csv)
# Name, Type, SubType, Offset, Size, Flags # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap,,,, nvs,data, nvs,, 0x4000, otadata,data,ota,, 0x2000, phy_init, data, phy,, 0x1000, ota_0, app,ota_0,, 1M, ota_1, app,ota_1,, 1M,
[0;32mI (47) boot: Partition Table:[0m [0;32mI (50) boot: ## Label Usage Type ST Offset Length[0m [0;32mI (58) boot: 0 nvs WiFi data 01 02 00009000 00004000[0m [0;32mI (65) boot: 1 otadata OTA data 01 00 0000d000 00002000[0m [0;32mI (73) boot: 2 phy_init RF data 01 01 0000f000 00001000[0m [0;32mI (80) boot: 3 ota_0 OTA app 00 10 00010000 00100000[0m [0;32mI (87) boot: 4 ota_1 OTA app 00 11 00110000 00100000[0m [0;32mI (95) boot: End of partition table[0m
- idf.py partition-table
设置ota_1为启动区
esp_ota_get_running_partition
esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, "ota_1"); if (partition == NULL) { ESP_LOGE(TAG, "OTA partition not found."); return; } esp_err_t err = esp_ota_set_boot_partition(partition); if (err != ESP_OK) { ESP_LOGE(TAG, "Failed to set boot partition."); return; }