Merge branch 'refactor/print_app_description_on_startup' into 'master'

esp32s2: print app description on startup

See merge request espressif/esp-idf!7899
This commit is contained in:
Angus Gratton 2020-03-09 14:05:04 +08:00
commit df9d3c6e43
2 changed files with 22 additions and 15 deletions

View file

@ -40,9 +40,7 @@ void bootloader_fill_random(void *buffer, size_t length)
{ {
uint8_t *buffer_bytes = (uint8_t *)buffer; uint8_t *buffer_bytes = (uint8_t *)buffer;
uint32_t random; uint32_t random;
#if CONFIG_IDF_TARGET_ESP32
uint32_t start, now; uint32_t start, now;
#endif
assert(buffer != NULL); assert(buffer != NULL);
@ -55,17 +53,12 @@ void bootloader_fill_random(void *buffer, size_t length)
as-is, we repeatedly read the RNG register and XOR all as-is, we repeatedly read the RNG register and XOR all
values. values.
*/ */
#if CONFIG_IDF_TARGET_ESP32
random = REG_READ(WDEV_RND_REG); random = REG_READ(WDEV_RND_REG);
RSR(CCOUNT, start); RSR(CCOUNT, start);
do { do {
random ^= REG_READ(WDEV_RND_REG); random ^= REG_READ(WDEV_RND_REG);
RSR(CCOUNT, now); RSR(CCOUNT, now);
} while (now - start < 80 * 32 * 2); /* extra factor of 2 is precautionary */ } while (now - start < 80 * 32 * 2); /* extra factor of 2 is precautionary */
#elif CONFIG_IDF_TARGET_ESP32S2
// ToDo: Get random from register
random = 12345678;
#endif
} }
buffer_bytes[i] = random >> ((i % 4) * 8); buffer_bytes[i] = random >> ((i % 4) * 8);
} }

View file

@ -68,6 +68,7 @@
#include "esp_pm.h" #include "esp_pm.h"
#include "esp_private/pm_impl.h" #include "esp_private/pm_impl.h"
#include "trax.h" #include "trax.h"
#include "esp_ota_ops.h"
#include "esp_efuse.h" #include "esp_efuse.h"
#include "bootloader_mem.h" #include "bootloader_mem.h"
@ -165,6 +166,26 @@ void IRAM_ATTR call_start_cpu0(void)
#endif #endif
ESP_EARLY_LOGI(TAG, "Pro cpu up."); ESP_EARLY_LOGI(TAG, "Pro cpu up.");
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
ESP_EARLY_LOGI(TAG, "Application information:");
#ifndef CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR
ESP_EARLY_LOGI(TAG, "Project name: %s", app_desc->project_name);
#endif
#ifndef CONFIG_APP_EXCLUDE_PROJECT_VER_VAR
ESP_EARLY_LOGI(TAG, "App version: %s", app_desc->version);
#endif
#ifdef CONFIG_BOOTLOADER_APP_SECURE_VERSION
ESP_EARLY_LOGI(TAG, "Secure version: %d", app_desc->secure_version);
#endif
#ifdef CONFIG_APP_COMPILE_TIME_DATE
ESP_EARLY_LOGI(TAG, "Compile time: %s %s", app_desc->date, app_desc->time);
#endif
char buf[17];
esp_ota_get_app_elf_sha256(buf, sizeof(buf));
ESP_EARLY_LOGI(TAG, "ELF file SHA256: %s...", buf);
ESP_EARLY_LOGI(TAG, "ESP-IDF: %s", app_desc->idf_ver);
}
ESP_EARLY_LOGI(TAG, "Single core mode"); ESP_EARLY_LOGI(TAG, "Single core mode");
#if CONFIG_SPIRAM_MEMTEST #if CONFIG_SPIRAM_MEMTEST
@ -198,14 +219,7 @@ void IRAM_ATTR call_start_cpu0(void)
esp_enable_cache_wrap(icache_wrap_enable, dcache_wrap_enable); esp_enable_cache_wrap(icache_wrap_enable, dcache_wrap_enable);
#endif #endif
/* Initialize heap allocator. WARNING: This *needs* to happen *after* the app cpu has booted. /* Initialize heap allocator */
If the heap allocator is initialized first, it will put free memory linked list items into
memory also used by the ROM. Starting the app cpu will let its ROM initialize that memory,
corrupting those linked lists. Initializing the allocator *after* the app cpu has booted
works around this problem.
With SPI RAM enabled, there's a second reason: half of the SPI RAM will be managed by the
app CPU, and when that is not up yet, the memory will be inaccessible and heap_caps_init may
fail initializing it properly. */
heap_caps_init(); heap_caps_init();
ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); ESP_EARLY_LOGI(TAG, "Pro cpu start user code");