A89: Running PIC programs from archive?
[Prev][Next][Index][Thread]
A89: Running PIC programs from archive?
Has anyone tried to run PIC (=Position Independed Code) programs directly
from archive FLASH? I know the shells can use archive but at least
DoorsOS 'cheats': It just copies the program out of archive and stores it
back afterwards.
AFAIK the variables are archived 'as is', no compression or anything. The
position is FLASH is uncertain and it can change during garbage
collection. Because we can't easily rewrite FLASH, we can't relocate the
code properly but with PIC we don't need to.
PIC eats some performance but I don't think it's a major problem. And it
would allow everyone to use the archive FLASH without purchasing any
stupid licenses. (Though only up to the archive memory limit, apps
memory on HW1 remains still unusable)
Using PIC will require some changes in the way that programs are made,
though. Since the program would be in FLASH variables can't be stored
_in_ the programs. Two simple solutions would be to
1) Use stack. Just create stack frame and store variables there. Stack
is specified to be 16kB(?), with unknown amount used. Does anyone know
how to check how much stack is left?
2) Allocate memory and use it. This is safer since stack can overflow and
crash the calc.
I don't think that any libraries will work either because they also can't
be linked properly. Though PIC program could itself locate and call a
library.
Comments? Am I making any sense?
- Riba