Use flash size byte to determine the location of the init data for byte 107. #1827
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.
Fixes #1826.
dev
branch rather than formaster
.The current method to determine the location of the init data sector for byte 107 assumes that it's at offset -4 from the end of the flash. This logic breaks in case the current workaround for >4MB modules is present where init data is not located at the end of flash.
Fix is to determine init data location with
flash_rom_get_sec_num()
which relies on the size header byte. Size byte is the single source pointing to the init data location in all cases since the SDK also uses this information to locate init data.This method is expected to remain valid also for the upcoming support of >4MB flash by the SDK (tagging #1810 for regression testing).
Tested on a 16MB Mini Pro and a stock 4MB NodeMCU devkit.