e4thcom not only supports include files but also Forth dictionary based requirements resolution. Consider the following code:

MARKER RAM\ \res MCU : STM8S103 \res export PB_ODR NVM : LED. on ( -- ) [ 0 PB_ODR 5 ]B! ; : LED. off ( -- ) [ 1 PB_ODR 5 ]B! ; RAM RAM\ \index LED. off LED. on

#require uses ' to test whether a word is in the dictionary. If it's not there (the error message remains hidden in the background) it looks in the e4thcom source search path for a file with the same name, loads, and compiles it. If the compilation was successful, it checks if the required word is there, and if not it even defines a dummy word to satisfy future tests. Cascaded includes are supported up to a nesting level of 16, and simply including a required word, or a "vocabulary" works well.

In the example above, the CONSTANT is already satisfied by the core (not loaded). MARKER, a feature for marking a part of the dictionary as temporary, and the static bit manipolation feature ( [ flag addr b# ]B! ), are loaded to RAM.

The named marker RAM\ allows for freeing up dictionary RAM (the STM8S003F3 has a total of 1024 bytes, and not much more than 500 bytes can be used as temporary dictionary). With the help of MARKER that's plenty!



The \res MCU: statement reads a resource definition file STM8S103.efr containing "<address> equ <symbol>" lines (and Forth comments). Definitions can then be exported one-by-one with the \res export statement to Forth CONSTANT definitions (CONSTANT compiles to LITERAL, so no additional runtime code is needed), and the words defined that way can be temporary.



e4thcom proviedes the \index statement for inserting strings into the command completion index. Typing LED<tab> finds LED.on, and then toggles between LED.on and LED.off.

The result of the above is two new words LED.on and LED.off with very compact machine code:

cold stm8eForth v2. 2 last @ 10 dump 92 C6 7 4 C 45 44 2 E 6 F 66 66 72 1 A 50 5 81 0 0 0 _LED.offr_P____ _ ok

The dump shows that the code above translates to a dictionary entry (e.g. LED.off) and the following assembly instructions:

LED.off: BSET 0x5005,#5 RET

Most of the above was made possible by the work, and active help with integration into STM8 eForth, from Manfred Mahlow, Forther, and author of e4thcom! According to him, the flexible usage of RAM as a unique feature of this tiny Forth solution. The combination the ALIAS feature has the potential to get even more out of 20ct µCs without sacrificing interactive development ( @RigTig ).



However, all of the above now also works using the codeloadTCP.py, part of the uCsim based build automation framework of STM8 eForth!



The combination of a convenient interactive µC programming environment (e4thcom) with Continuous Integration (codeloadTCP.py, uCsim, Docker, Travis-CI) is a new approach.



One of the things I'm now is on how to bring lightweight dependency management to more STM8EF (I'm looking into NPM's package.json, supported by GitHub).

