OTA upgrade from oldest to newest



  • 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?



  • @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.

    -AP



  • @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 --pypic flag, 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.

    -AP



  • @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.

    -AP



  • @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.

    -AP



  • @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.


 

Pycom on Twitter