Skip to content

Commit 74af7cc

Browse files
committed
Bring wasm service up
After merging #474, multiple executables were moved to other location (build/riscv32), which caused the wasm service to fail. The intuitive solution is to embed build/riscv32 into the wasm. Also, executables that stored in rv32emu-prebuilt must be pulled before embedding into wasm, so emcc_deps should depend on the artifact target. Additionally, the Makefile's distclean target does not fully clean wasm artifacts, as CC=emcc might not be set during make distclean. To fix this, the declaration of the WEB_FILES and DEMO_DIR wasm-related variables has been reordered. Related: #486
1 parent feca1de commit 74af7cc

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

assets/html/index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -136,32 +136,32 @@
136136
var spinnerElement = document.getElementById('spinner');
137137

138138
var elfFiles = [
139-
"doom.elf",
139+
"riscv32/doom",
140140
"smolnes.elf",
141-
"quake.elf",
142-
"coremark.elf",
143-
"dhrystone.elf",
144-
"pi.elf",
145-
"donut.elf",
146-
"aes.elf",
141+
"riscv32/quake",
142+
"riscv32/coremark",
143+
"riscv32/dhrystone",
144+
"riscv32/pi",
145+
"riscv32/donut",
146+
"riscv32/aes",
147147
"coro.elf",
148-
"fcalc.elf",
149-
"hamilton.elf",
148+
"riscv32/fcalc",
149+
"riscv32/hamilton",
150150
"hello.elf",
151151
"ieee754.elf",
152152
"jit-bf.elf",
153-
"maj2random.elf",
154-
"mandelbrot.elf",
155-
"nqueens.elf",
156-
"nyancat.elf",
153+
"riscv32/maj2random",
154+
"riscv32/mandelbrot",
155+
"riscv32/nqueens",
156+
"riscv32/nyancat",
157157
"perfcount.elf",
158-
"qrcode.elf",
158+
"riscv32/qrcode",
159159
"readelf.elf",
160-
"richards.elf",
161-
"rvsim.elf",
162-
"scimark2.elf",
163-
"spirograph.elf",
164-
"stream.elf",
160+
"riscv32/richards",
161+
"riscv32/rvsim",
162+
"riscv32/scimark2",
163+
"riscv32/spirograph",
164+
"riscv32/stream",
165165
];
166166

167167
var runButton = document.getElementById("runButton");

mk/wasm.mk

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
CFLAGS_emcc ?=
2-
deps_emcc :=
2+
deps_emcc := artifact
33
ASSETS := assets
44
WEB_HTML_RESOURCES := $(ASSETS)/html
55
WEB_JS_RESOURCES := $(ASSETS)/js
66
EXPORTED_FUNCS := _main,_indirect_rv_halt
7-
8-
ifeq ("$(CC_IS_EMCC)", "1")
7+
DEMO_DIR := demo
98
WEB_FILES := $(BIN).js \
109
$(BIN).wasm \
1110
$(BIN).worker.js
11+
12+
ifeq ("$(CC_IS_EMCC)", "1")
1213
BIN := $(BIN).js
1314

1415
# TCO
@@ -28,6 +29,7 @@ CFLAGS_emcc += -sINITIAL_MEMORY=2GB \
2829
-sSTACK_SIZE=4MB \
2930
-sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency \
3031
--embed-file build@/ \
32+
--embed-file build/riscv32@/riscv32 \
3133
--embed-file build/timidity@/etc/timidity \
3234
-DMEM_SIZE=0x40000000 \
3335
-DCYCLE_PER_STEP=2000000 \
@@ -77,7 +79,6 @@ else
7779
endif
7880

7981
# used to serve wasm locally
80-
DEMO_DIR := demo
8182
DEMO_IP := 127.0.0.1
8283
DEMO_PORT := 8000
8384

0 commit comments

Comments
 (0)