File tree Expand file tree Collapse file tree 3 files changed +39
-32
lines changed Expand file tree Collapse file tree 3 files changed +39
-32
lines changed Original file line number Diff line number Diff line change 130
130
</ div >
131
131
< textarea id ="output " rows ="8 "> </ textarea >
132
132
133
+ < script src ="elf_list.js "> </ script >
133
134
< script type ='text/javascript '>
134
135
var statusElement = document . getElementById ( 'status' ) ;
135
136
var progressElement = document . getElementById ( 'progress' ) ;
136
137
var spinnerElement = document . getElementById ( 'spinner' ) ;
137
-
138
- var elfFiles = [
139
- "riscv32/doom" ,
140
- "smolnes.elf" ,
141
- "riscv32/quake" ,
142
- "riscv32/coremark" ,
143
- "riscv32/dhrystone" ,
144
- "riscv32/pi" ,
145
- "riscv32/donut" ,
146
- "riscv32/aes" ,
147
- "coro.elf" ,
148
- "riscv32/fcalc" ,
149
- "riscv32/hamilton" ,
150
- "hello.elf" ,
151
- "ieee754.elf" ,
152
- "jit-bf.elf" ,
153
- "riscv32/maj2random" ,
154
- "riscv32/mandelbrot" ,
155
- "riscv32/nqueens" ,
156
- "riscv32/nyancat" ,
157
- "perfcount.elf" ,
158
- "riscv32/qrcode" ,
159
- "readelf.elf" ,
160
- "riscv32/richards" ,
161
- "riscv32/rvsim" ,
162
- "riscv32/scimark2" ,
163
- "riscv32/spirograph" ,
164
- "riscv32/stream" ,
165
- ] ;
166
-
167
138
var runButton = document . getElementById ( "runButton" ) ;
168
139
runButton . addEventListener ( "click" , runButtonClickHandler ) ;
169
140
Original file line number Diff line number Diff line change @@ -37,8 +37,11 @@ CFLAGS_emcc += -sINITIAL_MEMORY=2GB \
37
37
-O3 \
38
38
-w
39
39
40
+ gen_elf_list_js :
41
+ $(Q ) tools/gen-elf-list-js.py > $(DEMO_DIR ) /elf_list.js
42
+
40
43
# used to download all dependencies of elf executable and bundle into single wasm
41
- deps_emcc += $(DOOM_DATA ) $(QUAKE_DATA ) $(TIMIDITY_DATA )
44
+ deps_emcc += gen_elf_list_js $(DOOM_DATA ) $(QUAKE_DATA ) $(TIMIDITY_DATA )
42
45
43
46
# check browser MAJOR version if supports TCO
44
47
CHROME_MAJOR :=
98
101
STATIC_WEB_FILES := $(WEB_HTML_RESOURCES ) /index.html \
99
102
$(WEB_JS_RESOURCES ) /coi-serviceworker.min.js
100
103
101
- start-web : $( BIN ) check-demo-dir-exist
104
+ start-web : check-demo-dir-exist $( BIN )
102
105
$(foreach T, $(WEB_FILES ) , $(call cp-web-file, $(T ) ) )
103
106
$(foreach T, $(STATIC_WEB_FILES ) , $(call cp-web-file, $(T ) ) )
104
107
$(Q ) python3 -m http.server --bind $(DEMO_IP ) $(DEMO_PORT ) --directory $(DEMO_DIR )
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import os
4
+
5
+ def list_files (d ):
6
+ try :
7
+ if d == "build" :
8
+ files = [f for f in os .listdir (d ) if (os .path .isfile (os .path .join (d , f )) and f .endswith ('.elf' ))]
9
+ else :
10
+ parent_dir = os .path .dirname (d )
11
+ files = [
12
+ os .path .relpath (os .path .join (d , f ), start = parent_dir )
13
+ for f in os .listdir (d )
14
+ if os .path .isfile (os .path .join (d , f ))
15
+ ]
16
+ return files
17
+ except FileNotFoundError :
18
+ print (f"Directory { directory } not found." )
19
+ return []
20
+
21
+ elf_exec_dirs = ["build" , "build/riscv32" ]
22
+ elf_exec_list = []
23
+
24
+ for d in elf_exec_dirs :
25
+ files = list_files (d )
26
+ elf_exec_list .extend (files )
27
+ #print(elf_exec_list)
28
+
29
+ def gen_elf_list_js ():
30
+ js_code = f"const elfFiles = { elf_exec_list } ;\n "
31
+ print (js_code )
32
+
33
+ gen_elf_list_js ()
You can’t perform that action at this time.
0 commit comments