Page 1 of 1

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

Posted: Fri Apr 19, 2019 3:31 pm
by Guenther78
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

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

Posted: Mon Apr 22, 2019 9:20 am
by Guenther78
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

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

Posted: Tue Apr 23, 2019 7:18 am
by pythoncoder
I seem to remember that the ESP8266 with 512K flash has too little Flash memory to support a filesystem.

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

Posted: Tue Apr 23, 2019 8:13 am
by Guenther78
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?

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

Posted: Tue Apr 23, 2019 9:12 am
by pythoncoder
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.

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

Posted: Mon Apr 29, 2019 1:44 pm
by Guenther78
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...