Carefull with F10 !
Rayman
Posts: 14,877
I don't know how many times I've accidentally launched a driver .spin file instead of the main one using the Propeller Tool...
It's usually not a problem because nothing happens, and then I realize what I've done.
But, with my RGB matrix driver, I've found that launching the driver by accident can have serious consequences...
Actually, when I look how a lot of assembly drivers are written, thier first PUB routine often launches a new cog based on some argument.
But, the Prop Tool will just compile and launch this code as the MAIN routine even though not given an argument...· It would seems that
some dramatically incorrect things could happen at that point...
I'm starting to think this is not such a good idea...· I think the Prop tool should be smart enough not to launch a spin file
where the first routine has an argument...
Anyway, my workaround is to put in a:
line in front of the "Pub Start" line so that nothing happens if you make a mistake and hit F10 while editing this file...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
Post Edited (Rayman) : 3/3/2010 1:53:45 AM GMT
It's usually not a problem because nothing happens, and then I realize what I've done.
But, with my RGB matrix driver, I've found that launching the driver by accident can have serious consequences...
Actually, when I look how a lot of assembly drivers are written, thier first PUB routine often launches a new cog based on some argument.
But, the Prop Tool will just compile and launch this code as the MAIN routine even though not given an argument...· It would seems that
some dramatically incorrect things could happen at that point...
I'm starting to think this is not such a good idea...· I think the Prop tool should be smart enough not to launch a spin file
where the first routine has an argument...
Anyway, my workaround is to put in a:
Pub Dummy
line in front of the "Pub Start" line so that nothing happens if you make a mistake and hit F10 while editing this file...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
Post Edited (Rayman) : 3/3/2010 1:53:45 AM GMT
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
As part of the load the loader zeros all ram, and then creates the 2 longs on the start of the stack. The remainder of the stack stays 0, so when the first pub method is launched all parameters would be 0.
I stick a pub method up front in all my drivers that puts the driver into a safe test routine. That way I can test the driver while I'm working on it without having to compile the main program, and it's always assured of being in a known, sane state.
When the main program is compiled, the first pub method in the driver is unreferenced and the compiler simply leaves it out, so there is no memory penalty [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
For this very reason early on it was suggested that the first PUB should be a 'PUB STOP' rather than a 'PUB START' as a means for 'good programming practice'.· It just never really has caught on.· I try to implement the practice·in my own code, but there are sometimes exceptions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
lol ... nothing is written in stone,· It's just a good programming technique/habit designed·to avoid this particular situation from happening.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
This IS a pretty good idea.
I myself thought about this situation, and have run programs accidentally like this, but nothing bad happened to my props or parts. And the platform that I was doing this on has leds connected to two prop pins with only 22ohm's of resistance.
-Phil