OTA upgrade from oldest to newest
panda last edited by panda
I have a number of GPy modules to deploy and I am trying to use OTA in an automation script to bring the modules to the latest firmware version.
The modules shipped with 1.10. I want to go to 1.18.1.r1 in one step, but this is not successful. The OTA process completes with no errors, but the version does not change after reset.
Starting with a later version, for example 1.17.2, works fine.
Is it not possible to make such an upgrade leap? Suggestions for automating the fw update without having to enter bootloader mode?
I'm planning to rewrite the documentation around firmware upgrades + modem updates soon to be clearer and easier to understand.
I'll make sure a note on this is included.
Thanks for pointing it out and the time spent working it out :)
@robertkeizer Yes. Somewhere in the past there was a change in the bootloader, including the partition table. The same problem occurs when changing from a devive with FAT to LITTLEFS (1.19.x).
But there is still another problem. When alternating between OTA and USB firmware upload, it may happen that the USB uploaded image will not be executed. The OTA upload toggles a flag, which tells, which firmware partition to use for the new image, and sets the "active_partition" flag accordingly. The USB upload always puts the image in the first partition and may not reset the "active_partition" flag. I reported that a while ago, and after a few updates, I tested it again. At that time it was not fixed, even if it told it was. I did not test it again since then. Maybe the official uploader fixes it, but not the "make flash" command from the repository, which I am using.
robertkeizer last edited by
Perhaps a note about how this is the case would be warranted in the documentation? I burned a few hours looking for why the
pycom.ota_finishlines were being called but it wasn't changing firmware.
Would have been nice to know the bootloader changed enough that serial/sd firmware updating was required to get OTA functionality.
@panda I see no way, at least no obvious one, to bridge the gap. Th new versions also use a different bootloader, which is not updated by OTA.
@jcaron I understand your point, but I have to disagree about it being faster than what I have devised.
I store the latest firmware is on an pre-formatted SD as well as the scripts to perform the updates and deployment (and a whole host of other tasks such as modem upgrade etc). All I need is a single command from the REPL and it is off an running.
In addition, no need to enter bootloader mode, no need for a PC, another app or even a USB connection. I can use the AP to execute the command if I choose.
Speed of the actual fw update (all other efficiencies aside) is about the same as the pycom app.
jcaron last edited by
@panda if you have the devices at hand (rather than in the field), I think it'll be a lot easier and quicker if you flash them via USB.
Use a PySense, PyTrack or Expansion Board 3.0, so you can switch the device to firmware upgrade mode without having to touch anything, then use the firmware upgrade tool CLI with the
--pypicflag, and it should be pretty quick.
The only caveat is that you'll probably need a recent PySense/PyTrack firmware for this.
This could already be part of another thread (I can not find), but anyone who has product in the field pre-1.17.2.b1 will NOT be doing an OTA update successfully unless pycom folks have a solution or can point us to what we might be doing wrong.
@robert-hh After a test of each successive firmware upgrade the process is broken after 1.17.0.b1.
OTA and FTP update will work from 1.10.0 ---> 1.17.0.b1.
OTA and FTP update will work from 1.17.2.b1 ---> 1.18.1.r1.
OTA and FTP update will NOT work going from before 1.17.2.b1 to anything later.
This stinks :(...for me.
@panda The script is doing essentially the same as ftp upload. So it's no wonder that the result is the same. There might have been a change in the binary file format since 1.10.0 with respect to a checksum at the end of the file, which is expected by 1.10.0. Maybe someone from Pycom knows the details.
I used a script very similar to the docs example:
# Firmware update by reading the image from the SD card # from pycom import ota_start, ota_write, ota_finish from os import mount from machine import SD BLOCKSIZE = const(4096) APPIMG = "/sd/appimg.bin" sd = SD() mount(sd, '/sd') with open(APPIMG, "rb") as f: buffer = bytearray(BLOCKSIZE) mv = memoryview(buffer) size=0 ota_start() while True: chunk = f.readinto(buffer) if chunk > 0: ota_write(mv[:chunk]) size += chunk print("\r%7d " % size, end="") else: break ota_finish()
In addition, I tried using FTP with same result. I have not gone 1 by 1 to see where it stops working, but these boards all have:
(sysname='GPy', nodename='GPy', release='1.10.1.b1', version='v1.8.6-843-gd3b69c78-dirty on 2017-11-18', machine='GPy with ESP32')
So it appears I cannot use OTA or FTP for the update to the latest firmware from 1.10.1.b1.
@panda How did you perform the OTA update. I looked into 1.10.0.b1. At least uploading appimg.bin to /flash/sys via ftp is implemented, and the partition map also looks the same.