8
8
9
9
#include "sdkconfig.h"
10
10
#include "mcuboot_config.h"
11
+ #include "esp_log.h"
11
12
12
13
extern int ets_printf (const char * fmt , ...);
13
14
@@ -17,30 +18,14 @@ extern int ets_printf(const char *fmt, ...);
17
18
#define MCUBOOT_LOG_LEVEL_INFO 3
18
19
#define MCUBOOT_LOG_LEVEL_DEBUG 4
19
20
20
- #if CONFIG_IDF_TARGET_ESP32
21
- #define TARGET "[esp32]"
22
- #elif CONFIG_IDF_TARGET_ESP32S2
23
- #define TARGET "[esp32s2]"
24
- #elif CONFIG_IDF_TARGET_ESP32S3
25
- #define TARGET "[esp32s3]"
26
- #elif CONFIG_IDF_TARGET_ESP32C2
27
- #define TARGET "[esp32c2]"
28
- #elif CONFIG_IDF_TARGET_ESP32C3
29
- #define TARGET "[esp32c3]"
30
- #elif CONFIG_IDF_TARGET_ESP32C6
31
- #define TARGET "[esp32c6]"
32
- #else
33
- #error "Selected target not supported."
34
- #endif
35
-
36
21
#ifndef MCUBOOT_LOG_LEVEL
37
22
#define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_INFO
38
23
#endif
39
24
40
25
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_ERROR
41
26
#define MCUBOOT_LOG_ERR (_fmt , ...) \
42
27
do { \
43
- ets_printf(TARGET " [ERR] " _fmt "\n\r", ##__VA_ARGS__); \
28
+ ESP_EARLY_LOGE("boot", _fmt "\n\r", ##__VA_ARGS__); \
44
29
} while (0)
45
30
#else
46
31
#define MCUBOOT_LOG_ERR (_fmt , ...)
@@ -49,7 +34,7 @@ extern int ets_printf(const char *fmt, ...);
49
34
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_WARNING
50
35
#define MCUBOOT_LOG_WRN (_fmt , ...) \
51
36
do { \
52
- ets_printf(TARGET " [WRN] " _fmt "\n\r", ##__VA_ARGS__); \
37
+ ESP_EARLY_LOGW("boot", _fmt "\n\r", ##__VA_ARGS__); \
53
38
} while (0)
54
39
#else
55
40
#define MCUBOOT_LOG_WRN (_fmt , ...)
@@ -58,7 +43,7 @@ extern int ets_printf(const char *fmt, ...);
58
43
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_INFO
59
44
#define MCUBOOT_LOG_INF (_fmt , ...) \
60
45
do { \
61
- ets_printf(TARGET " [INF] " _fmt "\n\r", ##__VA_ARGS__); \
46
+ ESP_EARLY_LOGI("boot", _fmt "\n\r", ##__VA_ARGS__); \
62
47
} while (0)
63
48
#else
64
49
#define MCUBOOT_LOG_INF (_fmt , ...)
@@ -67,7 +52,7 @@ extern int ets_printf(const char *fmt, ...);
67
52
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_DEBUG
68
53
#define MCUBOOT_LOG_DBG (_fmt , ...) \
69
54
do { \
70
- ets_printf(TARGET " [DBG] " _fmt "\n\r", ##__VA_ARGS__); \
55
+ ESP_EARLY_LOGD("boot", _fmt "\n\r", ##__VA_ARGS__); \
71
56
} while (0)
72
57
#else
73
58
#define MCUBOOT_LOG_DBG (_fmt , ...)
0 commit comments