wokwi / wokwi-features

Wokwi Feature requests & Bug Reports
https://wokwi.com
73 stars 17 forks source link

Please support to compile and run ESP32Forth #227

Closed hemmerling closed 2 years ago

hemmerling commented 2 years ago

Please support to compile and run ESP32Forth

https://esp32forth.appspot.com/ESP32forth.html https://eforth.storage.googleapis.com/releases/ESP32forth-7.0.5.4.zip contains the single file.

ESP32forth.ino which is a Forth written in Arduino-C to run on ESP32 Chips in general. No special Arduino ESP32 adoption, so far.

I was able to import the file into the IDE, but compilation fails.

  1. Please extend your emulation so that a "keyboard" and a "terminal" is supported and provided as visual tool. Forth is an interactive language, with embedded systems, so it wants to communicate by serial line with another computer running a "terminal" application, e.g. like "PuTTY" on Windows. So a serial port of ESP32, selectable by the developing user, should be connected to a virtual terminal, with VT100 emulation, virtual display on the browser screen, with option to enter text from the real Windows/Linux keyboard which run the browser, and it shall display text send by the serial device.

  2. Please check why the compilation of ESP32forth.ino fails, and if possible extend your system so that it can´t be compiled properly. First not accepted statement is

define n1 (*sp)

Line 114 Compiler comment: ESP32forth.ino1 of 38 problems invalid conversion from 'cell_t' {aka 'int'} to 'void*' [-fpermissive]

Sincerely Rolf

urish commented 2 years ago

Hi,

I was able to get it to compile after disabling the I2C support (commenting out #define ENABLE_I2C_SUPPORT). It seems like the current I2C support is not compatible with the latest Arduino core for the ESP32 (some methods like readTransmission/writeTransmission were removed, and ESP32Forth wasn't updated to support these changes).

Here's the version that compiles:

https://wokwi.com/arduino/projects/315160775983366721

Currently, it fails with an error, which might have to do with the fact I disabled the I2C support. You can try tinkering with the code and see if you can pinpoint the reason.

You can also try to compile a version on your computer and load it into the emulator as a bin file.

As for the serial terminal, it's already supported. You can enable it by adding the following to your diagram.json:

  "serialMonitor": {
    "display": "terminal"
  }

See here for the documentation.