What is it good for?
The project deliverables are configurable board support code as source and binary
release for "interesting targets" and documentation. Using the code for
specific embedded control applications is subject to new projects.
The code provided in this project can be used in many ways:
- for embedded systems with an interactive core (scriptable and extensible),
- for creating smart SPI, I2C, or RS232 connected peripherals with a scripting shell, e.g. for RaspberryPi, Arduino, or ESP8266,
- as an interactive environment for exploring the STM8 architecture,
- for learning Forth,
Why a Forth for Cheap Chinese boards?
Because it's fun: cheap mass-produced imperfection is a playground for creativity :-)
Right now, the W1209 is my favorite target: it's a rather complete embedded control board with a UI at a very good price. It's as cheap as it looks and obviously the challenge is in it's imperfections: the guy who designed the board clearly didn't have a connected application in mind, and I had a lot of fun making it do things it was never intended to do.
There are still challenges, like the lack of communication ports. The "sensor connector" can either be used for communicating, or for sensing. What if you need sensing and communication at the same time? Maybe the "update connector" can be used as a home brew field bus interface? A lot is possible with the right idea, and the right software!
The ESP-14 (ESP8266 and STM8S003F3P6) is in the queue but the requirements for this one are a bit more involved (e.g. power supply). Please drop me a note if you're working on the ESP-14.
Which target boards are supported?
Besides generic CORE target for STM8S003F3P6, there is currently support for the following boards:
Read more about likely future targets below.
Again, because it's fun!
- compared to other programming environments the core of Forth is easy to fully understand
- like Lisp Forth has a REPL (Read-Evaluate-Print-Loop) which enables software testing in a way impossible with "Edit-Compile-Run-Debug" (e.g. Arduino)
- it's easy to build Domain Specific Languages (you can literally program the compiler!)
- the stack-centered "factoring" approach provides implicit data flow which leads to maintainable code
- Interpreter-compiler, basic OS functions fit in just 4K code :-)
Forth starts out as a stack machine with a tiny instruction set and minimal hardware requirements. It fits
in a few KiB, and the target, even a lowly µC, can even be used as the development system.
the Forth stack machine is a minimalistic VM on a standard CPU but hardware implementations also exist (e.g. for a modest FPGA, or as a 144 core Forth processor). The VM is ideal for fast context switching, thus Forth easily meets hard-real-time requirements. It's no surprise that Forth was used in
many NASA projects.
A Forth programmer is in control of all levels of problem
abstraction, a unique advantage in a world where layer on layer of 2nd
hand solutions leads to ever growing complexity (compilers, libraries, operating systems,
drivers,frameworks, IDEs... ). I'm convinced that "Thinking Forth" will make anybody a better programmer, not just in the
domain of embedded control!
Why STM8S003F3 or STM8S103F3?
Low-end "STM8S Value Line" STM8 µCs are very cheap (less than $0.25 in hobby quantities), and that's why they appear in many cheap gadgets:
- a simple STM8S103F3P6 breakout board costs less than $0.70,
- a W1209 thermostat (STM8S003F3P6, relay, 3 digit display, 3 keys) costs...