arduino-libraries / Arduino_UnifiedStorage

Read and write files to flash, USB mass storage and SD cards in a unified way.
GNU Lesser General Public License v2.1
12 stars 3 forks source link

`Arduino_UnifiedStorage::debuggingModeEnabled` and `InternalStorage::readPartitions()` report different number of partitions #45

Open aliphys opened 6 months ago

aliphys commented 6 months ago

The Arduino_UnifiedStorage library provides the following two ways to access information about the partitions on the Internal storage, both of which are exhibited in SimpleStorageWriteRead.ino:

However, each approach has its own reality as to what partitions exist. As an example, if we format the Portenta H7 Internal storage to have a single 12MB FAT partition (by uploading the AUS_SPIS_FORMAT_001 sketch):

There should be no difference between the number of partitions reported by both approaches.

aliphys commented 6 months ago

Full Serial Monitor for three relevant test cases on both the Portenta H7 and Portenta C33 are presented below.

Portenta H7
Test Case Description Serial Monitor
[AUS_SPIS_FORMAT_001](https://github.com/aliphys/AUS_Tests/tree/f528dd499037af5331a0e14282743be769dfb3d0/PortentaH7_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_001) Format 12MB FAT Partition on Portenta H7
---
Test Case ID: AUS_SPIS_FORMAT_001
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with FAT file system
[Partitioning][readPartitions][INFO] Partition 2 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 12284
Type: FAT
[AUS_SPIS_FORMAT_002](https://github.com/aliphys/AUS_Tests/blob/f528dd499037af5331a0e14282743be769dfb3d0/PortentaH7_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_002/AUS_SPIS_FORMAT_002.ino) Format 12MB LittleFS Partition on Portenta H7
---
Test Case ID: AUS_SPIS_FORMAT_002
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with LittleFS file system
[Partitioning][readPartitions][INFO] Partition 2 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 12284
Type: LitlleFS
[AUS_SPIS_FORMAT_003](https://github.com/aliphys/AUS_Tests/tree/f528dd499037af5331a0e14282743be769dfb3d0/PortentaH7_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_003) Format 6MB FAT + 6MB LittleFS Partition Portenta H7
---
Test Case ID: AUS_SPIS_FORMAT_003
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][INFO] Partition 2 created
[Partitioning][formatPartition][INFO] Formatting partition 2
[Partitioning][formatPartition][INFO] Partition 2 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with LittleFS file system
[Partitioning][readPartitions][INFO] Partition 2 is formatted with FAT file system
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 6140
Type: LitlleFS

Partition: 2
Size: 6144
Type: FAT
Portenta C33
Test Case Description Serial Monitor
[AUS_SPIS_FORMAT_001](https://github.com/aliphys/AUS_Tests/tree/f528dd499037af5331a0e14282743be769dfb3d0/PortentaC33_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_001) Format 12MB FAT Partition on Portenta C33
---
Test Case ID: AUS_SPIS_FORMAT_001
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with FAT file system
[Partitioning][readPartitions][INFO] Partition 2 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 12284
Type: FAT
[AUS_SPIS_FORMAT_002](https://github.com/aliphys/AUS_Tests/tree/f528dd499037af5331a0e14282743be769dfb3d0/PortentaC33_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_002) Format 12MB LittleFS Partition on Portenta C33
---
Test Case ID: AUS_SPIS_FORMAT_002
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with LittleFS file system
[Partitioning][readPartitions][INFO] Partition 2 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 12284
Type: LitlleFS
[AUS_SPIS_FORMAT_003](https://github.com/aliphys/AUS_Tests/tree/f528dd499037af5331a0e14282743be769dfb3d0/PortentaC33_VisionShield/Internal/AUS_SPIS_001/AUS_SPIS_FORMAT_003) Format 6MB FAT + 6MB LittleFS Partition Portenta C33
---
Test Case ID: AUS_SPIS_FORMAT_003
---
Arduino_UnifiedStorage debug messages ON.
[Partitioning][isPartitioningSchemeValid][INFO] Partitioning Scheme is Valid
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][eraseMBRSector][INFO] MBR Sector Erased
[Partitioning][INFO] Partition 1 created
[Partitioning][formatPartition][INFO] Formatting partition 1
[Partitioning][formatPartition][INFO] Partition 1 formatted successfully
[Partitioning][INFO] Partition 2 created
[Partitioning][formatPartition][INFO] Formatting partition 2
[Partitioning][formatPartition][INFO] Partition 2 formatted successfully
[Partitioning][readPartitions][INFO] Partition 1 is formatted with LittleFS file system
[Partitioning][readPartitions][INFO] Partition 2 is formatted with FAT file system
[Partitioning][readPartitions][INFO] Partition 3 is empty, skipping
[Partitioning][readPartitions][INFO] Partition 4 is empty, skipping
Partition: 1
Size: 6140
Type: LitlleFS

Partition: 2
Size: 6144
Type: FAT

Note:

aliphys commented 6 months ago

PR https://github.com/arduino-libraries/Arduino_UnifiedStorage/pull/39 rewrites functionality of the InternalStorage class which may fix issues presented here.