Make sim build.
This commit is contained in:
@ -74,7 +74,8 @@ WIN_LFLAGS64 = /LIBPATH:"c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib
|
||||
TARGETS = $(WEB)/terminal.html \
|
||||
$(WEB)/ueforth.js \
|
||||
$(POSIX)/ueforth \
|
||||
$(ESP32)/ESP32forth/ESP32forth.ino
|
||||
$(ESP32)/ESP32forth/ESP32forth.ino \
|
||||
$(ESP32_SIM)/Esp32forth-sim
|
||||
|
||||
LSQ = ls 2>/dev/null
|
||||
|
||||
@ -260,6 +261,7 @@ $(POSIX)/ueforth: \
|
||||
posix/main.c \
|
||||
common/opcodes.h \
|
||||
common/calls.h \
|
||||
common/calling.h \
|
||||
common/floats.h \
|
||||
common/interp.h \
|
||||
common/core.h \
|
||||
@ -276,6 +278,7 @@ $(WINDOWS)/uEf32.obj: \
|
||||
windows/main.c \
|
||||
common/opcodes.h \
|
||||
common/calls.h \
|
||||
common/calling.h \
|
||||
common/floats.h \
|
||||
common/core.h \
|
||||
windows/interp.h \
|
||||
@ -291,6 +294,7 @@ $(WINDOWS)/uEf64.obj: \
|
||||
windows/main.c \
|
||||
common/opcodes.h \
|
||||
common/calls.h \
|
||||
common/calling.h \
|
||||
common/floats.h \
|
||||
common/core.h \
|
||||
windows/interp.h \
|
||||
@ -307,12 +311,26 @@ $(WINDOWS)/uEf64.exe: \
|
||||
$(ESP32_SIM):
|
||||
mkdir -p $@
|
||||
|
||||
$(ESP32_SIM)/print-builtins: \
|
||||
esp32/print-builtins.c esp32/builtins.h | $(ESP32_SIM)
|
||||
$(GEN)/print-esp32-builtins: \
|
||||
esp32/print-builtins.c esp32/builtins.h | $(GEN)
|
||||
$(CC) $< -o $@
|
||||
|
||||
print: $(ESP32_SIM)/print-builtins
|
||||
$<
|
||||
$(GEN)/esp32_sim_opcodes.h: $(GEN)/print-esp32-builtins | $(GEN)
|
||||
$< >$@
|
||||
|
||||
$(ESP32_SIM)/Esp32forth-sim: \
|
||||
esp32/sim_main.cpp \
|
||||
esp32/main.cpp \
|
||||
common/opcodes.h \
|
||||
common/floats.h \
|
||||
common/calling.h \
|
||||
common/floats.h \
|
||||
common/core.h \
|
||||
common/interp.h \
|
||||
$(GEN)/esp32_boot.h \
|
||||
$(GEN)/esp32_sim_opcodes.h | $(ESP32_SIM)
|
||||
$(CXX) $(CFLAGS) -g $< -o $@
|
||||
strip $(STRIP_ARGS) $@
|
||||
|
||||
# ---- ESP32 ----
|
||||
|
||||
@ -329,12 +347,14 @@ ESP32_PARTS = common/replace.js \
|
||||
esp32/options.h \
|
||||
esp32/builtins.h \
|
||||
esp32/builtins.cpp \
|
||||
esp32/main.cpp \
|
||||
$(GEN)/esp32_boot.h
|
||||
|
||||
$(ESP32)/ESP32forth/ESP32forth.ino: $(ESP32_PARTS) | $(ESP32)/ESP32forth
|
||||
cat esp32/template.ino | common/replace.js \
|
||||
VERSION=$(VERSION) \
|
||||
REVISION=$(REVISION) \
|
||||
config=@esp32/config.h \
|
||||
opcodes=@common/opcodes.h \
|
||||
calling=@common/calling.h \
|
||||
floats=@common/floats.h \
|
||||
@ -343,6 +363,7 @@ $(ESP32)/ESP32forth/ESP32forth.ino: $(ESP32_PARTS) | $(ESP32)/ESP32forth
|
||||
options=@esp32/options.h \
|
||||
builtins.h=@esp32/builtins.h \
|
||||
builtins.cpp=@esp32/builtins.cpp \
|
||||
main.cpp=@esp32/main.cpp \
|
||||
boot=@$(GEN)/esp32_boot.h \
|
||||
>$@
|
||||
|
||||
|
||||
@ -117,12 +117,3 @@ static cell_t TimerIsrRegister(cell_t group, cell_t timer, cell_t xt, cell_t arg
|
||||
return timer_isr_register((timer_group_t) group, (timer_idx_t) timer, HandleInterrupt, args, flags, (timer_isr_handle_t *) ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
cell_t *heap = (cell_t *) malloc(HEAP_SIZE);
|
||||
forth_init(0, 0, heap, boot, sizeof(boot));
|
||||
}
|
||||
|
||||
void loop() {
|
||||
g_sys.rp = forth_run(g_sys.rp);
|
||||
}
|
||||
|
||||
@ -14,27 +14,23 @@
|
||||
|
||||
#ifndef SIM_PRINT_ONLY
|
||||
|
||||
#ifdef ENABLE_WEBSERVER_SUPPORT
|
||||
# include "WebServer.h"
|
||||
#endif
|
||||
# ifdef ENABLE_WEBSERVER_SUPPORT
|
||||
# include "WebServer.h"
|
||||
# endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#define HEAP_SIZE (100 * 1024)
|
||||
#define STACK_CELLS 512
|
||||
#define INTERRUPT_STACK_CELLS 64
|
||||
# include <errno.h>
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/select.h>
|
||||
|
||||
// Optional hook to pull in words for userwords.h
|
||||
#if __has_include("userwords.h")
|
||||
# include "userwords.h"
|
||||
#else
|
||||
# define USER_WORDS
|
||||
#endif
|
||||
# if __has_include("userwords.h")
|
||||
# include "userwords.h"
|
||||
# else
|
||||
# define USER_WORDS
|
||||
# endif
|
||||
|
||||
static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
|
||||
|
||||
17
ueforth/esp32/config.h
Normal file
17
ueforth/esp32/config.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2022 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define HEAP_SIZE (100 * 1024)
|
||||
#define STACK_CELLS 512
|
||||
#define INTERRUPT_STACK_CELLS 64
|
||||
22
ueforth/esp32/main.cpp
Normal file
22
ueforth/esp32/main.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2022 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
void setup() {
|
||||
cell_t *heap = (cell_t *) malloc(HEAP_SIZE);
|
||||
forth_init(0, 0, heap, boot, sizeof(boot));
|
||||
}
|
||||
|
||||
void loop() {
|
||||
g_sys.rp = forth_run(g_sys.rp);
|
||||
}
|
||||
@ -43,8 +43,10 @@
|
||||
#define Y(name, code) X(#name, name, code)
|
||||
|
||||
int main() {
|
||||
#define X(str, name, code) printf("%s\n", str);
|
||||
printf("#define PLATFORM_OPCODE_LIST \\\n");
|
||||
#define X(str, name, code) printf(" X(\"%s\", %s, ) \\\n", str, #name);
|
||||
PLATFORM_OPCODE_LIST
|
||||
#undef X
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
31
ueforth/esp32/sim_main.cpp
Normal file
31
ueforth/esp32/sim_main.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2022 Bradley D. Nelson
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "esp32/config.h"
|
||||
#include "esp32/options.h"
|
||||
#include "common/opcodes.h"
|
||||
#include "common/floats.h"
|
||||
#include "common/calling.h"
|
||||
#include "gen/esp32_sim_opcodes.h"
|
||||
#include "common/core.h"
|
||||
#include "common/interp.h"
|
||||
#include "gen/esp32_boot.h"
|
||||
#include "esp32/main.cpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
setup();
|
||||
for (;;) {
|
||||
loop();
|
||||
}
|
||||
}
|
||||
@ -19,9 +19,11 @@
|
||||
* Revision: {{REVISION}}
|
||||
*/
|
||||
|
||||
{{config}}
|
||||
{{options}}
|
||||
{{opcodes}}
|
||||
{{floats}}
|
||||
{{calling}}
|
||||
{{options}}
|
||||
{{builtins.h}}
|
||||
{{builtins.cpp}}
|
||||
{{main.cpp}}
|
||||
|
||||
Reference in New Issue
Block a user