I've been looking for some information on how to implement frozen bytecode, and I found the following in the docs:
https://docs.micropython.org/en/latest/ ... h-freezing
Firstly I was wondering if this makes frozen bytcode or frozen modules? Because you don't use the cross-compiler to make a .mpy file, so I would assume this makes frozen modules? But if it does make frozen bytecode, how do you make frozen modules?Using frozen bytecode requires building the executable (firmware) for a given MicroPython port from the C source code. Consequently, the process is:
1. Follow the instructions for a particular port on setting up a toolchain and building the port. For example, for ESP8266 port, study instructions in ports/esp8266/README.md and follow them. Make sure you can build the port and deploy the resulting executable/firmware successfully before proceeding to the next steps.
2. Build MicroPython Unix port and make sure it is in your PATH and you can execute micropython.
3. Change to port’s directory (e.g. ports/esp8266/ for ESP8266).
4. Run make clean-frozen. This step cleans up any previous modules which were installed for freezing (consequently, you need to skip this step to add additional modules, instead of starting from scratch).
5. Run micropython -m upip install -p modules <packages>... to install packages you want to freeze.
6. Run make clean.
7. Run make.
Then after some more research and looking around I found the following link to the github repo of Peter Hinch in a post on this forum.
https://github.com/peterhinch/micropyth ... -manifests
Which explains that as of October 2019 the method of specifying modules to be frozen has changed and now uses a manifest.py file.
Another post I saw on this forum confirmed this. It was an update by Damien George on the release of MicroPython 1.12 that said:
viewtopic.php?f=8&t=7430
So I tried to find some more information on this new method of freezing bytecode, but I couldn't find anything in the docs or in the Github repo of MicroPython that explained this process.A new mechanism to freeze scripts into firmware is provided - a frozen manifest - whereby scripts to freeze are listed in a Python file (eg manifest.py). All ports are updated to use this new feature.
The only thing I found was the explanation in the github repo of Peter Hinch:
https://github.com/peterhinch/micropyth ... -manifests
So my questions:
-Should I use the method explained in the docs or should I use this manifest.py method?
-If I should use the manifest.py method, is there some more information about this?
Because I still don't understand it completely:
*Do you have to make this manifest.py yourself? Because I don't see it in the micropython/ports/stm32/boards/PYBV11 folder?
*Should I always write an include at the beginning in the manifest.py file or is it a special feature you use when you want to import
another manifest.py file, for some reason.
*Do you have to put the dollar sign before the path in the freeze() function? Because it is done like this in the first two freeze()
examples but not in the third.
*In the examples all the files used by the freeze() function are .py files. Can you also use .mpy files and gives this frozen bytecode?
Thanks in advance!