Page 1 of 1

How to do... frozen modules in WSL

Posted: Tue Jul 25, 2017 4:41 pm
by profra
Being on vacation and having plenty of free time, fast WiFi and notebook with W10 I have decided to install Bash Shell and the whole toolchain for building of MicroPythone (my Linux machine is sleeping at home). Success!!! I have taken also one Feather HUZZAH with and the result is fully functional MicroPython on esp8266.

But I found new problems I had not solved yet... frozen modules.
a/ My first naive idea was to put my_module.py in the directory "micropython/esp8266/modules/" and start building... unfortunately, no my_module.mpy in the directory "micropython\esp8266\build\frozen_mpy"... I went through the MicroPython Forum but I haven't found anywhere clear description "step by step" how to organize "things" to build the image including also my modules.
b/ The second problem was that I wanted to use mpy-cross to compile my_module.py into my_module.mpy. I did it exactly according to the instructions...

Code: Select all

fp@FP_Z30B10V:~/github/micropython/mpy-cross$ ./mpy-cross blink.py
OSError: 2
... but I get always the same output OSError: 2 (i.e. /* No such file or directory */), even though the blink.py file is in the directory as mpy-cross (the same for ./blink.py).

I would like to ask for advice (point a/ and b/) anybody who has better knowledge and experience than me. Thank you very much in advance.

Re: How to do... frozen modules

Posted: Wed Jul 26, 2017 1:40 am
by fangis
On point b, do you have permissions to write and execute, for example in that folder try:

chmod 777 *

And try to run it again

Re: How to do... frozen modules

Posted: Wed Jul 26, 2017 6:21 am
by pythoncoder
Regarding frozen bytecode you put your .py module(s) in esp8266/modules. When you build the firmware the result is a firmware image esp8266/build/firmware-combined.bin. You then install it with esptool. So in the esp8266 directory issue

Code: Select all

make
make deploy

Re: How to do... frozen modules in WSL

Posted: Wed Jul 26, 2017 9:09 pm
by profra
Hi @fangis and @pythoncoder thank you very much for your response but was outside scope of question. As I know now my problems have occurred because I am newbie in using of Windows Subsystem for Linux (WSL). The problem from point b/ brought me with help of "uncle Google" to the right solution. Shortly said ... it is not allowed to "converse" with Linux files by Windows tools (apps). Everything is clearly explained here ... https://blogs.msdn.microsoft.com/comman ... and-tools/ ... All my problems were solved by symlinks now.
Current solution on my side is that I have directory "my_py_scripts" in the Windows environment where I have all .py modules which I want to move into Linux directory "micropython/esp8266/modules/" ... this "move" I do with help of symlinks. That's it.
I hope my experience will help also to the others as well.