FropForth 5.5 -- automatically execute a word on powering up the Propeller
LoopyByteloose
Posts: 12,537
Hi all,
I thought this was an established option in PropForth 5.0 and beyond, but I can't really find anything that seems as if it will do the trick.
What I am doing is writing an application that will be triggered by one word and run endlessly in an infinite loop until power is removed.
I'd like to have PropForth automatically start the program without outside input after it is powered up.
Do I have to modify DevKernel.spin to do this, or is there already an established feature that will create a word that will automatically run?
I thought this was an established option in PropForth 5.0 and beyond, but I can't really find anything that seems as if it will do the trick.
What I am doing is writing an application that will be triggered by one word and run endlessly in an infinite loop until power is removed.
I'd like to have PropForth automatically start the program without outside input after it is powered up.
Do I have to modify DevKernel.spin to do this, or is there already an established feature that will create a word that will automatically run?
Comments
Sorry,
onboot reads and executes boot.f if it exists.
onreset give a reset message.
I had this someplace, I just have to dig through some stuff to find it...
http://code.google.com/p/propforth/wiki/BootAnApplication
Please give that a look. I used that with the quickstart touch demo from caskaz, but it looks different than the onboot and on reset in propforth.htm. Its late here, and I might be confusing myself
I will look at what you have provided.
For the sake of clarity we can stick with 'loopyword' being the actual target word I want to execute, you seem to have used the alternative called 'onboot'. Since this will go into an infinite loop, there is no need to recover the to a Forth prompt, if that is yet another technical issue that might require more code.
The word 'loopyword' is a character string, but has an associated dictionary location identified as an address. At this point, I'd just like to have 'loopyword' setup to always execute on power up, regardless of the validity of the word's internal structure.
Could I just modify DevKernel.spin to always execute 'loopyword' upon starting, and then later either redefine or define loopyword to what I need?
In the first case, 'loopyword' could be included with the task that just outputs a message that it exists and is ready to redefine, Then I could later redefine as required
In the second case, with no 'loopyword' deifinition included in the starting lexicon-- the initiation process would just generate an error that 'loopyword' could not be located. Then I could for reboot add 'loopyword' to the existing dictionary via a 'saveforth'.
: booter onreset loopyword ; /create a call to loopyword when board resets
And then a 'saveforth' to write to EEPROM.
I will test this and let you know.
~~~~~~~~~~~~~~~
I am a bit wary of what 'onboot' is supposed to do. It seems to be just another way. The documentation is a bit sparse on both of these.
And though, there are called to load a boot.f file in some cases, I can't seem to locate the actual boot.f file to examine it.
This was simillar to the way the 'turnkey' works in other forths.
I understood ONBOOT to be the word call on power cycle and reboot, and onreset when a cog is reset. ONRESET0 through ONRESET7 would be the words called for the intdividual cogs. But looking at propforth.htm, it appears this might be ddifferent from how I thought I ubnderstood it.
I know this ability exists, its always in every forth I've seen, and it has been in propforth in previous versions. I must have missed ONBOOT changing so now it call boot.f
If you can't get it to work I will ask Sal next Sunday.
EDIT - boot.f is a file in the your file system ( for the EEProm kernel or SD kernel) and is that same as any other forth file, except this one is called automaticially. Its just a text find that is read by the interpreter, and can contain new definitions, and/or sequences of sero or more forth words to execute.
Maybe in the NON-file system kerrnel, onboot is still called, and just executes instead of calling boot.f. We would have to update the docs.
If needed, I can go with an EEPROM solution as the project is on a 64K EEPROM board, a Propeller QuickStart.
If I get something working well without the EEPROM or the SDcard, I will let you know.