-> ESP32forth

This commit is contained in:
Brad Nelson
2021-02-11 22:59:21 -08:00
parent bec1979579
commit e93a62e0af
8 changed files with 34 additions and 30 deletions

View File

@ -1,3 +1,5 @@
VERSION=7.0.1
OUT = out
GEN = $(OUT)/gen
RES = $(OUT)/resources
@ -51,7 +53,7 @@ WIN_LFLAGS64 = /LIBPATH:"c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib
TARGETS = $(WEB)/terminal.html \
$(WEB)/ueforth.js \
$(POSIX)/ueforth \
$(ARDUINO)/ueforth/ueforth.ino
$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
FINDQ = find 2>/dev/null
@ -239,39 +241,41 @@ $(WINDOWS)/uEf64.exe: \
# ---- ARDUINO ----
$(ARDUINO)/ueforth:
$(ARDUINO)/ESP32forth-$(VERSION):
mkdir -p $@
$(ARDUINO)/ueforth/ueforth.ino: \
$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino: \
arduino/fuse_ino.js \
arduino/arduino.template.ino \
common/opcodes.h \
common/calling.h \
common/core.h \
common/interp.h \
$(GEN)/arduino_boot.h | $(ARDUINO)/ueforth
$(GEN)/arduino_boot.h | $(ARDUINO)/ESP32forth-$(VERSION)
$^ >$@
# ---- PACKAGE ----
$(ARDUINO)/ueforth-arduino-esp32.zip: $(ARDUINO)/ueforth/ueforth.ino
cd $(ARDUINO) && zip -r ueforth-arduino-esp32.zip ueforth
$(ARDUINO)/ESP32forth-$(VERSION).zip: $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
cd $(ARDUINO) && zip -r ESP32forth-$(VERSION).zip ESP32forth-$(VERSION)
# ---- DEPLOY ----
$(DEPLOY):
mkdir -p $@
$(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip \
$(DEPLOY)/app.yaml: $(ARDUINO)/ESP32forth-$(VERSION).zip \
site/index.html \
site/app.yaml \
site/eforth.go \
$(TARGETS) | $(DEPLOY)
mkdir -p $(DEPLOY)/static
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32.exe
cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64.exe
cp -r $(ARDUINO)/ESP32forth-$(VERSION).zip $(DEPLOY)/static
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth-$(VERSION).linux
cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32-$(VERSION).exe
cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64-$(VERSION).exe
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
cp -r site/* $(DEPLOY)
cp -r site/*.go $(DEPLOY)
cp -r site/*.yaml $(DEPLOY)
sed 's/{{VERSION}}/$(VERSION)/g' site/index.html >$(DEPLOY)/index.html
cp -r site/.gcloudignore $(DEPLOY)

View File

@ -336,16 +336,16 @@ static void InvokeWebServerOn(WebServer *ws, const char *url, cell_t xt) {
cell_t *rp = rstack;
*++rp = (cell_t) (stack + 1);
*++rp = (cell_t) code;
ueforth_run(rp);
forth_run(rp);
});
}
#endif
void setup() {
cell_t *heap = (cell_t *) malloc(HEAP_SIZE);
ueforth_init(0, 0, heap, boot, sizeof(boot));
forth_init(0, 0, heap, boot, sizeof(boot));
}
void loop() {
g_sys.rp = ueforth_run(g_sys.rp);
g_sys.rp = forth_run(g_sys.rp);
}

View File

@ -125,9 +125,9 @@ static cell_t *evaluate1(cell_t *sp) {
return sp;
}
static cell_t *ueforth_run(cell_t *initrp);
static cell_t *forth_run(cell_t *initrp);
static void ueforth_init(int argc, char *argv[], void *heap,
static void forth_init(int argc, char *argv[], void *heap,
const char *src, cell_t src_len) {
g_sys.heap = (cell_t *) heap + 4; // Leave a little room.
cell_t *sp = g_sys.heap + 1; g_sys.heap += STACK_SIZE;
@ -142,7 +142,7 @@ static void ueforth_init(int argc, char *argv[], void *heap,
*g_sys.heap++ = (cell_t) forth;
for (int i = 0; i < VOCABULARY_DEPTH; ++i) { *g_sys.heap++ = 0; }
ueforth_run(0);
forth_run(0);
(*g_sys.current)[-1] = IMMEDIATE; // Make last word ; IMMEDIATE
g_sys.DOLIT_XT = FIND("DOLIT");
g_sys.DOEXIT_XT = FIND("EXIT");

View File

@ -4,7 +4,7 @@
#define ADDR_DOCREATE && OP_DOCREATE
#define ADDR_DODOES && OP_DODOES
static cell_t *ueforth_run(cell_t *init_rp) {
static cell_t *forth_run(cell_t *init_rp) {
if (!init_rp) {
#define X(name, op, code) create(name, sizeof(name) - 1, name[0] == ';', && OP_ ## op);
PLATFORM_OPCODE_LIST

View File

@ -19,7 +19,7 @@
int main(int argc, char *argv[]) {
void *heap = mmap(0, HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
ueforth_init(argc, argv, heap, boot, sizeof(boot));
for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
forth_init(argc, argv, heap, boot, sizeof(boot));
for (;;) { g_sys.rp = forth_run(g_sys.rp); }
return 1;
}

View File

@ -43,10 +43,10 @@ EForth is a delightfully minimalist approach to Forth originated by Bill Muench
A reduced cross-platform EForth version
</p>
<ul>
<li><a href="static/ueforth-arduino-esp32.zip">ueforth-arduino-esp32.zip</a>
- <b>ESP32 Arduino</b> Source Code <b>&larr; SVFIG & Forth2020 folks start here!</b>
<li><a href="static/ESP32forth-{{VERSION}}.zip">ESP32forth-{{VERSION}}.zip</a>
- <b>ESP32forth</b> Source Code <b>&larr; SVFIG & Forth2020 folks start here!</b>
<ul>
<li><b>Regular ESP32 (may work better with your particular board)</b>
<li><b>ESP32 Dev Module or similar (may work better with your particular board)</b>
<ul>
<li><b>Board:</b> ESP32 Dev Module</li>
<li><b>Partition Scheme:</b> No OTA (2M APP, 2M SPIFFS) <b>&larr; Non-default</b></li>
@ -68,9 +68,9 @@ A reduced cross-platform EForth version
</li>
</ul>
</li>
<li><a href="static/uEf32.exe">uEf32.exe</a> - Window 32-bit EXE µEforth</li>
<li><a href="static/uEf64.exe">uEf64.exe</a> - Window 64-bit EXE µEforth</li>
<li><a href="static/ueforth.linux">ueforth.linux</a> - Linux 64-bit Executable µEforth</li>
<li><a href="static/uEf32-{{VERSION}}.exe">uEf32-{{VERSION}}.exe</a> - Window 32-bit EXE µEforth</li>
<li><a href="static/uEf64-{{VERSION}}.exe">uEf64-{{VERSION}}.exe</a> - Window 64-bit EXE µEforth</li>
<li><a href="static/ueforth-{{VERSION}}.linux">ueforth-{{VERSION}}.linux</a> - Linux 64-bit Executable µEforth</li>
</ul>
<p>

View File

@ -14,7 +14,7 @@ enum {
#undef X
};
static cell_t *ueforth_run(cell_t *init_rp) {
static cell_t *forth_run(cell_t *init_rp) {
if (!init_rp) {
#define X(name, op, code) \
create(name, sizeof(name) - 1, name[0] == ';', (void *) OP_ ## op);

View File

@ -39,7 +39,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show) {
#endif
void *heap = VirtualAlloc(
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
ueforth_init(0, 0, heap, boot, sizeof(boot));
for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
forth_init(0, 0, heap, boot, sizeof(boot));
for (;;) { g_sys.rp = forth_run(g_sys.rp); }
}