[Wipy 2.0] How to build firmware release='1.4.0.b1'

  • Hi everyone,

    I just get used to build firmwares from github repository and I would like to build an old version.

    Just to explain, I need frozen bytecode into my firmware due to big libraries that can't be compiled from flash.
    The problem is I also need to use BLE and after the release 1.4.0.b1 it seems to be impossible to connect to a ble device.
    See Wipy + CC2650 - Bluetooth connection fail / return closed GATTCConnection
    and BLE connects but connection is lost immediately

    So my objective is to build a firmware with my frozen code embedded into it and using the 1.4.0.b1 release to also have bluetooth working.

    The point is I don't know how to get the source code of this specific release and I don't know either if the frozen bytecode is handled yet in this release.

    Can someone help me with this issue? Maybe there is a best solution to achieve my goal.

  • @Arkaik In the list of commits, you have to go back to an entry with the title "Bump to version 1.4.0.b1". There you find the fingerprint. It's not a long way.
    In you first port you mentioned 1.4.0b1. But now you mention 1.0.4b1.
    About esp-idf. Do use the version indicated by the pycom web site.Try to checkout the most recent version before the date of the wipy firmwar you are using. That might get a little bit of a trial & error game.

  • @robert-hh Hi Robert,

    I tried your solution and I have a few questions about it.

    First of all how did you get the release 1.0.4.b1 fingerprint?
    When I go into releases, I just see v1.4 on 29 Mar 2015 and v1.4.1 on 4 Apr 2015

    About esp-idf version, the first version was released after the 1.0.4.b1 (30 Sep 2016 - v0.9), should I use this version of the esp-idf?

    Thanks again for your help.

  • @robert-hh Hi Robert,

    Thanks for the answer, I'll try it soon and come back to tell you if it succeed ;)

  • @Arkaik The code of 1.4.0.b1 is embedded in the repository https://github.com/pycom/pycom-micropython
    You have to clone that with git:
    git clone https://github.com/pycom/pycom-micropython.git --recursive
    and then you have to check out v1.4.0.b1 with:
    git checkout 4a4a81eb779220c984f002f055481fe5999aa54e
    The latter is the fingerprint of that version. You may shorten it.

    You have also to download & install the pycom esp-idf. With that, you may also have to go back to an older version. Just compare the dates.

    Once you've done that, you have to enable frozen bytecode by editing esp32/mpconfigport.h. You have to add a few lines:
    In mpconfigport.h, goto the line
    and change it to the four lines:
    #define MICROPY_MODULE_FROZEN (1) #define MICROPY_MODULE_FROZEN_MPY (1) #define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool #define MICROPY_PERSISTENT_CODE_LOAD (1)
    The last line enables to run pre-compiled code from the file system.
    Before that have to create the cross-compiler, which resides on
    pycom-micropython/mpy-cross, just with a make command in the directory.
    You then can do a cross-compile with:
    ./mpy-cross your_code.py
    which creates a file named your_code.mpy
    For frozen bytecode, this step is performed by the make process. For that, put your python code like before into the directory modules and run:
    make FROZEN_MPY_DIR=modules BOARD=WIPY

    It looks as I had tested that with a version 1.2.0b1 already, so it should be possible. Please note, that the heap on version 1.4.0b1 is pretty small.

    Good luck. It is possible, but there are many ways to stumble.

Pycom on Twitter