scripts in flash

111 views
Skip to first unread message

Simon Najman

unread,
Dec 4, 2013, 6:43:03 PM12/4/13
to python-o...@googlegroups.com
Hi again,

is it possible to somehow use ipm (i have v10 version) to load scripts (from pc, with uart) but keep loaded scripts in program memory, not in RAM (ipm is working, but scripts are gone when power is down)?

Thank you

Dean Hall

unread,
Dec 4, 2013, 10:59:20 PM12/4/13
to python-o...@googlegroups.com
There is not a ready-made solution in place for this.
But the tools are there if you can handle a DIY project.

Explanation is found in this document in the repo [branch v10]:
docs/src/PlatformMarshalledModules.rst

You would have to create
1) the way to get the marshaled script into the flash
and
2) the way for plat_loadCodeObject() to find the start address of the marshaled script in flash.

regards,

!!Dean
> --
> --
> You are subscribed to the "python-on-a-chip" (or p14p for short) Google Group.
> Site: http://groups.google.com/group/python-on-a-chip
>
> ---
> You received this message because you are subscribed to the Google Groups "python-on-a-chip" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to python-on-a-ch...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Simon Najman

unread,
Jan 8, 2014, 7:16:20 AM1/8/14
to python-o...@googlegroups.com
For now, im having marshal (.pmm) script on SD card, which is then imported and executed. My question is, is it possible to somehow avoid limitation of script size (~2 kB) i'm getting error when my script is bigger than that

Dean Hall

unread,
Jan 8, 2014, 8:41:24 AM1/8/14
to python-o...@googlegroups.com
Congrats on being the first person to report running into that limit!
The reason for that limit is that the object descriptor only has 9-bits available
to hold the size of the object and uses two implied least-significant bits (0x1FF << 2 == 2044).

A workaround would be to split your script file into multiple files so each one is under the 2044 byte limit.
Sorry, I know that won't be easy, but it's the best idea I have right now.

!!Dean

Simon Najman

unread,
Jan 8, 2014, 3:47:41 PM1/8/14
to python-o...@googlegroups.com
If scripts were marshaled and stored in flash , would this limitation disappear? 
Thank you very much

Dean Hall

unread,
Jan 8, 2014, 9:24:18 PM1/8/14
to python-o...@googlegroups.com
No, the same object descriptor is used regardless of storage medium.

Only adding the scripts to the VM build will break up the module into smaller objects for storage in flash.

!!Dean
Reply all
Reply to author
Forward
0 new messages