-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Fixed the SPIFFS size calculation. #1653
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c1518d
Fixed the SPIFFS size calculation.
slav-at-attachix af41784
In the debug print the already completed percentage.
slav-at-attachix 1751c96
Fixes to addresses and sizes.
slav-at-attachix 1bf5e39
Adjust the start adress to be the start address of the sector. Adjust…
slav-at-attachix 9f00a7d
Coding style fixes.
slav-at-attachix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,26 @@ | |
spiffs_config spiffs_get_storage_config() | ||
{ | ||
spiffs_config cfg = {0}; | ||
u32_t maxAllowedSector, requestedSector; | ||
|
||
#ifdef RBOOT_SPIFFS_0 | ||
cfg.phys_addr = RBOOT_SPIFFS_0; | ||
#elif RBOOT_SPIFFS_1 | ||
cfg.phys_addr = RBOOT_SPIFFS_1; | ||
#else | ||
#error "Define either RBOOT_SPIFFS_0 or RBOOT_SPIFFS_1" | ||
#endif | ||
cfg.phys_size = SPIFF_SIZE; | ||
|
||
cfg.phys_addr &= 0xFFFFF000; // get the start address of the sector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the following code would be better:
|
||
|
||
maxAllowedSector = flashmem_get_sector_of_address(INTERNAL_FLASH_SIZE - 1); | ||
requestedSector = flashmem_get_sector_of_address((cfg.phys_addr + SPIFF_SIZE) - 1); | ||
if(requestedSector > maxAllowedSector) { | ||
debug_w("The requested SPIFFS size is too big."); | ||
requestedSector = maxAllowedSector; | ||
} | ||
cfg.phys_size = ((requestedSector + 1) * INTERNAL_FLASH_SECTOR_SIZE) - ( ( u32_t )cfg.phys_addr); // get the max size until the sector end. | ||
|
||
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet | ||
cfg.log_block_size = INTERNAL_FLASH_SECTOR_SIZE * 2; // Important to make large | ||
cfg.log_page_size = LOG_PAGE_SIZE; // as we said | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct (see PR 1313)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see (here) I also did the same change but in conjunction with the change in line 67 (which is the fix of the bug).