Page 1 of 3

mpfshell: remote shell for esp8266

Posted: Wed Mar 16, 2016 10:19 pm
by wendlers
Just got the alpha 2 in my inbox and couldn't resist to immediately give it a try :-).

Runs so far very well on my ESP826612E (NodeMcu). Also things are getting really usable since the filesystem support works a lot better then in v01 (also it is activated on boot so one could use a "boot.py"). So far I was able to load a bunch of Python files to the flash and successfully import them.

Since I found managing files on the REPL a little cumbersome I started writing a little utility to upload/download/remove files to/from the device. It is a shell-based tool, loosely using commands like a simple FTP shell client (ls, get, put, rm). If the tool is of interest for someone else her, it could be found on my github:

https://github.com/wendlers/mpfshell

The tool is based on the "pyboard.py" from the Micropython repository.

Regards, and keep the great work up!
Stefan

Re: MicroPython ESP8266 firmware, v02

Posted: Thu Mar 17, 2016 10:47 am
by platforma
Hi Stefan,

Dave has been working on the rshell https://github.com/dhylands/rshell for some time now, but I am not sure if it has support for esp modules, which is the same idea as you had! To avoid confusion with the existing http://forum.micropython.org/viewtopic.php?f=16&t=1595 where discussion about new firmware releases happen, please rename this thread to something along the lines of "mpfshell: remote shell for esp8266".

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 10:59 am
by wendlers
platforma wrote:Hi Stefan,

Dave has been working on the rshell https://github.com/dhylands/rshell for some time now, but I am not sure if it has support for esp modules, which is the same idea as you had! To avoid confusion with the existing http://forum.micropython.org/viewtopic.php?f=16&t=1595 where discussion about new firmware releases happen, please rename this thread to something along the lines of "mpfshell: remote shell for esp8266".
Hi Platforma,

thanks for the "rhsell" hint. This looks pretty advanced! I will have a closer look later. Maybe it is already usable with the ESP.

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 11:03 am
by platforma
I'll admit that I haven't tried using it myself yet. Maybe Dave can let us know if ESP is supported.

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 1:12 pm
by slzatz
In the current git source for the esp8266, is boot.py created automatically and, if not, what directory should it be in when compiling the source so it is imported on startup? I see main.py in the scripts directory but not boot.py. Thanks for any insights as to how to run a script when the esp8266 boots up.

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 1:39 pm
by wendlers
slzatz wrote:In the current git source for the esp8266, is boot.py created automatically and, if not, what directory should it be in when compiling the source so it is imported on startup? I see main.py in the scripts directory but not boot.py. Thanks for any insights as to how to run a script when the esp8266 boots up.
Hi,

as far as I see, the filesystem support is not yet part of the main repo. It is only part of the ALPHA v02 from the Kickstarter.

Anyway, "frozen-modules" should work, and if you create your own "boot.py" under:

https://github.com/micropython/micropyt ... 66/scripts

and then re-compile/re-flash, it should be executed after booting/resetting. But you have to re-compile/re-flash every time you change a frozen-module ...

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 2:03 pm
by platforma
With the last v02 alpha update, you can write your own boot.py in the filesystem root, and it will execute on every boot. So there's no need to reflash the firmware everytime. But you have to use python to open and edit the file (f = open('boot.py', 'w' and so on). The feature will make it's way into the main repo eventually, so hang tight :)

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 2:44 pm
by slzatz
Thanks for the replies. Had assumed incorrectly that the alphas were being derived from the main repo so good to know they are not. I can import any script without problem that is in the script directory when I compile the firmware but it appears that there is no way to get that script to run on startup right now using the main repo. Separately, from a terminology standpoint, are those python modules that get compiled with the firmware and are available for import what people mean by frozen modules or is that something else?

Re: mpfshell: remote shell for esp8266

Posted: Thu Mar 17, 2016 3:40 pm
by platforma
Yes, you're right. A module that is "compiled into" the firmware is called a frozen module. And you don't need to have it in your filesystem like you normally would with your own python files. You can go ahead and import it normally and start using it. For example, ujson module is frozen and you can use it in any firmware.

Re: mpfshell: remote shell for esp8266

Posted: Mon Mar 21, 2016 7:16 am
by skylin008
Hi, platforma .I had ported the rshell to esp8266 scripts directory,but some error shows:

Code: Select all

>>>[code] import cmd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 5112 bytes[/code]