feat(bootloader): Support v2 firmware updates to v3 by OTA

This commit is contained in:
Dong Heng
2018-11-09 19:54:17 +08:00
parent ef79175caf
commit 11db1b0daf
18 changed files with 752 additions and 15 deletions

View File

@ -21,6 +21,7 @@
#include "bootloader_common.h"
#include "esp_image_format.h"
#include "esp_log.h"
#include "esp_spi_flash.h"
static const char* TAG = "boot";
@ -112,6 +113,18 @@ static int selected_boot_partition(const bootloader_state_t *bs)
}
#endif
}
#endif
#ifdef CONFIG_ESP8266_BOOT_COPY_APP
if (boot_index == 1) {
ESP_LOGI(TAG, "Copy application from OAT1 to OTA0, please wait ...");
int ret = esp_patition_copy_ota1_to_ota0(bs);
if (ret) {
ESP_LOGE(TAG, "Fail to initialize OTA0");
return INVALID_INDEX;
}
boot_index = 0;
}
#endif
// Customer implementation.
// if (gpio_pin_1 == true && ...){

View File

@ -12,8 +12,8 @@ MEMORY
{
dport0_seg : org = 0x3FF00000, len = 0x10
/* All .data/.bss/heap are in this segment. */
dram_seg : org = 0x3FFE8000, len = 0x18000
/* All .data/.bss/heap are in this segment. Reserve 1KB for old boot or ROM boot */
dram_seg : org = 0x3FFE8000, len = 0x18000 - 0x400
/* Functions which are critical should be put in this segment. */
iram_seg : org = 0x40100000, len = 0x8000

View File

@ -1,6 +1,8 @@
PROVIDE ( ets_memcpy = 0x400018b4 );
PROVIDE ( SPIRead = 0x40004b1c );
PROVIDE ( SPIWrite = 0x40004a4c );
PROVIDE ( SPIEraseSector = 0x40004a00 );
PROVIDE ( gpio_input_get = 0x40004cf0 );