-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update to SDK 1.5.4.1 #1390
Update to SDK 1.5.4.1 #1390
Conversation
@moononournation can we ask you to test this? |
I'm most curious to learn what |
Reverting from 1.5.4.1 back to dev's 1.5.4 gave me some headaches: Although flash download including old init data worked flawlessly, the firmware wasn't able to format spiffs upon initial start-up. |
I also wonder if there are problems in the spiffs formatting code if there is an odd number of ending sectors used for the firmware. I made the assumption that there were a multiple of 8k in use at the end (which was true). I'll take a look at the code to see if the available space gets rounded down correctly. I would have expected this to cause problems with 1.5.4.1 rather than with the downgrade (unless there are some locked sectors [how do you detect / set these?]) |
I wasn't aware of any potential pitfalls here and just assumed that limiting the internal flash size would be enough.
Pure speculation from my side as I didn't know about SPIFFS constraints. Technically possible but unlikely IMO. |
There are a couple of places that I need to update to deal with the change of 4 reserved sectors to 5. I'll put up a PR which fixes the code to use the appropriate constant.... Actually, it probably makes more sense to merge the small fix into this branch. I filed a ticket #1399 and the fixed repo is pjsg:correct-sector-count |
Do you think we should document this in |
Thanks for the hint, Marcel. 1.5.4.1 release notes even ask the user to "blank" the new sector. All in all the flash erase seems to be the simplest approach from now on. BTW SDK 2.0.0 surfaced 😐 |
@@ -58,12 +58,13 @@ If upgrading from [SPIFFS](https://github.com/pellepl/spiffs) version 0.3.2 to 0 | |||
|
|||
If you flash a recent NodeMCU firmware for the first time, it's advisable that you get all accompanying files right. A typical case that often fails is when a module is upgraded from a 0.9.x firmware to the latest version built from the [NodeMCU build service](http://nodemcu-build.com). It might look like the brand new firmware is broken, but the reason for the missing Lua prompt is related to the big jump in SDK versions: Espressif changes the `esp_init_data_default.bin` for their devices along the way with the SDK. So things break when a NodeMCU firmware with a certain SDK is flashed to a module which contains init data from a previous SDK. | |||
|
|||
Download SDK patch 1.5.4.1 (http://bbs.espressif.com/download/file.php?id=1572) and extract `esp_init_data_default.bin` from there. *Use this file together with the new firmware during flashing*. | |||
Download SDK patch 1.5.4.1 (http://bbs.espressif.com/download/file.php?id=1572) and extract `esp_init_data_default.bin` from there. *Use this file together with the new firmware during flashing*. This SDK release introduced an additional sector for RF calibration data. Espressif recommends to clear this one as well in the [release notes](http://bbs.espressif.com/viewtopic.php?f=46&t=2376). The simplest way to set up the flash from scratch is to erase the complete flash before upgrading (or downgrading) SDK versions. |
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 whole "Upgrading from SDK 0.9.x Firmware" chapter starts feeling strange to me. Wouldn't most of what is stated here apply to someone upgrading from e.g. 1.4.x just as well? Besides, if we suggest to erase the flash doesn't separately updating esp_init_data_default.bin
become obsolete?
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.
Wouldn't most of what is stated here apply to someone upgrading from e.g. 1.4.x just as well?
Thought the same but kept the reference to 0.9.x for the time being since users will get this version on pre-flashed NodeMCU boards. But yes, this chapter could be made more general.
Besides, if we suggest to erase the flash doesn't separately updating esp_init_data_default.bin become obsolete?
Espressif still requests to do so:
Download blank.bin to initialize the sector stored RF_CAL parameter (set by user_rf_cal_sector_set), and download esp_init_data.bin into flash, when the system needs to be initialized, or RF needs to be calibrated again.
Or am I missing something? Honestly, the description in 30d354c still isn't fully clear to me. Does the SDK initialize automatically?
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.
Espressif still requests to do so
Sorry, I also read up on Espressif's release notes - but only after I posted this.
Does the SDK initialize automatically?
I don't know but maybe @jmattsson does?
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 there is no init data block found during SDK startup, the SDK will install one itself. If there is a previous (potentially too old init block), the SDK probably doesn't do anything with it but there is no documentation from Espressif on this topic.
Doing a chip-erase when upgrading between versions would definitely prevent a mismatch of init data. The alternative is of course to manually overwrite the init data with the new esp_init_data.bin
file.
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.
Thanks for confirming what I had thought was going on. I suggest we turn this paragraph into a more general upgrade note with two sections:
- to keep your Lua files: flash NodeMCU and init data (kind of what we currently have)
- if you can give up your Lua files because you're gonna upload them again anyway: erase flash and flash NodeMCU
I can prepare a PR for that if you agree.
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 can prepare a PR for that if you agree.
I do 😃
BTW does the NodeMCU Flash support erasing? I can't find any trace for that. Seems esptool.py ultimately becomes our reference tool.
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.
@marcelstoer @jmattsson I found something when I was checking if SDK 2.0.0 fixed a bug with the forced sleep API.
When I burned the SDK 2.0.0 firmware over the SDK 1.5.4.1 firmware, I didn't update esp_init_data_default.bin
and when it rebooted on completion of firmware upload, I got the message system param error, use last saved param!
which I assume is the SDK complaining about the old init data, I tracked it to sdk/lib/libmain.a
.
Hope that helps.
I tried a couple of upgrades and downgrades to the 1.5.4.1 version and didn't have any problems. The only issue is that if you have formatted a filesystem on 1.5.4 and then upgrade to 1.5.4.1, the rf cal sector may be part of the file system (which is bad). If you reformat (explicitly) the file system, then it will use the new size. I don't know if it is worth adding a check to make sure that an existing file system does not violate the space available. |
I'm gonna merge this as my manual smoke test suite* runs fine on 1.5.4.1. However, I anticipate that this update is gonna trip up quite a few of our users because of the flash-erase esp_init_data hassle. It's the first time in roughly a year that updating init data was really necessary. With all previous updates flashing the firmware alone had always worked fine for me. * 2 different NodeMCU devkits, 1 WeMos D1 mini; different applications using gpio, wifi, tmr, net, http, mqtt, spi modules |
Sorry for the very late reply, I have just ordered WeMos D1 mini Pro and tested with latest firmware. I found the 1.5.4.1 SDK always fall back to use 512 KB flash address for initial rf_cal, but it still can use some workaround to run the NodeMCU firmware correctly. Here are the details: |
The current |
I have tested latest dev branch, it show "rf cal sector: 123" while boot up if connected with 74880 baud rate. Seems 1.5.4.1 SDK not yet define flash size over 4 MB and fall back to 512 KB. |
Fixes #1377.
docs/en/*
.Espressif recently announced a patch to upgrade SDK to 1.5.4.1:
The RF calibration data allocates an additional sector at the end of the flash. I've adjusted the
INTERNAL_FLASH_SIZE
calculation incpu_esp8266.h
accordingly.On the downside this most likely breaks 64m and 128m flash support by #1367 since these sizes are not considered by
system_get_flash_size_map()
and Espressif's recommended new user_main hookuser_rf_cal_sector_set
. I'd be happy to extendenum flash_size_map
inuser_interface.h
accordingly if somebody confirmed how.