logging: startup: esp32: startup log messages format unification

Unification of startup log messages format while using SIMPLEBOOT.

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
This commit is contained in:
Marcio Ribeiro 2024-07-29 15:01:55 -03:00 committed by Anas Nashif
commit f86314ecb6
4 changed files with 29 additions and 22 deletions

View file

@ -38,11 +38,6 @@
#define IS_NONE(addr) (!IS_IROM(addr) && !IS_DROM(addr) \ #define IS_NONE(addr) (!IS_IROM(addr) && !IS_DROM(addr) \
&& !IS_IRAM(addr) && !IS_DRAM(addr) && !IS_PADD(addr)) && !IS_IRAM(addr) && !IS_DRAM(addr) && !IS_PADD(addr))
#define BOOT_LOG_INF(_fmt, ...) \
ets_printf("[" CONFIG_SOC_SERIES "] [INF] " _fmt "\n\r", ##__VA_ARGS__)
#define BOOT_LOG_ERR(_fmt, ...) \
ets_printf("[" CONFIG_SOC_SERIES "] [ERR] " _fmt "\n\r", ##__VA_ARGS__)
#define HDR_ATTR __attribute__((section(".entry_addr"))) __attribute__((used)) #define HDR_ATTR __attribute__((section(".entry_addr"))) __attribute__((used))
void __start(void); void __start(void);
@ -94,7 +89,7 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
if (spi_flash_read(offset, &segment_hdr, if (spi_flash_read(offset, &segment_hdr,
sizeof(esp_image_segment_header_t)) != ESP_OK) { sizeof(esp_image_segment_header_t)) != ESP_OK) {
BOOT_LOG_ERR("Failed to read segment header at %x", offset); ESP_EARLY_LOGE(TAG, "Failed to read segment header at %x", offset);
abort(); abort();
} }
@ -104,7 +99,7 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
break; break;
} }
BOOT_LOG_INF("%s: lma 0x%08x vma 0x%08x len 0x%-6x (%u)", ESP_EARLY_LOGI(TAG, "%s: lma 0x%08x vma 0x%08x len 0x%-6x (%u)",
IS_NONE(segment_hdr.load_addr) ? "???" : IS_NONE(segment_hdr.load_addr) ? "???" :
IS_MMAP(segment_hdr.load_addr) ? IS_MMAP(segment_hdr.load_addr) ?
IS_IROM(segment_hdr.load_addr) ? "IMAP" : "DMAP" : IS_IROM(segment_hdr.load_addr) ? "IMAP" : "DMAP" :
@ -135,11 +130,11 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
} }
} }
if (segments == 0 || segments == 16) { if (segments == 0 || segments == 16) {
BOOT_LOG_ERR("Error parsing segments"); ESP_EARLY_LOGE(TAG, "Error parsing segments");
abort(); abort();
} }
BOOT_LOG_INF("Image with %d segments", segments - 1); ESP_EARLY_LOGI(TAG, "Image with %d segments", segments - 1);
#endif /* !CONFIG_BOOTLOADER_MCUBOOT */ #endif /* !CONFIG_BOOTLOADER_MCUBOOT */
#if CONFIG_SOC_SERIES_ESP32 #if CONFIG_SOC_SERIES_ESP32
@ -172,7 +167,7 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
rc |= cache_flash_mmu_set(1, 0, app_irom_vaddr_aligned, rc |= cache_flash_mmu_set(1, 0, app_irom_vaddr_aligned,
app_irom_start_aligned, 64, irom_page_count); app_irom_start_aligned, 64, irom_page_count);
if (rc != 0) { if (rc != 0) {
BOOT_LOG_ERR("Failed to setup XIP, aborting"); ESP_EARLY_LOGE(TAG, "Failed to setup XIP, aborting");
abort(); abort();
} }
#else #else
@ -216,12 +211,15 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
CACHE_DROM_MMU_MAX_END - cache_mmu_irom_size); CACHE_DROM_MMU_MAX_END - cache_mmu_irom_size);
#endif #endif
/* Show map segments continue using same log format as during MCUboot phase */ /* Show map segments continue using same log format as during MCUboot phase */
BOOT_LOG_INF("DROM segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map", ESP_EARLY_LOGI(TAG, "%s segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map",
"DROM",
app_drom_start_aligned, app_drom_vaddr_aligned, app_drom_start_aligned, app_drom_vaddr_aligned,
app_drom_size, app_drom_size); app_drom_size, app_drom_size);
BOOT_LOG_INF("IROM segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map\r\n", ESP_EARLY_LOGI(TAG, "%s segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map",
"IROM",
app_irom_start_aligned, app_irom_vaddr_aligned, app_irom_start_aligned, app_irom_vaddr_aligned,
app_irom_size, app_irom_size); app_irom_size, app_irom_size);
ets_printf("\n\r");
esp_rom_uart_tx_wait_idle(0); esp_rom_uart_tx_wait_idle(0);
} }
@ -241,7 +239,7 @@ void __start(void)
#ifndef CONFIG_BOOTLOADER_MCUBOOT #ifndef CONFIG_BOOTLOADER_MCUBOOT
/* Init fundamental components */ /* Init fundamental components */
if (bootloader_init()) { if (bootloader_init()) {
BOOT_LOG_ERR("HW init failed, aborting"); ESP_EARLY_LOGE(TAG, "HW init failed, aborting");
abort(); abort();
} }
#endif #endif

View file

@ -41,6 +41,9 @@
#endif /* CONFIG_SOC_ENABLE_APPCPU */ #endif /* CONFIG_SOC_ENABLE_APPCPU */
#include <zephyr/sys/printk.h> #include <zephyr/sys/printk.h>
#include "esp_log.h"
#define TAG "boot.esp32"
#if CONFIG_ESP_SPIRAM #if CONFIG_ESP_SPIRAM
extern int _ext_ram_bss_start; extern int _ext_ram_bss_start;
@ -155,17 +158,17 @@ void IRAM_ATTR __esp_platform_start(void)
esp_err_t err = esp_psram_init(); esp_err_t err = esp_psram_init();
if (err != ESP_OK) { if (err != ESP_OK) {
printk("Failed to Initialize SPIRAM, aborting.\n"); ESP_EARLY_LOGE(TAG, "Failed to Initialize SPIRAM, aborting.");
abort(); abort();
} }
if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) { if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) {
printk("SPIRAM size is less than configured size, aborting.\n"); ESP_EARLY_LOGE(TAG, "SPIRAM size is less than configured size, aborting.");
abort(); abort();
} }
if (esp_psram_is_initialized()) { if (esp_psram_is_initialized()) {
if (!esp_psram_extram_test()) { if (!esp_psram_extram_test()) {
printk("External RAM failed memory test!"); ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
abort(); abort();
} }
} }

View file

@ -36,6 +36,9 @@
#include <esp_err.h> #include <esp_err.h>
#include <esp_clk_internal.h> #include <esp_clk_internal.h>
#include <zephyr/sys/printk.h> #include <zephyr/sys/printk.h>
#include "esp_log.h"
#define TAG "boot.esp32s2"
extern void rtc_clk_cpu_freq_set_xtal(void); extern void rtc_clk_cpu_freq_set_xtal(void);
extern void esp_reset_reason_init(void); extern void esp_reset_reason_init(void);
@ -110,17 +113,17 @@ void __attribute__((section(".iram1"))) __esp_platform_start(void)
esp_err_t err = esp_psram_init(); esp_err_t err = esp_psram_init();
if (err != ESP_OK) { if (err != ESP_OK) {
printk("Failed to Initialize SPIRAM, aborting.\n"); ESP_EARLY_LOGE(TAG, "Failed to Initialize SPIRAM, aborting.");
abort(); abort();
} }
if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) { if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) {
printk("SPIRAM size is less than configured size, aborting.\n"); ESP_EARLY_LOGE(TAG, "SPIRAM size is less than configured size, aborting.");
abort(); abort();
} }
if (esp_psram_is_initialized()) { if (esp_psram_is_initialized()) {
if (!esp_psram_extram_test()) { if (!esp_psram_extram_test()) {
printk("External RAM failed memory test!"); ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
abort(); abort();
} }
} }

View file

@ -46,6 +46,9 @@
#include <esp_app_format.h> #include <esp_app_format.h>
#include <zephyr/sys/printk.h> #include <zephyr/sys/printk.h>
#include "esp_log.h"
#define TAG "boot.esp32s3"
#if CONFIG_ESP_SPIRAM #if CONFIG_ESP_SPIRAM
extern int _ext_ram_bss_start; extern int _ext_ram_bss_start;
@ -161,18 +164,18 @@ void IRAM_ATTR __esp_platform_start(void)
esp_err_t err = esp_psram_init(); esp_err_t err = esp_psram_init();
if (err != ESP_OK) { if (err != ESP_OK) {
printk("Failed to Initialize external RAM, aborting.\n"); ESP_EARLY_LOGE(TAG, "Failed to Initialize external RAM, aborting.");
abort(); abort();
} }
if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) { if (esp_psram_get_size() < CONFIG_ESP_SPIRAM_SIZE) {
printk("External RAM size is less than configured, aborting.\n"); ESP_EARLY_LOGE(TAG, "External RAM size is less than configured, aborting.");
abort(); abort();
} }
if (esp_psram_is_initialized()) { if (esp_psram_is_initialized()) {
if (!esp_psram_extram_test()) { if (!esp_psram_extram_test()) {
printk("External RAM failed memory test!"); ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
abort(); abort();
} }
} }