{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/1811","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/1811/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/1811/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/1811/events","html_url":"https://github.com/micropython/micropython/pull/1811","id":130202724,"number":1811,"title":"Add ability to have frozen bytecode","user":{"login":"dpgeorge","id":6187689,"avatar_url":"https://avatars.githubusercontent.com/u/6187689?v=3","gravatar_id":"","url":"https://api.github.com/users/dpgeorge","html_url":"https://github.com/dpgeorge","followers_url":"https://api.github.com/users/dpgeorge/followers","following_url":"https://api.github.com/users/dpgeorge/following{/other_user}","gists_url":"https://api.github.com/users/dpgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgeorge/subscriptions","organizations_url":"https://api.github.com/users/dpgeorge/orgs","repos_url":"https://api.github.com/users/dpgeorge/repos","events_url":"https://api.github.com/users/dpgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/dpgeorge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-31T22:35:05Z","updated_at":"2016-02-26T14:05:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/micropython/micropython/pulls/1811","html_url":"https://github.com/micropython/micropython/pull/1811","diff_url":"https://github.com/micropython/micropython/pull/1811.diff","patch_url":"https://github.com/micropython/micropython/pull/1811.patch"},"body":"This PR brings proper frozen bytecode.  Bytecode is compiled using a \"MicroPython cross compiler\", and then frozen using tools/mpytool.py.  The output file is then a .c file that's compiled into your uPy binary.  Then \"import frozenmod\" works as expected.  The resulting frozen module requires zero RAM to compile (but does require about 1 GC block to hold the function object, although that could eventually be optimised away).\r\n\r\nThe main changes in the PR are:\r\n\r\n- support in core for frozen modules (including import and adding a new qstr pool for the frozen qstrs)\r\n- addition of top-level dir upy-compiler/ which contains an example cross compiler (that's real-world usable, just needs editing of mpconfigport.h to suit a given target)\r\n- minor modifications to minimal port to include an example of frozen bytecode (.mpy file is included so you don't need the cross-compiler to build it)\r\n\r\nOne thing to note is that MICROPY_MODULE_FROZEN has changed meaning, and all old uses of this macro should (and are in this PR) changed to MICROPY_MODULE_FROZEN_STR.  There is now also MICROPY_MODULE_FROZEN_MPY to support both original frozen strings, and new frozen bytecode/mpy files.\r\n\r\nQuestion: should upy-compiler be included? I think so.  What should the dir be called?  What should the executable be called (I just made it \"micropython\")."},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/189291864","html_url":"https://github.com/micropython/micropython/pull/1811#issuecomment-189291864","issue_url":"https://api.github.com/repos/micropython/micropython/issues/1811","id":189291864,"user":{"login":"dpgeorge","id":6187689,"avatar_url":"https://avatars.githubusercontent.com/u/6187689?v=3","gravatar_id":"","url":"https://api.github.com/users/dpgeorge","html_url":"https://github.com/dpgeorge","followers_url":"https://api.github.com/users/dpgeorge/followers","following_url":"https://api.github.com/users/dpgeorge/following{/other_user}","gists_url":"https://api.github.com/users/dpgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgeorge/subscriptions","organizations_url":"https://api.github.com/users/dpgeorge/orgs","repos_url":"https://api.github.com/users/dpgeorge/repos","events_url":"https://api.github.com/users/dpgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/dpgeorge/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T14:05:17Z","updated_at":"2016-02-26T14:05:17Z","body":"@chuckbook a failed assertion is bad.  If you can reproduce it then I can try to fix it."}}