-2

I have an ESP32 pcb electronics and I need to list all partitions the onboard SPI Flash has.

I've googled it however I could not find it to this date.

VC.One
  • 14,790
  • 4
  • 25
  • 57
Miguel Tomás
  • 1,714
  • 1
  • 13
  • 23

1 Answers1

0

To list all partitions setup in a flash SPI IC one can use the following functions:

    void partition_info(){
        Serial.println("Partition list:");
        partloop(ESP_PARTITION_TYPE_APP);
        partloop(ESP_PARTITION_TYPE_DATA);
    }
    
    void partloop(esp_partition_type_t part_type) {
      esp_partition_iterator_t iterator = NULL;
      const esp_partition_t *next_partition = NULL;
      iterator = esp_partition_find(part_type, ESP_PARTITION_SUBTYPE_ANY, NULL);
      while (iterator) {
         next_partition = esp_partition_get(iterator);
         if (next_partition != NULL) {
            Serial.printf("partition addr: 0x%06x; size: 0x%06x; label: %s\n", next_partition->address, next_partition->size, next_partition->label);  
         iterator = esp_partition_next(iterator);
        }
      }

}
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Miguel Tomás
  • 1,714
  • 1
  • 13
  • 23