MemoryError: memory allocation failed, allocating 2048 bytes - LOPY - 1.2.0.b1



  • That sounds great. Hopefully, some of that stays available for user code.



  • @mkharibalaji, the FiPy comes with extra 4 megabytes of RAM to handle the extra requirements having 5 networks impose. Right now the LoPy available RAM is low compared to what is expected, but this situation should improve in future versions of the firmware.



  • Hello Hari,
    that's a good question. I'm a user like you, so I cannot tell. But given the rate memory is used for the firmware, we'll end up with a negative amount of free memory :-)



  • Thanks a lot @robert-hh I will give it a spin.
    And one more question - I have pledged Fipy in Kickstarter and if tte Lopy itself is going out of memory then how will be Wifi,Bluetooth,Lora,SigFox and LTE-M would be managed ?
    I am asking this question out of curiosity

    Many Thanks,
    Hari



  • The new release has cut back memory even more. Two options:
    a) go back to version 1.0.0.x
    b) use pre-compiled code.
    Option b is only helpful if you get the memory error during import.
    It is a little bit tricky. It requires you to build your own code from the github repository, by downloading and installing pycom-micropython and pycom-esp-idf. The respective directory is pycom-micropython/esp32. The make command would be:
    make BOARD=LOPY
    That is best done on a linux system. Once you managed to install the files and be able to create a build, add the following line to esp32/mpconfigport.h:
    #define MICROPY_PERSISTENT_CODE_LOAD (1)
    Then build the image again, and flash it to LoPy with
    make BOARD=LOPY flash
    Don't forget to connect GP23 and GND before flashing.
    You then have to create the cross-compiler, which resides on
    pycom-micropython/mpy-cross, just with a make command in the directory.
    You the can do a cross-compile with:
    ./mpy-cross your_code.py
    which creates a file named your_code.mpy
    Load that to your LoPy (e.g. using ftp or FireFTP), and import it like a normal Python source script. The difference is, that the compile step is performed on you PC and does not require RAM on you LoPy, which is normal exhausted first.


Log in to reply
 

Pycom on Twitter