Compile Settings ESP8266 / WemosD1 mini [solved]

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Posts: 2
Joined: Tue Jan 07, 2020 7:17 pm

Compile Settings ESP8266 / WemosD1 mini [solved]

Post by uracolix » Tue Jan 07, 2020 7:36 pm

Hello all,

I currently encounter the situation, that I need to self compile my ESP8266 port. But in the first round (before I change anything)
I just want to compile ESP8266 MyPy and verify that it behaves same like the precompiled binary.

Anyway, my little SensorApp runs pretty stable on esp8266-20191220-v1.12.bin binary for many days, including deep sleep, everything is perfect.

Now I followed the build instructions to compile from ... r-esp8266/

I get out a build-GENERIC/firmware-combined.bin which provides a wonderful REPL on serial interface, esp.check_firmware() tells me that the binary shall be OK.
>>> import esp
>>> esp.check_fw()
size: 591892
md5: e146520f3fb8d9e1361b3455d3d0ad7d
Now if I download my Python scripts and if run it, I get immediately:
no dd-wrt_vap found, reconnect after 1s
Traceback (most recent call last):
File "", line 2, in <module>
File "", line 10, in <module>
File "", line 11, in <module>
MemoryError: memory allocation failed, allocating %u bytes

MicroPython v1.12-35-g1070984 on 2020-01-05; ESP module with ESP8266
Type "help()" for more information.
>>> reconnect
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
Obviously in the default checkout is something enabled, that eats up my memory.
What I have to do to replicate the standard binary?

Any help is apreciated,

Last edited by uracolix on Sat Jan 11, 2020 3:44 pm, edited 1 time in total.

Posts: 2
Joined: Tue Jan 07, 2020 7:17 pm

Re: Compile Settings ESP8266 / WemosD1 mini [solved]

Post by uracolix » Sat Jan 11, 2020 10:01 am

No compiler magic at all.
I replaced the Python file that crashed with the mpy version of it and voila it works.
Offcourse the newer binary version has a different RAM fragmentation. The source code was 10K and the pre-compiled file is 4K. For 80K total of RAM this is a huge difference. I think it was more or less "luck" that it worked before.
The only thing that I can blame Micropython for, is that a programmer easily forgets that he is on an embedded device :D

Best, Axel.

Post Reply