How to do... frozen modules in WSL

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
profra
Posts: 39
Joined: Sat Jan 03, 2015 12:23 am

How to do... frozen modules in WSL

Post by profra » Tue Jul 25, 2017 4:41 pm

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.
Last edited by profra on Wed Jul 26, 2017 7:12 pm, edited 1 time in total.

fangis
Posts: 11
Joined: Mon Jul 24, 2017 11:03 pm

Re: How to do... frozen modules

Post by fangis » Wed Jul 26, 2017 1:40 am

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

User avatar
pythoncoder
Posts: 3410
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: How to do... frozen modules

Post by pythoncoder » Wed Jul 26, 2017 6:21 am

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
Peter Hinch

profra
Posts: 39
Joined: Sat Jan 03, 2015 12:23 am

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

Post by profra » Wed Jul 26, 2017 9:09 pm

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.

Post Reply