4 ms·
What a great read! I have to admit that I’m biased towards FORTH, I’m not a programar, more of a maker, so when I need to build an embedded project, Forth is my
by spaintech 4y ago
What a great read! I have to admit that I’m biased towards FORTH, I’m not a programar, more of a maker, so when I need to build an embedded project, Forth is my go to solution form my application. One of the benefits I have found in Forth “in my opinion” for embedded is factoring your code so that you only leave on the stack what you need, this makes for very compact machine code, great memory economics, and a relative fast system, even compared to C native code.
Working interactively with the HW is on of the most rewording parts of FORTH for me, to see the actual value of the bitfield you are using is great to trouble shoot new HW, and figure out just what you are doing.
One of the things I wish the FORTH community would do a better job of is, while keeping the interactiveness of Forth for development on the HW, it would be great to have a portable “true Forth VM” that you can take to a new platform and deploy a precompiled virtual Firmware or ROM. This IMO is beneficial for two reasons, you gain portability as the combined Froth adheres to the VM, and you can just take what you needed to the platform you are targeting, no need to have all the parts of a FORTH REPL or compiler. Just burn the App FW (VM + App) and you are done.
This would also allow for a single instance of FORTH, in the sense that your code will be portable across all systems, as the core compiler and interpreter are all targeting the VM and not the HW. Rather than build “ A Forth “ for each systems, you add the “HAL” that allows you to compile the VM for the HW. I use mostly ARM with Mecrisp, so I kind of have that now. Hint, it’s what make “arduino” so popular…
I highly recommend FORTH for Embedded applications, as I have build even a very BASI PID with little efforts… but it is a low level effort, and if you enjoy Bare-Metal development, you will be right a home in FORTH, if you are dependent on upstream libraries and HAL, you will, IMO struggle in FORTH regardless.
- harryvederci 4y agoNot sure if this is useful for hardware, but there's UF [0] for Uxn [1], a tiny VM that can you can get to run on lots and lots of (old and new) devices. [0]: http://www.call-with-current-continuation.org/uf/README http://www.call-with-current-continuation.org/uf/README (git repo link at the bottom of that page) [1]: https://100r.co/site/uxn.html https://100r.co/site/uxn.html