|
38 | 38 | #warning "No SPIRAM detected, will use heap" |
39 | 39 | #endif |
40 | 40 |
|
41 | | -// for PSRAM/SPIRAM detection support |
| 41 | +// for SPIRAM detection support |
42 | 42 | #ifdef CONFIG_IDF_CMAKE // IDF 4+ |
43 | | - #if __has_include("esp_psram.h") // IDF 5+, all devices |
44 | | - #include "esp_psram.h" |
45 | | - static int esp_spiram_init(void) { esp_psram_init(); return esp_psram_is_initialized()?ESP_OK:-1; } |
46 | | - #else |
47 | | - #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 |
48 | | - #include "esp32/spiram.h" |
49 | | - #elif CONFIG_IDF_TARGET_ESP32S2 |
50 | | - #include "esp32s2/spiram.h" |
51 | | - #include "esp32s2/rom/cache.h" |
52 | | - #elif CONFIG_IDF_TARGET_ESP32S3 |
53 | | - #include "esp32s3/spiram.h" |
54 | | - #include "esp32s3/rom/cache.h" |
55 | | - #else |
56 | | - #error Target CONFIG_IDF_TARGET is not supported |
57 | | - #endif |
58 | | - |
| 43 | + #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 |
| 44 | + #include "esp32/spiram.h" |
| 45 | + #elif CONFIG_IDF_TARGET_ESP32S2 |
| 46 | + #include "esp32s2/spiram.h" |
| 47 | + #include "esp32s2/rom/cache.h" |
| 48 | + #elif CONFIG_IDF_TARGET_ESP32S3 |
| 49 | + #include "esp32s3/spiram.h" |
| 50 | + #include "esp32s3/rom/cache.h" |
| 51 | + #else // CONFIG_IDF_TARGET_ESP32P4 |
| 52 | + // psram mapping is seamless on P4, no need to load external spiram component |
| 53 | + #undef BOARD_HAS_PSRAM |
59 | 54 | #endif |
60 | 55 | #else // ESP32 Before IDF 4.0 |
61 | 56 | #include "esp_spiram.h" |
|
74 | 69 | #include "pfs.h" |
75 | 70 | #include "esp_vfs.h" |
76 | 71 |
|
| 72 | +// ESP_LOG* functions always whining about signedness :( |
| 73 | +#pragma GCC diagnostic ignored "-Wformat" |
77 | 74 |
|
78 | 75 | // for debug |
79 | 76 | static const char TAG[] = "esp_psramfs"; |
@@ -658,6 +655,7 @@ pfs_file_t* pfs_fopen( const char * path, int flags, int fmode ) |
658 | 655 | } |
659 | 656 | pfs_files[file_id]->index = 0; |
660 | 657 | pfs_files[file_id]->size = 0; |
| 658 | + pfs_files[file_id]->memsize = 0; |
661 | 659 | break; |
662 | 660 | case 'r': |
663 | 661 | ESP_LOGV(TAG, "Read (mode=%s)", mode); |
|
0 commit comments