diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver.cc | 19 | ||||
-rw-r--r-- | kernel/yosys.cc | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index bec872c24..178641101 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -85,20 +85,37 @@ USING_YOSYS_NAMESPACE #ifdef EMSCRIPTEN # include <sys/stat.h> # include <sys/types.h> +# include <emscripten.h> extern "C" int main(int, char**); extern "C" void run(const char*); extern "C" const char *errmsg(); extern "C" const char *prompt(); -int main(int, char**) +int main(int argc, char **argv) { + EM_ASM( + if (ENVIRONMENT_IS_NODE) + { + FS.mkdir('/hostcwd'); + FS.mount(NODEFS, { root: '.' }, '/hostcwd'); + FS.mkdir('/hostfs'); + FS.mount(NODEFS, { root: '/' }, '/hostfs'); + } + ); + mkdir("/work", 0777); chdir("/work"); log_files.push_back(stdout); log_error_stderr = true; yosys_banner(); yosys_setup(); + + if (argc == 2) + { + // Run the first argument as a script file + run_frontend(argv[1], "script", 0, 0, 0); + } } void run(const char *command) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index aa5901271..750a154e6 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -739,7 +739,7 @@ std::string proc_self_dirname() #ifdef EMSCRIPTEN std::string proc_share_dirname() { - return "/share"; + return "/share/"; } #else std::string proc_share_dirname() |