From 55d317ff8a197e851ab143a819c66a916167c86e Mon Sep 17 00:00:00 2001 From: "hrushikesh.bhosale" Date: Wed, 4 Feb 2026 12:31:34 +0530 Subject: [PATCH 1/2] feat(esp_https_ota): Skipped read_header and write for custom partition - For custom partition less than IMAGE_HEADER_SIZE (1024 bytes), give error - 'complete header not received' - Skipped the read_header function for custom partition, and directly jumped to IN_PROGRESS state --- components/esp_https_ota/src/esp_https_ota.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/esp_https_ota/src/esp_https_ota.c b/components/esp_https_ota/src/esp_https_ota.c index bdfbdeaee4..4207ad1dbf 100644 --- a/components/esp_https_ota/src/esp_https_ota.c +++ b/components/esp_https_ota/src/esp_https_ota.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -683,6 +683,11 @@ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle) } esp_ota_set_final_partition(handle->update_handle, handle->partition.final, handle->partition.finalize_with_copy); handle->state = ESP_HTTPS_OTA_IN_PROGRESS; + + if (handle->partition.final->type != ESP_PARTITION_TYPE_APP + && handle->partition.final->type != ESP_PARTITION_TYPE_BOOTLOADER) { + return ESP_ERR_HTTPS_OTA_IN_PROGRESS; + } /* In case `esp_https_ota_get_img_desc` was invoked first, then the image data read there should be written to OTA partition */ From be7fad53ce1e91a269dcddb21eda440c4e5a0dba Mon Sep 17 00:00:00 2001 From: "hrushikesh.bhosale" Date: Mon, 9 Feb 2026 12:27:55 +0530 Subject: [PATCH 2/2] feat(partition_ota): Modified pytest for storage data - Modified test for storage data, reduced the size to 500 bytes, less than IMAGE_HEADER_SIZE (1024), to check the workflow, if the custom partition other than APP and BOOTLOADER less IMAGE_HEADER_SIZE performed OTA --- components/esp_https_ota/src/esp_https_ota.c | 5 +++++ .../system/ota/partitions_ota/test/storage.bin | Bin 3128 -> 500 bytes 2 files changed, 5 insertions(+) diff --git a/components/esp_https_ota/src/esp_https_ota.c b/components/esp_https_ota/src/esp_https_ota.c index 4207ad1dbf..a215b8c2ba 100644 --- a/components/esp_https_ota/src/esp_https_ota.c +++ b/components/esp_https_ota/src/esp_https_ota.c @@ -684,6 +684,11 @@ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle) esp_ota_set_final_partition(handle->update_handle, handle->partition.final, handle->partition.finalize_with_copy); handle->state = ESP_HTTPS_OTA_IN_PROGRESS; + /** + * If the final partition is not an app or bootloader, return ESP_ERR_HTTPS_OTA_IN_PROGRESS + * As there is no need to read header and verify chip id and chip revision for custom partition. + * Directly jump to the OTA in progress state. + */ if (handle->partition.final->type != ESP_PARTITION_TYPE_APP && handle->partition.final->type != ESP_PARTITION_TYPE_BOOTLOADER) { return ESP_ERR_HTTPS_OTA_IN_PROGRESS; diff --git a/examples/system/ota/partitions_ota/test/storage.bin b/examples/system/ota/partitions_ota/test/storage.bin index 547abd18d995738263f36bce371dd1d0d8129aa4..6531bbb9bd6f799993e714753105412bb5806f56 100644 GIT binary patch literal 500 ccmXpvvNSU>Ff%u^G&VCfF*alv1;aiB09ru$v)LJL>dZj!pe8nICb7UbImxl#;!ce@2_I+(|^6# z_1^v7oH=vs@yds9tyMeL&OEip9B0l~H{QrOZ+_d$p2gd*=6zN6iZPz0=e@Uc%{nW_ ziJJM1k>%0eqr7l$-aGAHImTRfpWZZwr|X^g^1fAdZ{!}U#(gg%#tP*qQTcb(3>~f9 z`PKAxcy-5K<=pMZ>H1gBbymKJ8(z5@{f>Rs8Z+0k?rm7ix5D``uEIuS#;w!n#5ZO= z)!bbbcW<4J9kU;0<$m*xmkX-%+_%47cdR#5dF}b$8LDt#7kumHxoY2YdA!GmoH%i3 zSW+tRBkn*|taQG@mOt}?yVe(Lth~A6*toj{%EZt-=iJ7~$$)LHbAQKcJDR;1Z|K|$ zs!09hIkA-zI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