OTA or not OTA that is the question...

  • @BetterAuto In order to uplod the full appimg.bin you must bulid the environment and edit the bootloader. (Actually the size for the appimg is fixed to 1MB). After that you can upload the entire file appimg.bin using FTP. Anyway, I do some tests and after the upload of the appimg.bin file in the sys folder nothing change. In other words OTA doesn't work also if you upload the full image on sys folder.

  • Pybytes Beta

    I'm trying OTA over FTP, is this still non-functional? I'm able to upload only about 1/4 of appimg.bin and it dies.

    This is what I see on the console when it dies. Here, I am going from 1.4.0.b1 to 1.6.0.b1 on a WiPy 2.0.

    Also could someone please upvote me as well? Grin

    Guru Meditation Error of type IllegalInstruction occurred on core  0. Exception was unhandled.
    Register dump:
    PC      : 0x40188c04  PS      : 0x00050930  A0      : 0x80096671  A1      : 0x3fff2730
    A2      : 0x3ffced9c  A3      : 0x3ffc1dec  A4      : 0x40188603  A5      : 0x00000000
    A6      : 0x00000000  A7      : 0x0000012e  A8      : 0x80188600  A9      : 0x3fff2710
    A10     : 0x3ffc1dec  A11     : 0x00060923  A12     : 0x00060920  A13     : 0x00000002
    A14     : 0x00000fdb  A15     : 0x00060023  SAR     : 0x0000001a  EXCCAUSE: 0x00000000
    EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000
    Backtrace: 0x40188c04:0x3fff2730 0x40096671:0x3fff2750 0x4009824e:0x3fff2770 0x40099fa2:0x3fff2790

  • @Innocenzo I just gave ftplib a try.

    • the uncompressed python script does not load
    • the cross-compiled python file loads and works well
    • a minified python script loads too and works well.

    Since the minified version is not really readable too and requires an PC pre-process step, the compiled version is preferred. You could also compile the minified version, which gives the smallest footprint (about 11k). (get minify with pip install minify)
    I would still try to use my own little loader, since that gives you full control. The only disadvantage is, that you have to implement both client & server.

  • @robert-hh Thx a lot.

  • @Innocenzo I have placed Linux and Windows versions here:
    The versions for the pycom and micropython.org variants differ in the tag of the generated file, so take the right one.
    mpy-cross --help
    tells you the usage. On WiPy, the .py files take precedence over the .mpy files. If you want to run the .mpy variant, delete or rename the other version first.

  • @Innocenzo OK. It'll take a few housr before I'm home to prepare the binaries. Linux is easy, for Windows10 I can use my Windows VM.

  • @robert-hh Actually I use Windows 10 (if there are problems I have also a VM with Ubuntu). Thx

    @jmarcelino For my purposes the Wipy must require the transfer and contact the server. I think that the socket approach is the better solution.

  • @Innocenzo
    It's much better if you run use a FTP client on your Server to connect to the existing FTP server running on the LoPy. (confusing sorry :) The FTP server on the LoPy is more efficient and already done in C.

    Alternatively use the light weight sockets approach robert-hh suggested.

  • @Innocenzo Both mpy-cross and dfrozen bytecode require the buidl environment for WiPy (https://github.com/pycom/pycom-micropython-sigfox). I can make a mpy-cross (the pyhton cross-compiler) for you, if you tell me your OS. Then you would compile you python code on your PC, get a file with the extension .mpy and store it on the wipy, like a python script. Th ecompield file may not be much smaller, but it needs less space when loaded and does not need RAM during loading.

  • @Innocenzo Besides that, you can always implement a simple file transfer using sockets with a few dozen lines of code.
    open connection to sever
    request: name_of_file
    response: file_or_sorry
    get data until the server closes the connection.

  • @robert-hh There is some guide where I can learn about using pre-compiled files or froze bytecode?

    @jmarcelino I want perform the FileSystem Update through micropython code. In other words I want that a function in my code can connect to a Server, download a new version of boot.py and main.py and reset the machine. With previous answers I understand that the only way to do this is through FTP.

  • @Innocenzo
    a FTP client feels a bit wasteful on resources, it's a very verbose protocol with lots of old baggage. Is there a particular reason for it?

  • @Innocenzo If the code get's too large, you too can use pre-compiled files, or use frozen bytecode (code in flash). That however requires you to install the build environment for the firmware.

  • @robert-hh I've tried this version but I've some problem on memory allocation

    MemoryError: memory allocation failed, allocating 322 bytes

  • @Innocenzo @spotlightkid has created a ftplib version that runs on esp8266 micropython. In general, that should work on wipy32 too. Maybe you have to adapt a little bit, since the two dialects are not 100% the same.
    If the code get's too large, you too can use pre-compiled files, or use frozen bytecode (code in flash). That however requires you to install the build environment for the firmware.

  • @robert-hh I am sorry for the many questions, but exists something like ftplib.py that works on WiPy 2.0?

    Or the better solution is to write code from the scratch?

  • @bucknall Thx a lot for everything

  • Hi @Innocenzo,

    You need a minimum of 3 reputation to post faster than once every 600 seconds. I've upvoted a couple of your posts so this should be resolved now! It's intended as a method to slow down spammers and those posting automated content.

    Regarding your questions about the Firmware Update tool, this is correct. As of current, you need to use the Pycom Firmware Update tool - we're looking into bringing OTA back but at the moment we're prioritising other core features!

    I'll post back here when this feature is released!



  • @Innocenzo Yes, that is true. You can replace any file in the file system, but firmware and frozen bytecode can only be loaded trough an external PC. It does not have to be the Pycom updater. If you search the board for downgrade, you'll find a manual procedure, and the firmware images are all accessible, once you guess the right name. You can also install the repository and build environment to create you own images. OTA of the firmware worked in the beginning, but that stopped at about V1.

    P.S.: One mechanism of increasing the reputation is being upvoted by someone else, which I just did for your post.

  • @robert-hh Instead, the Module Firmware update can be done only through the Pycom Firmware Update Tool, right?

    [off Topic] How can I increase my reputation? I can write a message only every 600 seconds and it is pesky :( .

Log in to reply

Pycom on Twitter