ESP-01, where are boot.py and main.py?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

ESP-01, where are boot.py and main.py?

Post by Guenther78 » Fri Apr 19, 2019 3:31 pm

Hello forum,

I am new to the ESP8266. I have little experience with micropython, some years ago I made some tests with a Nucleo board.

I have a ESP-01 with 512 kByte flash. There is a version of micropython for ESP's with only 512 kBytes of flash memory, I downloaded and installed it via esptool. I also used the REPL with picocom and i made a small function.

I know, the version for 512 kByte ESP's does not support WebREPL and the uos library does not support functions like listdir(). But I am very interested, where I can find boot.py and main.py. I'd like to write a little function that is executed by the beginning, so I had to edit the main.py file. Or is there another solution?

I also found ampy from adafruit, but loading a file to the ESP was not successful till yet:
https://learn.adafruit.com/micropython- ... ot-scripts

I also have a ESP-12, there I would not have this problem. But I'm very interested how the ESP-01 works. Can anybody help me? Thanks in advance.

Best regards, Guenther

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: ESP-01, where are boot.py and main.py?

Post by Guenther78 » Mon Apr 22, 2019 9:20 am

Hello forum,

boot.py and main.py can be created by the user (3.3. Start up scripts):

http://docs.micropython.org/en/latest/e ... ht=webrepl

It is possible to create a file with:

Code: Select all

f = open('data.txt', 'w')
But it is not possible to read it or to write to it. An Attribute Error appears. Only opening and closing the file seems to be possible.

Best regards,
Guenther

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

Re: ESP-01, where are boot.py and main.py?

Post by pythoncoder » Tue Apr 23, 2019 7:18 am

I seem to remember that the ESP8266 with 512K flash has too little Flash memory to support a filesystem.
Peter Hinch

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: ESP-01, where are boot.py and main.py?

Post by Guenther78 » Tue Apr 23, 2019 8:13 am

Yes, You are right. The flash is not big enough. Just a few minutes ago I read this also in the README.md file:

https://github.com/micropython/micropyt ... ts/esp8266
There's a special configuration for 512KB modules, which can be built with make 512k. This configuration is highly limited, lacks filesystem support, WebREPL, and has many other features disabled.
For programming the 512k ESPs, I should switch to C/C++.

I havn't found it the FAQ or anywhere else: How can I mark this topic as solved?

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

Re: ESP-01, where are boot.py and main.py?

Post by pythoncoder » Tue Apr 23, 2019 9:12 am

You may be able to run MicroPython modules as frozen bytecode but I'd certainly choose a better ESP8266 for development before porting the code to the ESP-01.
Peter Hinch

User avatar
Guenther78
Posts: 25
Joined: Fri May 19, 2017 11:48 am

Re: ESP-01, where are boot.py and main.py?

Post by Guenther78 » Mon Apr 29, 2019 1:44 pm

If I understoot it right, it is not possible to write files to a device flashed with the 512 kB version of micropython.
But I need to do this, because I would like to have code that runs at Power on.

I flashed the ESP-01 with nodelua:
https://nodelua.org/

Maybe this could be an option if somebody have to use a small mcu.
I will post my results...

Post Reply