Relaunching a spin cog to run pasm. variable preservation.
marzec309
Posts: 146
If I relaunch a cog to run PASM what is the best way to preserve the variables setup in Spin? As these are being used by other cogs. My current Object is writen in spin and has proven to be to slow. If I coginit on the current cog would it trash these variables in hub ram?
Comments
From my actual knowledge (wich can be improved quite a lot) I always use cognew to be sure the prop-chip itslefs manages completely which cog to use for what
best regards
Stefan
-Phil
Ya that's how I would have done it. I just mentioned cog 0 because that's is the cog its running on, as its the one the propeller booted on start up(the top most object) and thus were my uncertanty started.
@Phil That would be exactly my situation. At the time this instrucion would exicute all eight cogs are running. The only cog availabe for reperpousing would be the calling cog.
Sorry for any typos or grammer mistakes I'm using my phone don't have access to my laptop at the moment.
This shouldn't be to difficult to port to pasm. but what is this LMM you are refering too?
Ya here is the code: I'm porting the PRI Sort to PASM to be relaunched into the same cog. I know how the get the address of the global variables into PASM, Can I Pass the address of the constants to the PASM routine or even use those constants in PASM and have the compiler do it for me?
This is how I'm trying to get the variables into PASM:
Was not sure how to get the predefined constants into PASM.
The only issue I see with the sort method is the waitcnt target which may have to go into a constant pool in your cog image.
OK, I tried to use the variables as they are, it will not compile. Could you tell me what I've done wrong? can i use "test" with two variables?
I am presuming you do not have a spare cog??? If you do, then what you are trying to do would be relatively easy in another cog running pasm, without the need to relaunch it.
No, I don't have a spare cog and thus why I'm having difficulties. the use of LMM is very interesting.
Thanks I'll try reading them into a temp variable first. I didn't think mov CycleTime[n], phsa was valid ether, I just figured i would cross that bridge when I got to it. Sloppy I know
That is OK, What I wrote isn't useless, I just have to set up my variables and append my code a little. I should be able to make it work. Even having to read the variables from the hub ram, it should be a lot faster than its SPIN equivalent.
was trying to write a decimal 1 to address @status along with dec 2 later on.
I understand what you said about: But i don't understand this at all
That said, you can't do wrlong #1, addr. It has to be along the lines of So instead of defining two new register constants (for 1 and 2) the code below uses existing instructions where it knows that the lower byte (source for wrbyte) has the appropriate value. I probably get -10 points for doing (or even suggesting) it but I think it's useful.