Frozen Byte Code

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
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Frozen Byte Code

Post by Roberthh » Fri Jun 03, 2016 9:00 am

Pull request 2067, which allows to store modules with frozen byte code into Flash, seems to work well. It would be very helpfule for all people fiighting with memory error during import to officially commit to PR. For trial, you could simply apply the changes to Makefile and mpconfigport.h manually, but it's more convenient to have that in the standard branch.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Frozen Byte Code

Post by dhylands » Fri Jun 03, 2016 7:40 pm

You can create branches for PRs by doing the following:

Code: Select all

git fetch origin pull/2067/head:pr-2067
get checkout pr-2067
The pr-2067 portion is arbitrary and you can use any name you like for the branch name.

This also assumes that "origin" is the remote for the micropython repository (some people make origin point to their own fork of the repository and use a different name for the micropython one).

ideal2545
Posts: 12
Joined: Tue May 17, 2016 9:08 am

Re: Frozen Byte Code

Post by ideal2545 » Fri Jun 03, 2016 10:06 pm

a little new to this still... what is 'frozen byte code' - or is there a good resource for me to read up on it? I am having some issues importing modules so I'd appreciate it.

Thanks
Jon

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Frozen Byte Code

Post by dhylands » Sat Jun 04, 2016 3:55 am

The normal process is that the python code is read into RAM, compiled into bytecode in RAM and executed from RAM.

Frozen python code, is python source code that is stored in flash (instead of RAM).

Frozen bytecode is python source code that has been compiled (on a host computer) and stored into flash.

So frozen bytecode doesn't consume RAM to store the bytecode.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Frozen Byte Code

Post by Roberthh » Sat Jun 04, 2016 6:15 am

Hi Dave,
I know how to deal with that PR, but I think it's an useful feature for all of us, so it's worth to be included in the master branch. like it is on Pyboard, especially since many posters hit the 'memory wall'.
And one should mention, that frozen byte code like pre-compiled byte code also helps when running out of memory during import. Surely, the code handling and testing less comfortable, but at least you can run your programs.

Post Reply