31
31
#error Target CONFIG_IDF_TARGET is not supported
32
32
#endif
33
33
34
+ #define TAG "arduino-psram"
35
+
34
36
static volatile bool spiramDetected = false;
35
37
static volatile bool spiramFailed = false;
36
38
@@ -52,7 +54,7 @@ bool psramInit() {
52
54
uint32_t pkg_ver = chip_ver & 0x7 ;
53
55
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 ) {
54
56
spiramFailed = true;
55
- log_w ( "PSRAM not supported!" );
57
+ ESP_EARLY_LOGW ( TAG , "PSRAM not supported!" );
56
58
return false;
57
59
}
58
60
#elif CONFIG_IDF_TARGET_ESP32S2
@@ -62,7 +64,7 @@ bool psramInit() {
62
64
#endif
63
65
if (esp_psram_init () != ESP_OK ) {
64
66
spiramFailed = true;
65
- log_w ( "PSRAM init failed!" );
67
+ ESP_EARLY_LOGW ( TAG , "PSRAM init failed!" );
66
68
#if CONFIG_IDF_TARGET_ESP32
67
69
if (pkg_ver != EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 ) {
68
70
pinMatrixOutDetach (16 , false, false);
@@ -71,23 +73,22 @@ bool psramInit() {
71
73
#endif
72
74
return false;
73
75
}
74
-
75
76
//testSPIRAM() allows user to bypass SPI RAM test routine
76
77
if (!testSPIRAM ()) {
77
78
spiramFailed = true;
78
- log_e ( "PSRAM test failed!" );
79
+ ESP_EARLY_LOGE ( TAG , "PSRAM test failed!" );
79
80
return false;
80
81
}
81
82
if (esp_psram_extram_add_to_heap_allocator () != ESP_OK ) {
82
83
spiramFailed = true;
83
- log_e ( "PSRAM could not be added to the heap!" );
84
+ ESP_EARLY_LOGE ( TAG , "PSRAM could not be added to the heap!" );
84
85
return false;
85
86
}
86
87
#if CONFIG_SPIRAM_USE_MALLOC && !CONFIG_ARDUINO_ISR_IRAM
87
88
heap_caps_malloc_extmem_enable (CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL );
88
89
#endif
90
+ ESP_EARLY_LOGI (TAG , "PSRAM enabled" );
89
91
#endif /* CONFIG_SPIRAM_BOOT_INIT */
90
- log_i ("PSRAM enabled" );
91
92
spiramDetected = true;
92
93
return true;
93
94
}
0 commit comments