Thank you for this discussion! I had a similar issue where I was getting memory errors and trying to learn how to freeze modules (unsuccessfully thus far). I was able to build ok via jimmo's docker instructions but had no apparent filesystem until I also included the BOARDS=GENERIC_1M to make. Now I have what seems a proper build.
(Maybe I should make another thread?)
I'm able to flash my Sonoff R3 and copy my .py files over no problem. It seems to have a lot more free memory now (was on v1.12 release), but I still get a memory error during the initial module imports (where I didn't with the release code). There seems to be some issue with umqtt.simple (or more likely my understand). I thought it was available without using upip to install it but my import couldn't find it so I used upip to install it. Now the import dies on 'from umqtt.simple import MQTTClient'. upip created a /lib folder during the install which I'm pretty sure I didn't have with 1.12-release.
Isn't umqtt included in the build? I see it in the github micropython-lib.
Also, how do I determine if littlefs succeeded? I thought it doesn't have file timestamps, but 'ls -l' shows dates ('course they're all Dec 31, 1999 so maybe that's the indication).
Thanks for taking a look-see!
Code: Select all
MPY: soft reboot
id: sonoffr3
--- reading config-C0.json
--- Loaded file config-C0.json
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "atticfan01.py", line 17, in <module>
File "mqttsetup.py", line 2, in <module>
MemoryError: memory allocation failed, allocating 314 bytes
MicroPython v1.12-537-gecd782631-dirty on 2020-06-15; ESP module (1M) with ESP8266
>>> gc.mem_free()
23216
>>> micropython.mem_info(1)
stack: 2128 out of 8192
GC: total: 37952, used: 14960, free: 22992
No. of 1-blocks: 293, 2-blocks: 53, max blk sz: 41, max free sz: 297
GC memory layout; from 3ffeeec0:
00000: MDhhhhSMBhDhBhDBSBMB=MhhB=h===h===h==h=================h=======h
00400: =======h=DhDSSh=========h==h=====Dhh=h=======MBh=hB..h=h=h.h=...
00800: ..h=.......hD..h=hh=.Bh.....B.M.MD.S..h===h===h=======.ShShh=h=D
00c00: LhDSh=MD.BBBBBBh=h===h===DSh=DhSShhShSh.h=======h===h=DBSBBBBB=B
01000: Bh========BBBShBLhhSShShh===hh=Sh==========h========h=...Th=ShSh
01400: =Sh=hSSSh=======SBBDhSSh=======h=hS..hShh......h==ShS....h======
01800: =...BMD.hSh=.hh...B...h=MDh=========hAh.hS...h..SST=MShh..SS.LS.
01c00: .h==============hhh=Sh.BhBBL.....DhBh=Bh=====...............BBBB
02000: B..S.....hh=BBDBL...................ShhBLhBLS...h===h======hBLh.
02400: Bh=======LhBLhBLhBLhBLhBLhS.....h==BLShhh=......................
02800: hBLSh=hBLh.....ShhShh=h.Sh....S...h=hS...hShS..h==============h=
02c00: ===.....................h..................h=======.............
03000: .......h========..............Sh..........Sh................Sh..
03400: ...................h=============h======S...........h===========
03800: =========..........h=============...............h===============
03c00: ====h========================================.....h=======Sh====
04000: ===.............................................................
04400: .................................................h..............
04800: ...........................S.................Sh....Sh.....h=====
04c00: ==h.......ShShS..........h.....S....h................h=.........
05000: ............................h.............ShSh...h=======.......
05400: .....................................ShSh=.h====================
05800: ===========........Sh.........ShShSh...........S................
05c00: ........h..........Sh...........................................
(3 lines all free)
06c00: ....................hh..........h=....hh....hS....hSh=======....
(2 lines all free)
07800: ...........................h==============h=====h===h=======h===
07c00: =======h=======h=====h==h=====h==hh=====h=Shh=====h=Shh======h=S
08000: hh=h=h=h=h=h=h=h=h=h=h=h=h=.....................................
(4 lines all free)
09400: ....
>>>
/pyboard> ls -l
9288 Dec 31 1999 atticfan01.py
230 Dec 31 1999 boot.py
6204 Dec 31 1999 commands.py
342 Dec 31 1999 config-C0.json
342 Dec 31 1999 lib/
142 Dec 31 1999 main.py
1642 Dec 31 1999 mqttsetup.py
5432 Dec 31 1999 params.py
1021 Dec 31 1999 validaterange.py
/pyboard>
The project, BTW, is an attic fan controller that has internal/external temp sensors powered by solar and a DCPS. Based on temperature and time of day I'm switching between DCPC and solar. I have other features I want to add (Solar V sense) but I'm out of memory
I'm spitting the stats out to mqtt broker on my Synology NAS (docker image). It's all been working fine but I keep coming up with new great ideas to add! Trying to freeze a couple modules but they seem to be ignored in the build...