fit binaries in available space - release

This commit is contained in:
Sebastien
2020-04-10 11:41:23 -04:00
parent 1b5297ab04
commit 495d947fe9
10 changed files with 616 additions and 1455 deletions

View File

@@ -1,8 +1,8 @@
#include <stdio.h>
#include <string.h>
#include "esp_err.h"
#include "esp_app_format.h"
extern esp_err_t process_recovery_ota(const char * bin_url, char * bin_buffer, uint32_t length);
const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
.magic_word = ESP_APP_DESC_MAGIC_WORD,
@@ -30,3 +30,7 @@ int main(int argc, char **argv){
}
void register_squeezelite(){
}
esp_err_t start_ota(const char * bin_url, char * bin_buffer, uint32_t length)
{
return process_recovery_ota(bin_url,bin_buffer,length);
}

View File

@@ -4,6 +4,7 @@
#include "esp_log.h"
#include "esp_console.h"
#include "esp_pthread.h"
#include "../cmd_system.h"
#include "argtable3/argtable3.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
@@ -11,6 +12,7 @@
#include "platform_esp32.h"
#include "platform_config.h"
#include "esp_app_format.h"
extern esp_err_t process_recovery_ota(const char * bin_url, char * bin_buffer, uint32_t length);
static const char * TAG = "squeezelite_cmd";
#define SQUEEZELITE_THREAD_STACK_SIZE (6*1024)
@@ -147,3 +149,24 @@ void register_squeezelite(){
ESP_ERROR_CHECK( esp_console_cmd_register(&launch_squeezelite) );
}
esp_err_t start_ota(const char * bin_url, char * bin_buffer, uint32_t length)
{
if(!bin_url){
ESP_LOGE(TAG,"missing URL parameter. Unable to start OTA");
return ESP_ERR_INVALID_ARG;
}
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. ");
}
ESP_LOGW(TAG, "Rebooting to recovery to complete the installation");
return guided_factory();
return ESP_OK;
}

View File

@@ -721,27 +721,5 @@ esp_err_t process_recovery_ota(const char * bin_url, char * bin_buffer, uint32_t
return ESP_OK;
}
esp_err_t start_ota(const char * bin_url, char * bin_buffer, uint32_t length)
{
if(is_recovery_running){
return process_recovery_ota(bin_url,bin_buffer,length);
}
if(!bin_url){
ESP_LOGE(TAG,"missing URL parameter. Unable to start OTA");
return ESP_ERR_INVALID_ARG;
}
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. ");
}
ESP_LOGW(TAG, "Rebooting to recovery to complete the installation");
return guided_factory();
return ESP_OK;
}