jamesbowman / swapforth

Swapforth is a cross-platform ANS Forth
BSD 3-Clause "New" or "Revised" License
275 stars 56 forks source link

No documented way to run a word at boot #17

Closed RGD2 closed 8 years ago

RGD2 commented 8 years ago

There doesn't seem to be a way to save an image with #flash whilst a word is running.

Is there any mechanism by which a system image can be made that will be running a custom application word from startup, yet still be able to be connected to and stopped/restarted via shell.py for further work if necessary?

Without this, it's a bit difficult to deploy standalone, and to fix / debug after deployment.

jamesbowman commented 8 years ago

So to make a flash image that turns the LEDs on at boot:

:noname 31 leds quit ; init !
#flash build/nuc.hex

To make a flash image that continuously blinks the LEDs

: blink 0 begin dup leds 1+ 10 ms again ;
' blink init !
#flash build/nuc.hex

To make a flash image that blinks the LEDs on power-up, but on reset will run the command prompt:

:noname
    ['] quit init !
    blink
; init !
#flash build/nuc.hex
RGD2 commented 8 years ago

Thanks @jamesbowman , Exactly what I was after. :) I didn't know about the init hook.

Can we have the latex source added under /doc or j1a/doc somewhere so nuggets like this can be added into the user manual? (ie, so I can help with that?)

The clear, beginner friendly documentation for swapforth and it's toolchain, combined with it's openness and sheer speed are killer features. ^_^

jamesbowman commented 8 years ago

Yes, under j1a/doc/ is the manual source and the Makefile.