mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
bugfix(fix): Fix combine binary overwrite checking
This commit is contained in:
@ -32,6 +32,24 @@
|
||||
#define BUFFSIZE 1500
|
||||
#define TEXT_BUFFSIZE 1024
|
||||
|
||||
#ifdef CONFIG_ESP8266_OTA_FROM_OLD
|
||||
/*
|
||||
* Users should add your real firmware information here.
|
||||
* And the real infoarmation will be generated by "script".
|
||||
*/
|
||||
#ifdef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
|
||||
/*
|
||||
* The configuration is related to file "partitions_two_ota_v2tov3.1MB".
|
||||
*/
|
||||
#define OTA_EXAMPLE_APP_OFFSET 0x6000UL
|
||||
#else
|
||||
/*
|
||||
* The configuration is related to file "partitions_two_ota_v2tov3.2MB".
|
||||
*/
|
||||
#define OTA_EXAMPLE_APP_OFFSET 0xf000UL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum esp_ota_firm_state {
|
||||
ESP_OTA_INIT = 0,
|
||||
ESP_OTA_PREPARE,
|
||||
@ -76,6 +94,10 @@ static EventGroupHandle_t wifi_event_group;
|
||||
to the AP with an IP? */
|
||||
const int CONNECTED_BIT = BIT0;
|
||||
|
||||
#ifdef CONFIG_ESP8266_OTA_FROM_OLD
|
||||
static const uint32_t s_ota_app_offset = OTA_EXAMPLE_APP_OFFSET;
|
||||
#endif
|
||||
|
||||
static esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||
{
|
||||
switch (event->event_id) {
|
||||
@ -185,12 +207,17 @@ bool _esp_ota_firm_parse_http(esp_ota_firm_t *ota_firm, const char *text, size_t
|
||||
memset(length_str, 0, sizeof(length_str));
|
||||
memcpy(length_str, ptr, ptr2 - ptr);
|
||||
ota_firm->content_len = atoi(length_str);
|
||||
#ifdef CONFIG_ESP8266_OTA_FROM_OLD
|
||||
ota_firm->ota_size = ota_firm->content_len - s_ota_app_offset;
|
||||
ota_firm->ota_offset = s_ota_app_offset;
|
||||
#else
|
||||
#if defined(CONFIG_ESPTOOLPY_FLASHSIZE_1MB) && !defined(CONFIG_ESP8266_BOOT_COPY_APP)
|
||||
ota_firm->ota_size = ota_firm->content_len / ota_firm->ota_num;
|
||||
ota_firm->ota_offset = ota_firm->ota_size * ota_firm->update_ota_num;
|
||||
#else
|
||||
ota_firm->ota_size = ota_firm->content_len;
|
||||
ota_firm->ota_offset = 0;
|
||||
#endif
|
||||
#endif
|
||||
ESP_LOGI(TAG, "parse Content-Length:%d, ota_size %d", ota_firm->content_len, ota_firm->ota_size);
|
||||
}
|
||||
|
Reference in New Issue
Block a user