Using coginit to start spin from assembly.
artlogic
Posts: 4
I'm very new to the propellor and have been reading over all the documentation. I was wondering if someone could help me answer the following question? The manual states:
Now, after reading the forums for awhile and looking over the source code from some other projects, it seems like I could copy a spin program out of EEPROM into hub memory, and then simply perform a coginit that points at the spin interpreter ($F004). Is there any reason why this would be a bad idea or may not work as expected?
Thanks for the info.
Propellor Manual said...
It is not practical to launch Spin code from user’s Propeller Assembly code; we recommend launching only assembly code with this instruction.
Now, after reading the forums for awhile and looking over the source code from some other projects, it seems like I could copy a spin program out of EEPROM into hub memory, and then simply perform a coginit that points at the spin interpreter ($F004). Is there any reason why this would be a bad idea or may not work as expected?
Thanks for the info.
Comments
Anyhow,
(1) The SPIN program must have a valid format (special header and trailer)
(2) AFAIK the PAR value for activating the SPin interpreter is not documented, but try it with zero
(3) Note that the SPIN interpreter is started in two different ways:
- from the bootloader (which IS an asembly program)
- from other SPIN code via PARNEW(proc(..), stack) where some voodoo is hiden wrt finding the entry point and context of "proc" as well as its parameters
Post Edited (deSilva) : 9/15/2007 6:31:06 AM GMT
1. If the SPIN program was made by the prop tool - just a binary image - it seems like it would already be in that format. Does the boot loader do something other than a straight copy from eeprom to hub ram when loading?
2. I can see your point with the PAR value - I imagine it points to stack space and optional parameters - does anyone know for sure?
3. I assume you mean COGNEW and not PARNEW.
Hopefully I'll have some sort of prop. in a couple of weeks - until then thanks for being patient with my questions.
Your questions are welcome and they are in fact interesting. I am looking forward to someone who might know some answers to it.
One of the problems with Parallax documentation are thing like this "..It is not practical to launch Spin code from user’s Propeller Assembly code.."
This is not the kind of information I expect from a manual