Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aliphys opened this issue Apr 29, 2024 · 2 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@aliphys
Copy link
Member

aliphys commented Apr 29, 2024

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:

  • Arduino_UnifiedStorage::debuggingModeEnabled = true;
    • This prints information about the storage media operations to the Serial Monitor.
  • std::vector<Partition> partitions = InternalStorage::readPartitions();
    • The function InternalStorage::readPartitions() is called to retrieve a list of partition configurations from the internal storage of the device. This is stored as a dynamically resizable array of objects, in this case partitions

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):

  • The debug messages tell us that there are four partitions, one of which is FAT
[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
  • The partitions vector (as defined above) shows that only one partition exists
Partition: 1
Size: 12284
Type: FAT

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

@aliphys aliphys added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Apr 29, 2024
@aliphys
Copy link
Member Author

aliphys commented Apr 29, 2024

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

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

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

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

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

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

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:

  • The difference in reported partitions, exists similarly with both the Portenta H7 (mbed) and Portenta C33 (renesas). So unlikely that this is limited to a single platform.
  • This is not limited to LittleFS or FAT. Issue exists when the internal storage is formatted as LittleFS and/or FAT.
  • The function InternalStorage::readPartitions() reports LittleFS as LitlleFS. This typo is resolved in Ensure prettyPrintFileSystemType() returns correct spelling for LittleFS #44

@aliphys
Copy link
Member Author

aliphys commented Apr 29, 2024

PR #39 rewrites functionality of the InternalStorage class which may fix issues presented here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants