63 lines
2.0 KiB
C++
63 lines
2.0 KiB
C++
|
#include <Arduino.h>
|
||
|
#include "esp_heap_caps.h"
|
||
|
#include "esp32-hal-psram.h"
|
||
|
#include "esp_partition.h"
|
||
|
|
||
|
void printPartitionInfo() {
|
||
|
const esp_partition_t *partition;
|
||
|
esp_partition_iterator_t it = esp_partition_find(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||
|
|
||
|
Serial.println("App-Partitionen:");
|
||
|
while (it != NULL) {
|
||
|
partition = esp_partition_get(it);
|
||
|
Serial.printf(" Label: %s, Adresse: 0x%08x, Größe: %d KB\n", partition->label, partition->address, partition->size / 1024);
|
||
|
it = esp_partition_next(it);
|
||
|
}
|
||
|
esp_partition_iterator_release(it);
|
||
|
|
||
|
it = esp_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, NULL);
|
||
|
Serial.println("Data-Partitionen:");
|
||
|
while (it != NULL) {
|
||
|
partition = esp_partition_get(it);
|
||
|
Serial.printf(" Label: %s, Adresse: 0x%08x, Größe: %d KB\n", partition->label, partition->address, partition->size / 1024);
|
||
|
it = esp_partition_next(it);
|
||
|
}
|
||
|
esp_partition_iterator_release(it);
|
||
|
}
|
||
|
|
||
|
void setup() {
|
||
|
// Initialisierung der seriellen Kommunikation
|
||
|
Serial.begin(115200);
|
||
|
delay(1000); // Kurze Verzögerung für die Stabilität der seriellen Ausgabe
|
||
|
|
||
|
// PSRAM-Initialisierung überprüfen
|
||
|
if (psramFound()) {
|
||
|
Serial.println("PSRAM erfolgreich initialisiert!");
|
||
|
|
||
|
// PSRAM-Details ausgeben
|
||
|
size_t psramSize = ESP.getPsramSize();
|
||
|
Serial.print("PSRAM Größe: ");
|
||
|
Serial.print(psramSize / 1024);
|
||
|
Serial.println(" KB");
|
||
|
|
||
|
size_t freePsram = heap_caps_get_free_size(MALLOC_CAP_SPIRAM);
|
||
|
Serial.print("Freier PSRAM: ");
|
||
|
Serial.print(freePsram / 1024);
|
||
|
Serial.println(" KB");
|
||
|
|
||
|
size_t largestBlock = heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM);
|
||
|
Serial.print("Größter freier PSRAM Block: ");
|
||
|
Serial.print(largestBlock / 1024);
|
||
|
Serial.println(" KB");
|
||
|
} else {
|
||
|
Serial.println("PSRAM nicht gefunden oder Initialisierung fehlgeschlagen.");
|
||
|
}
|
||
|
|
||
|
// Partitionen-Informationen ausgeben
|
||
|
printPartitionInfo();
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
// Dein Code hier
|
||
|
}
|