Commit ff2c17a 1 parent 5a06dd9 commit ff2c17a Copy full SHA for ff2c17a
File tree 3 files changed +21
-6
lines changed
3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -253,14 +253,20 @@ extern bool btInUse();
253
253
#if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
254
254
#ifndef CONFIG_SPIRAM_BOOT_INIT
255
255
ESP_SYSTEM_INIT_FN (init_psram_new , BIT (0 ), 99 ) {
256
- return psramInit () ? ESP_OK : ESP_FAIL ;
256
+ psramInit ();
257
+ return ESP_OK ;
257
258
}
258
259
#endif
259
260
#endif
260
261
261
262
void initArduino () {
262
263
//init proper ref tick value for PLL (uncomment if REF_TICK is different than 1MHz)
263
264
//ESP_REG(APB_CTRL_PLL_TICK_CONF_REG) = APB_CLK_FREQ / REF_CLK_FREQ - 1;
265
+ #if CONFIG_SPIRAM_SUPPORT || CONFIG_SPIRAM
266
+ #ifndef CONFIG_SPIRAM_BOOT_INIT
267
+ psramAddToHeap ();
268
+ #endif
269
+ #endif
264
270
#ifdef CONFIG_APP_ROLLBACK_ENABLE
265
271
if (!verifyRollbackLater ()) {
266
272
const esp_partition_t * running = esp_ota_get_running_partition ();
Original file line number Diff line number Diff line change @@ -79,17 +79,25 @@ bool psramInit() {
79
79
ESP_EARLY_LOGE (TAG , "PSRAM test failed!" );
80
80
return false;
81
81
}
82
+ ESP_EARLY_LOGI (TAG , "PSRAM enabled" );
83
+ #endif /* CONFIG_SPIRAM_BOOT_INIT */
84
+ spiramDetected = true;
85
+ return true;
86
+ }
87
+
88
+ bool psramAddToHeap () {
89
+ if (!spiramDetected ) {
90
+ log_e ("PSRAM not initialized!" );
91
+ return false;
92
+ }
82
93
if (esp_psram_extram_add_to_heap_allocator () != ESP_OK ) {
83
- spiramFailed = true;
84
- ESP_EARLY_LOGE (TAG , "PSRAM could not be added to the heap!" );
94
+ log_e ("PSRAM could not be added to the heap!" );
85
95
return false;
86
96
}
87
97
#if CONFIG_SPIRAM_USE_MALLOC && !CONFIG_ARDUINO_ISR_IRAM
88
98
heap_caps_malloc_extmem_enable (CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL );
89
99
#endif
90
- ESP_EARLY_LOGI (TAG , "PSRAM enabled" );
91
- #endif /* CONFIG_SPIRAM_BOOT_INIT */
92
- spiramDetected = true;
100
+ log_i ("PSRAM added to the heap." );
93
101
return true;
94
102
}
95
103
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ extern "C" {
31
31
#endif
32
32
33
33
bool psramInit ();
34
+ bool psramAddToHeap ();
34
35
bool psramFound ();
35
36
36
37
void * ps_malloc (size_t size );
You can’t perform that action at this time.
0 commit comments