Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Frozen modules for my Sipy (Solved)

    Scheduled Pinned Locked Moved Discussion
    frozen modulesfirmwareencrypt code
    9 Posts 2 Posters 1.2k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nespressifN Offline
      nespressif
      last edited by nespressif

      Hi, everybody,

      I have been researching to integrate my .py libraries, as frozen modules, in the firmware of my sipy to be able to call them from the main.py and make my code more secure and efficient.

      I have read that you must build the firmware as they say the instructions in the github repository, but I do not know if before building it should place my modules (.py) in a directory (I think in /py) and run freeze.py or how to do it. I would appreciate any help.

      Regards,

      1 Reply Last reply Reply Quote 0
      • C Offline
        cmisztur
        last edited by

        I haven't tried, but I would think pycom-micropython-sigfox/esp32/frozen/.

        https://github.com/pycom/pycom-micropython-sigfox/blob/b0520f1e17f395952fdf01065865fc71a07e596a/py/mkrules.mk#L112

        Let us know what ends up working for you.

        /c

        1 Reply Last reply Reply Quote 0
        • C Offline
          cmisztur
          last edited by

          Oh duh, it's right there at the bottom of https://github.com/pycom/pycom-micropython-sigfox/tree/master/esp32.

          "Using frozen modules
          Place all the python scripts that you'd like to be frozen into the flash memory of the board inside the 'frozen' folder in the esp32 directory. Then build as indicated before."

          nespressifN 1 Reply Last reply Reply Quote 1
          • nespressifN Offline
            nespressif @cmisztur
            last edited by

            @cmisztur Perfect, I didn't see it. I'll try it and if I get it I'll tell it here.

            Thank you

            C 1 Reply Last reply Reply Quote 0
            • nespressifN Offline
              nespressif
              last edited by

              I've built the new firmware with my integrated libraries, no problem. I placed my .py libraries in the ...esp32/frozen/common folder and then built it following the instructions

              $ cd ../esp32
              $ make BOARD=LOPY -j5 TARGET=boot
              make BOARD=LOPY -j5 TARGET=app
              

              Everything has worked correctly, now I just need to flash the firmware to the board and then it is assumed that any program (main.py) that loads will be able to import my libraries without having to include them in the /lib directory.

              When I try I tell you...

              1 Reply Last reply Reply Quote 1
              • C Offline
                cmisztur @nespressif
                last edited by

                @nespressif I know, readme after readme, they all blend together.

                1 Reply Last reply Reply Quote 0
                • nespressifN Offline
                  nespressif
                  last edited by

                  Hello everyone,

                  I have achieved the correct functioning of the frozen code (my .py libraries) in the firmware of my Sipy 1.0. Now flash a program that imports these libraries without having to include them in the /lib of my program.

                  Steps:

                  1.- I create a folder and clone in it the two necessary repositories (pycom-micropython-sigfox and pycom-esp-idf) and its submodules, also I download xtense gcc compiler and including it in the variable PATH, as it indicates the readme of the repository.

                  2.- Configure the IDF_PATH environment variable with the export command indicating the complete path. $ export IDF_PATH=~/mifolder/pycom-esp-idf

                  3.- Once this is done, I copy my libraries in the folder /esp32/frozen/common

                  4.- I follow the instructions to build and flash the firmware.
                  4.1.- cd mpy-cross && make clean && make & cd ..
                  4.2.- cd esp32
                  make BOARD=SIPY -j5 TARGET=boot
                  make BOARD=SIPY -j5 TARGET=app
                  4.3.- Once the firmware has been built without errors:
                  make BOARD=SIPY -j5 flash

                  And you can now load any program that uses your libraries. I hope it helps someone.

                  Regards,

                  C 1 Reply Last reply Reply Quote 3
                  • C Offline
                    cmisztur @nespressif
                    last edited by

                    @nespressif Helps me! Any idea how to change the version name for the custom build?

                    >>> import uos
                    >>> uos.uname()
                    (sysname='LoPy', nodename='LoPy', release='1.18.1.r1', version='b0520f1-dirty on 2018-10-23', machine='LoPy with ESP32', lorawan='1.0.2')
                    
                    nespressifN 1 Reply Last reply Reply Quote 0
                    • nespressifN Offline
                      nespressif @cmisztur
                      last edited by

                      @cmisztur Editing pycom-micropython-sigfox/esp32/pycom_version.h you can change the version, but I don't know how to change the name and the other parameters returned by uos.uname(). I'm sorry.

                      Regards,

                      1 Reply Last reply Reply Quote 0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • 1 / 1
                      • First post
                        Last post

                      Pycom on Twitter

                      Pycom