-
Notifications
You must be signed in to change notification settings - Fork 66
STM8 eForth FAQ
Thanks for asking :-) One answer is here. Other authors and contributors found the minimal system intriguing/useful/funny or otherwise interesting, and that's how this Forth system came to be.
You can certainly use such a small µC for interactive development and get something done. If your embedded application benefits from "interactive" properties (e.g. scripting, parameters, in-field adaptations) you'll be surprised how far you'll get by programming "the Forth way"!
You need an STM8 board, an inexpensive programmer, and a serial terminal program. Refer to the Breakout Boards page for details, or open an issue if you have more questions.
After defining words in NVM
mode you need to "persist" temporary dictionary pointers by using the word RAM
or WIPE
. Otherwise the core variables CONTEXT
and LAST
won't be saved to Flash memory, and after the next reset the new dictionary entries will be lost (see issue #153 for details).
In order to save memory space many of the original STM8EF words have been removed from the dictionary. The "unlinked words" can be accessed with the alias definitions in out/<BOARD>/target
, which is very easy to do when you use e4thcom or codeload.py
(just type #require mymissingword
). It's also possible to keep dictionary entries for the hidden words in the EEPROM. Please refer to the details in Using Alias Words.
It's also possible to build targets with a different selection of words linked to the dictionary (see here for a complete list of words, and here for an example configuration). Please refer to issue #152 for a detailed discussion.
No, that's not possible by "virtue" of the STM8 memory bridge, and attempting to do that will cause a reset (unless you copy it to the Flash or RAM).
However, the STM8 eForth ALIAS feature allows storing dictionary entries in the EEPROM, which will free up Flash memory for storing code. Please refer to lib/EEALIAS, example STM8 eForth EECORE configuration, and explanation on HaD.
RAM is a scarce resource in a low-end STM8S device, and therefore a quota of just 32 bytes RAM is reserved for the VARIABLE
definitions in a COLD
or WIPE
cycle. However, you can define as much as you like (within the limits of your device, of course) if you don't use the allotting RAM in after defining it, but start a new cycle instead, e.g.:
#require WIPE
NVM
32 CONSTANT P0_WIDTH \ bytes in a payload. 1-32 bytes
VARIABLE MYBUFF P0_WIDTH 2- ALLOT
VARIABLE RXBUFF P0_WIDTH 2- ALLOT
WIPE
Yes, that's easy to do. You can even make autostart applications that still have an interactive console by running your application in the background or in a idle task.
That's simple: just raise an issue and ask your question.