enhancement: new "config" module to access configuration in RAM

This is to allow moving some tasks/stack memory to SPIRAM, saving on
precious IRAM. HTTP server should also be more responsive.
This commit is contained in:
Sebastien
2019-11-06 23:31:13 -05:00
parent 86f0d4c7ea
commit cdbb198d8a
38 changed files with 1219 additions and 510 deletions

View File

@@ -8,6 +8,6 @@ COMPONENT_ADD_INCLUDEDIRS := .
COMPONENT_ADD_INCLUDEDIRS += include
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/main/
COMPONENT_EXTRA_INCLUDES += $(PROJECT_PATH)/components/tools
CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCONFIG_OTA_ALLOW_HTTP=1
CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO -DCONFIG_OTA_ALLOW_HTTP=1
#CFLAGS += -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCONFIG_OTA_ALLOW_HTTP=1
COMPONENT_EMBED_TXTFILES := ${PROJECT_PATH}/server_certs/github.pem

View File

@@ -329,7 +329,7 @@ esp_err_t process_recovery_ota(const char * bin_url){
#define OTA_CORE 0
#warning "OTA will run on core 0"
#else
#warning "OTA will run on core 1"
#pragma message "OTA will run on core 1"
#define OTA_CORE 1
#endif
ESP_LOGI(TAG, "Starting ota on core %u for : %s", OTA_CORE,urlPtr);
@@ -343,12 +343,20 @@ esp_err_t process_recovery_ota(const char * bin_url){
esp_err_t start_ota(const char * bin_url, bool bFromAppMain)
{
// uint8_t * get_nvs_value_alloc_default(NVS_TYPE_BLOB, "certs", server_cert_pem_start , server_cert_pem_end-server_cert_pem_start);
// 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);
store_nvs_value(NVS_TYPE_STR, "fwurl", 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;