idf.py app now builds both squeezelite and recovery in a single pass

This commit is contained in:
Sebastien
2020-03-09 23:47:15 -04:00
parent d93e691534
commit 879272dfe4
35 changed files with 176 additions and 217 deletions

View File

@@ -1,7 +1,7 @@
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES app_update esp_https_ota
PRIV_REQUIRES console platform_config spi_flash vfs console freertos platform_console
PRIV_REQUIRES console tools platform_config spi_flash vfs console freertos platform_console
)

View File

@@ -24,12 +24,14 @@
#include "tcpip_adapter.h"
#include "squeezelite-ota.h"
#include "platform_config.h"
#include "platform_esp32.h"
#include <time.h>
#include <sys/time.h>
#include <stdarg.h>
#include "esp_secure_boot.h"
#include "esp_flash_encrypt.h"
#include "esp_spi_flash.h"
#include "platform_esp32.h"
#include "sdkconfig.h"
#include "esp_ota_ops.h"
@@ -593,22 +595,19 @@ esp_err_t process_recovery_ota(const char * bin_url){
esp_err_t start_ota(const char * bin_url)
{
// uint8_t * config_alloc_get_default(NVS_TYPE_BLOB, "certs", server_cert_pem_start , server_cert_pem_end-server_cert_pem_start);
#if RECOVERY_APPLICATION
return process_recovery_ota(bin_url);
#else
ESP_LOGW(TAG, "Called to update the firmware from url: %s",bin_url);
if(config_set_value(NVS_TYPE_STR, "fwurl", bin_url) != ESP_OK){
ESP_LOGE(TAG,"Failed to save the OTA url into nvs cache");
return ESP_FAIL;
}
if(is_recovery_running){
return process_recovery_ota(bin_url);
}
ESP_LOGW(TAG, "Called to update the firmware from url: %s",bin_url);
if(config_set_value(NVS_TYPE_STR, "fwurl", bin_url) != ESP_OK){
ESP_LOGE(TAG,"Failed to save the OTA url into nvs cache");
return ESP_FAIL;
}
if(!wait_for_commit()){
ESP_LOGW(TAG,"Unable to commit configuration. ");
}
if(!wait_for_commit()){
ESP_LOGW(TAG,"Unable to commit configuration. ");
}
ESP_LOGW(TAG, "Rebooting to recovery to complete the installation");
ESP_LOGW(TAG, "Rebooting to recovery to complete the installation");
return guided_factory();
return ESP_OK;
#endif
}

View File

@@ -9,16 +9,7 @@
#include "esp_attr.h"
#include "esp_image_format.h"
#include "esp_ota_ops.h"
#if RECOVERY_APPLICATION
#define CODE_RAM_LOCATION
#define RECOVERY_IRAM_FUNCTION IRAM_ATTR
#else
#define RECOVERY_IRAM_FUNCTION
#define CODE_RAM_LOCATION
#endif
//
// ERASE BLOCK needs to be a multiple of sector size. If a different multiple is passed
// the OTA process will adjust. Here, we need to strike the balance between speed and