-
Notifications
You must be signed in to change notification settings - Fork 819
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
add script to compress firmware before ota upload #1065
add script to compress firmware before ota upload #1065
Conversation
c3aae8e
to
44e108d
Compare
Unfortunately this does not fully solve the OTA issue for Sonoff RF Bridge. The bin-file od the current develop branch seems to be so big, that there is no space even for the compressed bin-file. It worked one time updating from a previous version. Also it looks like this is not working for ESP32 (at least for me it started uploading and I got an error after 8% or so). Anyways I reworked the script a little bit to also compress on build. |
If you remove MQTTsetMQTT macro are you still unable to OTA update the RFBridge ? |
Yes, even if i remove MQTTsetMQTT it's still too large. Unfortunatly I had no time to investigate any further this weekend. |
When investigating for the pull request #1046 I found that disabling MQTTsetMQTT only creates a small space saving, similarly to only disabling MQTT_HTTPS_FW_UPDATE. Only disabling both resulted in a viable reduction which enabled the OTA update for the Avatto again. Maybe this might also help here. Here are the results from my tests: 0.9.8 0.9.8 with just Checking size .pio/build/avatto-bakeey-ir/firmware.elf 0.9.8 with just Checking size .pio/build/avatto-bakeey-ir/firmware.elf 0.9.8 with Checking size .pio/build/avatto-bakeey-ir/firmware.elf |
@DigiH sorry for the late reply. I already disablet both options, and this is what I get:
I'm using hacked Sonoff RF bridges with "ZgatewayRF". It's only about 17kB too much for OTA falsh. I also set 'ESPWifiManualSetup="true"'. |
@dkneisz - what a shame about the measly 17kB causing OTA to still fail :( While I'm not really familiar with the Sonoff RF bridge, wouldn't increasing the partition size with the custom setting of board_build.ldscript = eagle.flash.1m64.ld for the ESP8285 help as well, as with the Avatto ESP8266. The default seems to be eagle.flash.1m256.ld for the boards. So the extra 192 kB should help in your case. Unfortunately the initial upload with this has to be done via direct serial cable, but then with the extra space gain repeated OTA should be possible with the previously mentioned disabling flags and your compression script. All the best. |
P.S. or possibly using and older OMG version, which used to be quite a bit smaller, with board_build.ldscript = eagle.flash.1m64.ld in OTA mode to increase the partition size. Not sure if this would be feasible though ;) |
@DigiH thanks for the tip, this seems to work. I was able to OTA flash one of my SRFB, that still had an older OMG version, with this setting. Flashing one, that had a newer OMG version, took some persuasion. I had to flash it multiple times and erase the flash for it to work, but in the end it is working. |
@dkneisz - glad to hear that OTA is working for you again now :) @1technophile - maybe board_build.ldscript = eagle.flash.1m64.ld should also be included as a default for all Sonoff bridge environments, as for the Avatto, or any other ESP8266 1MB based boards which are not easily connectable. The saved 192 kB really seems to make a difference for OTA updates and I haven't seen any negative effects with the changed partitions on any of my Avattos. |
44e108d
to
001fe4b
Compare
I implemented some changes to my solution:
|
I agree, @dkneisz maybe you could update directly platformio.ini sonoff rf bridge envs, add this ldscript |
- use compress script to save space uploading firmware - use "board_build.ldscript = eagle.flash.1m64.ld" to free some additional space for OTA flashing.
001fe4b
to
0f42898
Compare
@1technophile I added It also made no sense to me to define such an environment there, because you need to add the ip address of your device. So you would have to use a placeholder, that would make platformio.ini invalid and it would not pass your checks (on github), or use a dummy ip. That's why I added the examples to prod_env.ini.examples. |
Thanks, I get it |
Just to note, in case of update to 3.0.0 there's a built-in solution right in the framework builder: |
Description:
adds an extra script to compress firmware bofore OTA upload. The Script is located in scripts/compressed_ota.py and added in platformio.ini with "extra_scripts = scripts/compressed_ota.py". This fixes the issue that OTA failes for Sonoff RF Bridge due to the code becoming too large with the last releases. In my case the compression reduced the firmware to 72%.
Checklist: