mpfshell: remote shell for esp8266

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

mpfshell: remote shell for esp8266

Post by wendlers » Wed Mar 16, 2016 10:19 pm

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
Last edited by wendlers on Thu Mar 17, 2016 10:56 am, edited 1 time in total.

User avatar
platforma
Posts: 257
Joined: Thu May 28, 2015 5:08 pm
Location: UK

Re: MicroPython ESP8266 firmware, v02

Post by platforma » Thu Mar 17, 2016 10:47 am

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".

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Thu Mar 17, 2016 10:59 am

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.

User avatar
platforma
Posts: 257
Joined: Thu May 28, 2015 5:08 pm
Location: UK

Re: mpfshell: remote shell for esp8266

Post by platforma » Thu Mar 17, 2016 11:03 am

I'll admit that I haven't tried using it myself yet. Maybe Dave can let us know if ESP is supported.

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

Re: mpfshell: remote shell for esp8266

Post by slzatz » Thu Mar 17, 2016 1:12 pm

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.

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: mpfshell: remote shell for esp8266

Post by wendlers » Thu Mar 17, 2016 1:39 pm

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 ...

User avatar
platforma
Posts: 257
Joined: Thu May 28, 2015 5:08 pm
Location: UK

Re: mpfshell: remote shell for esp8266

Post by platforma » Thu Mar 17, 2016 2:03 pm

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 :)

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

Re: mpfshell: remote shell for esp8266

Post by slzatz » Thu Mar 17, 2016 2:44 pm

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?

User avatar
platforma
Posts: 257
Joined: Thu May 28, 2015 5:08 pm
Location: UK

Re: mpfshell: remote shell for esp8266

Post by platforma » Thu Mar 17, 2016 3:40 pm

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.

skylin008
Posts: 50
Joined: Wed Mar 11, 2015 6:21 am

Re: mpfshell: remote shell for esp8266

Post by skylin008 » Mon Mar 21, 2016 7:16 am

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]

Post Reply