-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Resolve flash address issues with SDK v3.0.0 #8755
Conversation
Fix EEPROM vs RF_CAL flash address conflict. The EEPROM address and RF_CAL address were the same. Add support for Flash size: "Mapping defined by Hardware and Sketch" Change at_partition_table static from dynamic to static.
Also missing / may be wrong
Embedding anything in .ld might be detrimental with simultaneous support of SDK2 and SDK3 As a hypothetical solution, what about restricting SDK3 to the auto-size flash mode only. EEPROM (optional, custom size), FS (optional, custom size) are user modifiable either through an override or something that appends things into the partition table object. Then it is |
Changed set_pll() to mmu_set_pll() and made available for debug builds and other settings where required. Provide more checks and feedback in the debug builds and trim code for production.
I think things are covered with "non-auto-size .ld files"; however, I plan to change RF_CAL and parameters to be the last 4 sectors of the flash. Get rid of the EEPROM relative approach. That will be more consistent with
With And, |
RF_CAL and system_parameter always occupy the last 5 sectors of flash memory.
comment cleanup
cores/esp8266/core_esp8266_main.cpp
Outdated
{ SYSTEM_PARTITION_SYSTEM_PARAMETER, system_parameter, 0x3000 }, // type 6 | ||
}; | ||
_at_partition_table = at_partition_table; | ||
_at_partition_table_sz = sizeof(at_partition_table) / sizeof(at_partition_table[0]); |
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.
_at_partition_table_sz = sizeof(at_partition_table) / sizeof(at_partition_table[0]); | |
_at_partition_table_sz = std::size(at_partition_table); |
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.
I assume this will happen at C++ compile time and we can count on not needing C++ runtime init.
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.
It is, number of elements is part of the type info.
template <typename T, size_t Size> constexpr size_t size(const T (&)[Size]) { return Size; }
cores/esp8266/core_esp8266_main.cpp
Outdated
// .bin image. | ||
#endif | ||
|
||
#if FLASH_MAP_SUPPORT & defined(DEBUG_ESP_PORT) |
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.
#if FLASH_MAP_SUPPORT & defined(DEBUG_ESP_PORT) | |
#if FLASH_MAP_SUPPORT && defined(DEBUG_ESP_PORT) |
(would also suggest moving all #...
to the beginning of line? things are pretty dense here)
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.
I have gone back and forth on this. I kept getting lost with all the #if
s in column one. The density of the #if
s is the reason I started indenting the innermost #if
s to reduce the visual disruption to a block of "C" code. When nested the outer #if
are at the beginning of the line. I don't know if doing this is a style violation.
Hello, sorry for commenting on an old thread, but I thought your comment will help me out. |
Yes, EEPROM writes may write over RF_CAL data. And SDK RF_CAL writes may write over EEPROM data. I suspect/expect the SDK implements wear leveling on their writes. This means the location of the writing might not be the same each time. This could contribute to the reproducibility problem. |
* Reslove flash address issues with SDK v3.0.0 Fix EEPROM vs RF_CAL flash address conflict. The EEPROM address and RF_CAL address were the same. Add support for Flash size: "Mapping defined by Hardware and Sketch" Change at_partition_table static from dynamic to static. * Cleanup and improve comments * Improve flash size and partition error reporting/indication Changed set_pll() to mmu_set_pll() and made available for debug builds and other settings where required. Provide more checks and feedback in the debug builds and trim code for production. * Now supports FLASH_MAP_SUPPORT with SDKs v3.0 RF_CAL and system_parameter always occupy the last 5 sectors of flash memory. * cleanup and refactoring comment cleanup * Add more build issolation when including flash_hal.h * Improve details for autoconfig fail. * requested changes
Fix EEPROM vs
RF_CAL
flash address conflict. TheEEPROM
address andRF_CAL
address were the same.Add support for Flash size: "Mapping defined by Hardware and Sketch" aka autoconfig
Change
at_partition_table
from dynamic to static.When the Arduino IDE flash size selected is correct, the flash sector positions for EEPROM, RF_CAL, and SYSTEM_PARAMETER are kept constant across SDK selections; however, when you change SDK versions, you should erase WiFi settings. The file system should be portable across SDK selections; however, if you have valued data backup before changing. Data may be lost if the flash size setting and device mismatch.
Status: Ready