ForthHub / discussion

Discussion repository for Forth enthusiasts.
116 stars 4 forks source link

Forth for ESP32 #39

Open quozl opened 7 years ago

quozl commented 7 years ago

Mitch Bradley has ported C Forth to ESP32.

I have begun testing. My build steps on Ubuntu;

Hardware so far is;

Any other Forth implementations for ESP32 yet?

jamesbowman commented 7 years ago

Yes, swapforth has a port:

https://github.com/jamesbowman/swapforth/tree/master/esp8266

It's a bare-metal subroutine-theaded Forth. It currently passes the ANS compliance tests. The difficult part (for me, at least) is providing a Forth interface to the various APIs that are in the SDK. They're gnarly.

MitchBradley commented 7 years ago

Thanks for the announcement James.

As it turns out, I was in the process of composing an announcement myself, so I'll just fill in some blanks here.

ESP32 is an extremely cost-effective dual-core 32-bit, 240 MHz, processor module with 512KB RAM, 16 MB FLASH, WiFi and Bluetooth. Modules can be had for US$4 to US$8, and development boards for US$15 to US$20.

The current state of the port to the module is fairly rudimentary, with "ok" on serial console and file access to SPI FLASH. The WiFi and Bluetooth interfaces are not yet present, but will eventually be supported based on similar features in other CForth ports.

CForth is a full-featured, stable ANS Forth system with extensive debugging tools. It has been in active development for 35 years.

I have been building on Windows using the msys2 tools recommended by esp-idf, testing on the Adafruit board cited below.

Mitch

MitchBradley commented 7 years ago

Yeah, gnarly is a good description of those APIs.  It was even worse for the ESP8266 because of the event-driven callbacks.  ESP32 should be easier, given the possibility of using the second core for a Forth thread.

MitchBradley commented 7 years ago

On the topic of Bluetooth APIs, I'll offer some recent experience. A couple of years ago I was using CForth under Linux on a Raspberry Pi, building a manufacturing test station for a Bluetooth LE gadget. I started out using the BlueZ API, but kept having trouble with conflicts between the framework's event handling and the control flow of the Forth application. I eventually switched to having Forth get raw L2CAP packets directly from a socket, letting Forth do all the packet decoding above that level. That solved all the problems.

The code is in https://github.com/MitchBradley/cforth/blob/master/src/app/bluez/bluetooth.fth

quozl commented 7 years ago

@jamesbowman, thanks for the link to swapforth. I've looked through the esp8266 directory but can't find anything to build on esp32. I did find the esp8266 bootrom disassembly interesting.

anse1 commented 5 years ago

These chips are intriguing… some of those boards are actually cheaper than hooking the cheapest bluetooth uart to a msp430 for a wireless forth experience. Did some new ports happen since 2017?

DRuffer commented 5 years ago

China got busy: https://www.seeedstudio.com/Sipeed-Maixduino-Kit-for-RISC-V-AI-IoT-p-4047.html

MitchBradley commented 5 years ago

cforth (https://github.com/MitchBradley/cforth) runs pretty well on ESP32. It has interfaces to the SDK socket layer and I2C. It should be easy enough to add bluetooth interfaces via cforth's C-to-Forth gateway mechanism, assuming you understand bluetooth. cforth has some bluetooth app code that runs on top of other cforth ports that could be used as examples. It's not comprehensive; I didn't try to handle every possible bluetooth device, but focused on the task at hand at the time, which was talking to a BLE IoT gadget.

MPETREMANN11 commented 3 years ago

Hello, I am starting to get started with ESP32forth produced by CH TING and completed by Brad NELSON. It is a FORTH rather than complete. It even integrates a "TELNET Daemon" and an "HTTP Daemon". In short, you have an HTTP server in the ESP32 card! Access ESP32Forth web UI: https://arduino-forth.com/article/ESP32_installation_accessWEBUI BR

quozl commented 3 years ago

Where's the source code?

It is odd that, per the serial port output, mDNS is started and yet the instructions say to use IP address instead of mDNS host name, and further on the instructions show how to add the IP address to a router DNS.

In theory all it takes is to include the mDNS header file, then call MDNS.begin with a hostname, call MDNS.addService with a port, then call MDNS.udpate in the main loop. After that, the user should be able to telnet to hostname.local on port 23 or access http://hostname.local/

Perhaps I'm misunderstanding. Hence the question about how to find the source code so I can check it.

RGD2 commented 3 years ago

I think the source is somewhere around here: https://github.com/flagxor/eforth/tree/main/ueforth/

On Sat, 12 Jun 2021 at 7:33 pm, James Cameron @.***> wrote:

Where's the source code?

It is odd that, per the serial port output, mDNS is started and yet the instructions say to use IP address instead of mDNS host name, and further on the instructions show how to add the IP address to a router DNS.

In theory all it takes is to include the mDNS header file, then call MDNS.begin with a hostname, call MDNS.addService with a port, then call MDNS.udpate in the main loop. After that, the user should be able to telnet to hostname.local on port 23 or access http://hostname.local/

Perhaps I'm misunderstanding. Hence the question about how to find the source code so I can check it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ForthHub/discussion/issues/39#issuecomment-860028253, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXT4GBPRACGDSON3LNJQQTTSMSYDANCNFSM4C3UNAQA .

-- -- Remy

quozl commented 3 years ago

Thanks! According to the source code, and documentation, the system should respond to a URL of http://forth

https://github.com/flagxor/eforth/search?q=mdns

So if original poster couldn't make that work because of missing operating system and browser support, it is reasonable to use IP address and manual DNS registration. Way easier to use mDNS though, if they can.