Python objects in ROM?
Posted: Mon Oct 06, 2014 5:55 am
Hi, we will have about 6000 lines of python code ported from another project, which we would like to move to the micro-controller. It will run out of RAM memory during compilation. We could write it as C libraries, but then we would have no benefit of Python. What is the best approach to pre-compile python (any micro python variant of compiled code will do) and put it into ROM (I mean flash, but not the file system /flash as I don't believe it supports Execute In Place?)
1. How do we get pre-compiled python? (Can we trick the board to emit compiled bytes on to the serial port? Can the unix version emit such code?)
2. How do we put it in ROM? (Should we make an assembler-file with just databytes out of it and link as the C-libraries)
3. How do we get micro python to find it for our real .py files when they use import?
4. Can this be done for immutable datastructures as well?
Is there a high level description of the compile/emit/import stages of micropython? The parser is described here in the link below, and the article ends with an "next is compiler and code emitters.." but I can't see that those articles were written?!? https://www.kickstarter.com/projects/21 ... sts/669549
Thanks for any help to put me in the right direction /Anders H.
1. How do we get pre-compiled python? (Can we trick the board to emit compiled bytes on to the serial port? Can the unix version emit such code?)
2. How do we put it in ROM? (Should we make an assembler-file with just databytes out of it and link as the C-libraries)
3. How do we get micro python to find it for our real .py files when they use import?
4. Can this be done for immutable datastructures as well?
Is there a high level description of the compile/emit/import stages of micropython? The parser is described here in the link below, and the article ends with an "next is compiler and code emitters.." but I can't see that those articles were written?!? https://www.kickstarter.com/projects/21 ... sts/669549
Thanks for any help to put me in the right direction /Anders H.