Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
PunyForth programming language for the ESP8266 (github.com/zeroflag)
85 points by type0 on Sept 5, 2018 | hide | past | favorite | 12 comments


One thing I really want for the ESP8266 is REPL-over-WiFi with persistence. MicroPython doesn't seem to have this AFAICT and from the docs Forth doesn't either. Does anybody know of an environment for the 8266 that has a feature like this? I don't really care if the language is Forth or Lisp or Python, but I'd like to be able to modify a live running environment on an embedded device over the network.


Micropython does have a Wifi REPL, although it's not enabled by default:

https://docs.micropython.org/en/latest/esp8266/esp8266/tutor...


Yep, and it works really well. You can even send arbitrary files to the device over the webrepl.


Hey, you can access the PunyForth over a TCP session (as implemented here: https://github.com/zeroflag/punyforth/blob/master/arch/esp82...). Not sure what you mean with "persistence", you can write to memory in one session, and read back in another? Or are you talking about the stack here?

EDIT: swapped for correct URL


I mean that I would like the running image I am building in Forth to persist in non-volatile storage (so if I power the device off and back on, the program remains). Is this possible?



This is fantastic! I'll be flashing this on one of my Wemoses tonight!


What does "stack" mean in this context? TCP stack or Forth stack?


I was referring to the Forth stack in my question about what was ment with persistence in this particular case.


That sounds like an awesome idea. I think I know what one of my first ever embedded projects might be...

One of the first things that comes to mind with such a system is security. After thinking about this for a few minutes I think the best general-purpose safe solution would be a button and a switch that requires the button to be pressed whenever a new TCP connection is accepted if the switch is "on", the idea being that you switch security off for repeated reconnects and back on once the device is shoved somewhere inaccessible.

The ESP8266 apparently offers TLS 1.2, and that would probably be the best production solution, but I mention the above as a dead-simple fallback that requires very little program memory, would be simple enough to implement in an hour even if you have absolutely no idea what you were doing, and involves buttons and switches :P


If you're not into the ESP8266, there are some good Forth implementations for other types of microcontrollers:

ARM Cortex-M0/M3/M4/M7 (STM32, Teensy, etc.) and TI MSP430: Mecrisp-Stellaris - http://mecrisp.sourceforge.net

Atmel 8-bit AVR: AmForth - http://amforth.sourceforge.net


Indeed! Here's two other ones that proved useful and interesting to me:

ARM7/9 types (Cortex like STM32, several NXP LPC, ...): Riscy Pygness - http://pygmy.utoh.org/riscy/

Microchip PIC18/24/30/33 and Atmel Atmega: FlashForth - http://www.flashforth.com/

Enjoy!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: