-> ESP32forth
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
VERSION=7.0.1
|
||||||
|
|
||||||
OUT = out
|
OUT = out
|
||||||
GEN = $(OUT)/gen
|
GEN = $(OUT)/gen
|
||||||
RES = $(OUT)/resources
|
RES = $(OUT)/resources
|
||||||
@ -51,7 +53,7 @@ WIN_LFLAGS64 = /LIBPATH:"c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib
|
|||||||
TARGETS = $(WEB)/terminal.html \
|
TARGETS = $(WEB)/terminal.html \
|
||||||
$(WEB)/ueforth.js \
|
$(WEB)/ueforth.js \
|
||||||
$(POSIX)/ueforth \
|
$(POSIX)/ueforth \
|
||||||
$(ARDUINO)/ueforth/ueforth.ino
|
$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
|
||||||
|
|
||||||
FINDQ = find 2>/dev/null
|
FINDQ = find 2>/dev/null
|
||||||
|
|
||||||
@ -239,39 +241,41 @@ $(WINDOWS)/uEf64.exe: \
|
|||||||
|
|
||||||
# ---- ARDUINO ----
|
# ---- ARDUINO ----
|
||||||
|
|
||||||
$(ARDUINO)/ueforth:
|
$(ARDUINO)/ESP32forth-$(VERSION):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(ARDUINO)/ueforth/ueforth.ino: \
|
$(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino: \
|
||||||
arduino/fuse_ino.js \
|
arduino/fuse_ino.js \
|
||||||
arduino/arduino.template.ino \
|
arduino/arduino.template.ino \
|
||||||
common/opcodes.h \
|
common/opcodes.h \
|
||||||
common/calling.h \
|
common/calling.h \
|
||||||
common/core.h \
|
common/core.h \
|
||||||
common/interp.h \
|
common/interp.h \
|
||||||
$(GEN)/arduino_boot.h | $(ARDUINO)/ueforth
|
$(GEN)/arduino_boot.h | $(ARDUINO)/ESP32forth-$(VERSION)
|
||||||
$^ >$@
|
$^ >$@
|
||||||
|
|
||||||
# ---- PACKAGE ----
|
# ---- PACKAGE ----
|
||||||
|
|
||||||
$(ARDUINO)/ueforth-arduino-esp32.zip: $(ARDUINO)/ueforth/ueforth.ino
|
$(ARDUINO)/ESP32forth-$(VERSION).zip: $(ARDUINO)/ESP32forth-$(VERSION)/ESP32forth-$(VERSION).ino
|
||||||
cd $(ARDUINO) && zip -r ueforth-arduino-esp32.zip ueforth
|
cd $(ARDUINO) && zip -r ESP32forth-$(VERSION).zip ESP32forth-$(VERSION)
|
||||||
|
|
||||||
# ---- DEPLOY ----
|
# ---- DEPLOY ----
|
||||||
|
|
||||||
$(DEPLOY):
|
$(DEPLOY):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip \
|
$(DEPLOY)/app.yaml: $(ARDUINO)/ESP32forth-$(VERSION).zip \
|
||||||
site/index.html \
|
site/index.html \
|
||||||
site/app.yaml \
|
site/app.yaml \
|
||||||
site/eforth.go \
|
site/eforth.go \
|
||||||
$(TARGETS) | $(DEPLOY)
|
$(TARGETS) | $(DEPLOY)
|
||||||
mkdir -p $(DEPLOY)/static
|
mkdir -p $(DEPLOY)/static
|
||||||
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
|
cp -r $(ARDUINO)/ESP32forth-$(VERSION).zip $(DEPLOY)/static
|
||||||
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
|
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth-$(VERSION).linux
|
||||||
cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32.exe
|
cp -r $(WINDOWS)/uEf32.exe $(DEPLOY)/static/uEf32-$(VERSION).exe
|
||||||
cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64.exe
|
cp -r $(WINDOWS)/uEf64.exe $(DEPLOY)/static/uEf64-$(VERSION).exe
|
||||||
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
|
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)
|
cp -r site/.gcloudignore $(DEPLOY)
|
||||||
|
|||||||
@ -336,16 +336,16 @@ static void InvokeWebServerOn(WebServer *ws, const char *url, cell_t xt) {
|
|||||||
cell_t *rp = rstack;
|
cell_t *rp = rstack;
|
||||||
*++rp = (cell_t) (stack + 1);
|
*++rp = (cell_t) (stack + 1);
|
||||||
*++rp = (cell_t) code;
|
*++rp = (cell_t) code;
|
||||||
ueforth_run(rp);
|
forth_run(rp);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
cell_t *heap = (cell_t *) malloc(HEAP_SIZE);
|
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() {
|
void loop() {
|
||||||
g_sys.rp = ueforth_run(g_sys.rp);
|
g_sys.rp = forth_run(g_sys.rp);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,9 +125,9 @@ static cell_t *evaluate1(cell_t *sp) {
|
|||||||
return 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) {
|
const char *src, cell_t src_len) {
|
||||||
g_sys.heap = (cell_t *) heap + 4; // Leave a little room.
|
g_sys.heap = (cell_t *) heap + 4; // Leave a little room.
|
||||||
cell_t *sp = g_sys.heap + 1; g_sys.heap += STACK_SIZE;
|
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;
|
*g_sys.heap++ = (cell_t) forth;
|
||||||
for (int i = 0; i < VOCABULARY_DEPTH; ++i) { *g_sys.heap++ = 0; }
|
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.current)[-1] = IMMEDIATE; // Make last word ; IMMEDIATE
|
||||||
g_sys.DOLIT_XT = FIND("DOLIT");
|
g_sys.DOLIT_XT = FIND("DOLIT");
|
||||||
g_sys.DOEXIT_XT = FIND("EXIT");
|
g_sys.DOEXIT_XT = FIND("EXIT");
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#define ADDR_DOCREATE && OP_DOCREATE
|
#define ADDR_DOCREATE && OP_DOCREATE
|
||||||
#define ADDR_DODOES && OP_DODOES
|
#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) {
|
if (!init_rp) {
|
||||||
#define X(name, op, code) create(name, sizeof(name) - 1, name[0] == ';', && OP_ ## op);
|
#define X(name, op, code) create(name, sizeof(name) - 1, name[0] == ';', && OP_ ## op);
|
||||||
PLATFORM_OPCODE_LIST
|
PLATFORM_OPCODE_LIST
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
void *heap = mmap(0, HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
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));
|
forth_init(argc, argv, heap, boot, sizeof(boot));
|
||||||
for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
|
for (;;) { g_sys.rp = forth_run(g_sys.rp); }
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,10 +43,10 @@ EForth is a delightfully minimalist approach to Forth originated by Bill Muench
|
|||||||
A reduced cross-platform EForth version
|
A reduced cross-platform EForth version
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="static/ueforth-arduino-esp32.zip">ueforth-arduino-esp32.zip</a>
|
<li><a href="static/ESP32forth-{{VERSION}}.zip">ESP32forth-{{VERSION}}.zip</a>
|
||||||
- <b>ESP32 Arduino</b> Source Code <b>← SVFIG & Forth2020 folks start here!</b>
|
- <b>ESP32forth</b> Source Code <b>← SVFIG & Forth2020 folks start here!</b>
|
||||||
<ul>
|
<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>
|
<ul>
|
||||||
<li><b>Board:</b> ESP32 Dev Module</li>
|
<li><b>Board:</b> ESP32 Dev Module</li>
|
||||||
<li><b>Partition Scheme:</b> No OTA (2M APP, 2M SPIFFS) <b>← Non-default</b></li>
|
<li><b>Partition Scheme:</b> No OTA (2M APP, 2M SPIFFS) <b>← Non-default</b></li>
|
||||||
@ -68,9 +68,9 @@ A reduced cross-platform EForth version
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="static/uEf32.exe">uEf32.exe</a> - Window 32-bit EXE µEforth</li>
|
<li><a href="static/uEf32-{{VERSION}}.exe">uEf32-{{VERSION}}.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/uEf64-{{VERSION}}.exe">uEf64-{{VERSION}}.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/ueforth-{{VERSION}}.linux">ueforth-{{VERSION}}.linux</a> - Linux 64-bit Executable µEforth</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@ -14,7 +14,7 @@ enum {
|
|||||||
#undef X
|
#undef X
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell_t *ueforth_run(cell_t *init_rp) {
|
static cell_t *forth_run(cell_t *init_rp) {
|
||||||
if (!init_rp) {
|
if (!init_rp) {
|
||||||
#define X(name, op, code) \
|
#define X(name, op, code) \
|
||||||
create(name, sizeof(name) - 1, name[0] == ';', (void *) OP_ ## op);
|
create(name, sizeof(name) - 1, name[0] == ';', (void *) OP_ ## op);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show) {
|
|||||||
#endif
|
#endif
|
||||||
void *heap = VirtualAlloc(
|
void *heap = VirtualAlloc(
|
||||||
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
ueforth_init(0, 0, heap, boot, sizeof(boot));
|
forth_init(0, 0, heap, boot, sizeof(boot));
|
||||||
for (;;) { g_sys.rp = ueforth_run(g_sys.rp); }
|
for (;;) { g_sys.rp = forth_run(g_sys.rp); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user