-
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
flash-size agnostic builds #6690
Conversation
@TD-er for a start I ran the same binary DOUT lib-eeprom read/write sketch on esp8285(1M) and esp8266(4M) with good results.
esp8285:
esp8266:
|
So, you've already started with it :) |
I have not yet tested it, but looked through the code. The reason I'm asking is that I cannot support a single binary for 4M flash with either 1 MB SPIFFS (default for all nodes out there running my software) or 2 MB SPIFFS if it is only looking at the flash size. N.B. the reason I have not tested it yet, is mainly because of the amount of work needed to get a PR ready within PlatformIO. I also just made a feature request for it: platformio/platformio-core#3239 |
That is on purpose.
FSes and EEPROM should be closed before doing that, but yes I don't see any reason against that. |
As @earlephilhower said elsewhere, we cannot autodetect SPIFFS because there is no signature. I don't know about LittleFS. |
For my own purpose, I could also use the EPROM part to store something with a very specific signature to help detect the used offset. |
this file contains all the addresses computed by boards.txt.py.
|
boards.txt.py: comment some useless entry generation
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 mentioned in the chats, still wip but it might be much nicer to edit it in the tree instead of amending the PR ad-infinitum
Only two sore points
- we still have flash layout as symbols & defines, I wonder if we should move closer to something 'iterable' so we see all of things at once as [begin, end] ranges. at least of the sake of the reader, not necessary to be closer to partition schemes of the updated sdks
- boards.txt.py python could do better :>
cores/esp8266/Updater.cpp
Outdated
@@ -24,8 +24,7 @@ extern "C" { | |||
#include "user_interface.h" | |||
} | |||
|
|||
extern "C" uint32_t _FS_start; | |||
extern "C" uint32_t _FS_end; | |||
#include <flash_hal.h> |
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.
#include <flash_hal.h> | |
#include "flash_hal.h" |
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 one has been reverted because
- mock version of
flash_hal.h
needs to be loaded first, to redefineFS_start
andFS_end
This is only needed in sources files
- located in
cores/esp8266/
- which make use of
FS_start
orFS_end
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
(edit 2021/12/01)
This PR adds a new option in the flash size configuration options list called
Mapping defined by Hardware and Sketch
.This option is useful because:
Users need not to care about flash configuration
(If the option is selected. It is not currently the default)
A binary can indifferently be flashed over 512k or 16MB flash chips, or esp8285 if
dout
is selectedFS and EEPROM location will automatically match legacy addresses as if flash size was correctly selected
Three configurations are available, they reflects standard / current menus flash mapping
FLASH_MAP_SETUP_CONFIG()
is not used)Sketch can use FLASH_MAP_SETUP_CONFIG(config) to select a configuration, for example:
FLASH_MAP_SETUP_CONFIG(FLASH_MAP_MAX_FS)
Sketch can also define another configuration by providing a custom mapping structure.
No more FS overwrite / reformatting when bad configuration is selected and flashed
Binary releases for projects can see their number of builds reduced
When not enabled, this PR makes no change. and flash size and configuration needs to be correctly selected as before (with the same symbols).
Documentation update:
When the option is enabled, the magic word at physical address 0x0 in flash which contains "software" flash size is ignored; its reading is disabled and is replaced by reading the "chip vendor id" (
ESP.getFlashChipRealSize()
).Fixes: #6679
Fixes: #2321
Closes: #6806 via #6813