Loading code and executing it
Aaron193
Posts: 27
Hi, everyone--
I'm having a load of trouble with loading code from an external source and executing it. My goal is this: I have a separate program compiled into a binary or other form that is loaded into the RAM during bootup. During the main program, I want a cog to find that code and execute it as if it was part of the main program, much like the PropDos "Spin" command does. How should I go about doing this?
For instance: I have a "pub" function called echo. I want to move this function to a separate file and load it onto EEPROM so it can be loaded into the Propeller's RAM during runtime and then executed as if it was part of the original code. Is this possible?
Aaron.
I'm having a load of trouble with loading code from an external source and executing it. My goal is this: I have a separate program compiled into a binary or other form that is loaded into the RAM during bootup. During the main program, I want a cog to find that code and execute it as if it was part of the main program, much like the PropDos "Spin" command does. How should I go about doing this?
For instance: I have a "pub" function called echo. I want to move this function to a separate file and load it onto EEPROM so it can be loaded into the Propeller's RAM during runtime and then executed as if it was part of the original code. Is this possible?
Aaron.
Comments
Short Answer: No. It is not a feature of any currently available tools.
Long Answer: Yes.
But it's a lot of work and something I actually started work on last week .
This idea is the basis of my "BigSpin" VMM project which is slowly coming together.
Hacking the function or the interpreter so that all references to object variables are correct is tough so far.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, RamBlade, TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80), MoCog (6809)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
http://forums.parallax.com/showthread.php?p=738145
Yep, you can. The above link shows how you can load a complete .binary image anywhere in available ram and start it in a separate cog while keeping your original code running.
It's not elegant by any stretch of the imagination and you'll need to ensure you keep your memory spaces separated properly (or get really funky and use some designated memory for IPC), but it certainly can be done easily.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<This space for rent>