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

[STM32H7] Provisioning fs reformat #957

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

andreagilardoni
Copy link
Contributor

Changing flash partitioning scheme in order to make room for a KV store

@andreagilardoni andreagilardoni changed the title Provisioning fs reformat [STM32H7] Provisioning fs reformat Sep 23, 2024
Copy link
Contributor

@pennam pennam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to erase the whole flash before repartitioning; you only need to erase the MBR.

root.init();
root.erase(0x0, root.get_erase_size());

Furthermore if you keep the KVstorage in partition 3 for both schemes you should be able switch between them without erase the MBR at all

mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024);
if(default_scheme) {
  mbed::MBRBlockDevice::partition(&root, 4, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024);
  mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 13 * 1024 * 1024, 14 * 1024 * 1024);
  mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 13 * 1024 * 1024);
  // use space from 15.5MB to 16 MB for another fw, memory mapped
} else {
  mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024);
  mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 6 * 1024 * 1024, 7 * 1024 * 1024);
  mbed::MBRBlockDevice::partition(&root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024);
  // use space from 15.5MB to 16 MB for another fw, memory mapped
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants