Manfred Mahlow published version 0.8.5 of the embedded Forth terminal and programming tool e4thcom which introduces the source file level keywords #ifdef <name> and #ifndef <name>: they make e4thcom check if <name> is defined in the target dictionary and transfer the rest of the line on that condition
The following example shows the source level keywords supported by e4thcom and codeload.py :
#include hw/pd8544.fs \ unconditional uploading #require ALIAS \ conditional uploading if the word ALIAS isn't in the dictionary \res MCU: STM8S103 \ use the STM8S103.efr symbol/address file \ get GPIO registers addresses, insert definitions like `hex 5000 CONSTANT PA_ODR` \res export PA_ODR PA_IDR PA_DDR PA_CR1 PA_CR2 #ifndef OUT! \res export PB_ODR #ifndef OUT! : OUT! ( f -- ) PB_ODR 4 B! ; \\ ignore the rest of the file
This feature is useful for testing target properties while sending code to the target. Writing device independent low-level code is among possible use cases.
The codeload.py in the STM8 eForth tools folder, very useful for transferring code to the target from the command line, now also supports this feature. There are some more improvements, e.g. better newline handling, better error messages and support of Python3 by default.