Where does a PUB go to die?
K2
Posts: 693
in Propeller 1
If a "start" PUB is used to launch a few pasm cogs and nothing else, what does the cog running SPIN do after that? Is there a lower power way to put that cog to sleep, such as by doing an endless waitcnt? Should I actually release that cog? If I release that cog will the registers defined in VAR go away or be corrupted? Guess I'm not even sure how I'd release the boot cog.
Comments
Generally, you are starting other cogs from Spin which is loaded into cog 0 on boot-up. If you want to start another cog, and then kill the boot cog, you can. Here's a simple little demo. The launched cog is Spin, too, but that doesn't matter; notice how it uses cogstop(0) to kill the boot Spin cog.
Global vars will not be modified.
EDIT Not that it really matters unless cog0 will be re-used after it finishes.
The cog stops itself when it reaches the end of the methode, you need nothing special to do for that. More lowpower is not possible.
The VAR section is allocated in HubRam at compile time. It just stays allocated but is no longer accessed by this cog. Local Vars are on the stack so that memory will be reusable after termination.
Spin does not use any Cog memory for variables.
Andy