mirror of
https://github.com/bdnugget/jor1k.git
synced 2026-11-07 04:27:27 +00:00
Switch to clang compiler for webassembly. Initial code for webassembly RISCV-cpu
This commit is contained in:
1 parent
e184f62a32
commit
3ab26f2f2b
4 files changed
+2279
-449
No files matched your search
@@ -1,7 +1,14 @@
|
||||
set -e
|
||||
emcc -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=32MB -Os js/wasm/or1k.c -o demos/or1k.wasm
|
||||
|
||||
clang -Os --target=wasm32 -fno-delete-null-pointer-checks -c js/wasm/or1k.c -o or1k.o
|
||||
clang -Os --target=wasm32 -fno-delete-null-pointer-checks -c js/wasm/riscv.c -o riscv.o
|
||||
wasm-ld --global-base=0 --no-entry --strip-all --import-memory --export-all --allow-undefined or1k.o -o demos/or1k.wasm
|
||||
wasm-ld --global-base=0 --no-entry --strip-all --import-memory --export-all --allow-undefined riscv.o -o demos/riscv.wasm
|
||||
|
||||
#emcc -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=32MB -s BINARYEN_IGNORE_IMPLICIT_TRAPS=1 -Os js/wasm/or1k.c -o demos/or1k.wasm
|
||||
#emcc -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=32MB -s BINARYEN_IGNORE_IMPLICIT_TRAPS=1 -Os js/wasm/riscv.c -o demos/riscv.wasm
|
||||
|
||||
browserify -r ./js/plugins/terminal-linux.js:LinuxTerm -r ./js/master/master.js:Jor1k -o demos/jor1k-master-min.js
|
||||
browserify js/worker/worker.js -o demos/jor1k-worker-min.js
|
||||
|
||||
#browserify -r ./js/plugins/terminal-linux.js:LinuxTerm -r ./js/plugins/terminal-termjs.js:TermJSTerm -r ./js/master/master.js:Jor1k -o demos/jor1k-master-min.js
|
||||
|
||||
+444
-425
File diff suppressed because it is too large.
Load diff
+1805
File diff suppressed because it is too large.
Load diff
+21
-22
@@ -59,34 +59,33 @@ async function createCPUWasm(cpuname, ram, heap, ncores) {
|
||||
let importObj = {
|
||||
env: {
|
||||
memory : ram.memory,
|
||||
abort : function(err) { message.Debug("abort " + err) },
|
||||
_DebugMessage: message.Debug,
|
||||
_abort : message.Abort,
|
||||
_Read32 : ram.Read32Big.bind(ram),
|
||||
_Write32 : ram.Write32Big.bind(ram),
|
||||
_Read16 : ram.Read16Big.bind(ram),
|
||||
_Write16 : ram.Write16Big.bind(ram),
|
||||
_Read8 : ram.Read8Big.bind(ram),
|
||||
_Write8 : ram.Write8Big.bind(ram)
|
||||
DebugMessage: message.Debug,
|
||||
abort : message.Abort,
|
||||
Read32 : ram.Read32Big.bind(ram),
|
||||
Write32 : ram.Write32Big.bind(ram),
|
||||
Read16 : ram.Read16Big.bind(ram),
|
||||
Write16 : ram.Write16Big.bind(ram),
|
||||
Read8 : ram.Read8Big.bind(ram),
|
||||
Write8 : ram.Write8Big.bind(ram)
|
||||
}
|
||||
};
|
||||
let response = await fetch('or1k.wasm');
|
||||
let obj = await WebAssembly.instantiate(await response.arrayBuffer(), importObj);
|
||||
let exports = obj.instance.exports;
|
||||
return {
|
||||
AnalyzeImage : exports._AnalyzeImage,
|
||||
ClearInterrupt : exports._ClearInterrupt,
|
||||
GetFlags : exports._GetFlags,
|
||||
GetStat : exports._GetStat,
|
||||
GetTicks : exports._GetTicks,
|
||||
GetTimeToNextInterrupt : exports._GetTimeToNextInterrupt,
|
||||
Init : exports._Init,
|
||||
InvalidateTLB : exports._InvalidateTLB,
|
||||
ProgressTime : exports._ProgressTime,
|
||||
RaiseInterrupt : exports._RaiseInterrupt,
|
||||
Reset : exports._Reset,
|
||||
SetFlags : exports._SetFlags,
|
||||
Step : exports._Step
|
||||
AnalyzeImage : exports.AnalyzeImage,
|
||||
ClearInterrupt : exports.ClearInterrupt,
|
||||
GetFlags : exports.GetFlags,
|
||||
GetStat : exports.GetStat,
|
||||
GetTicks : exports.GetTicks,
|
||||
GetTimeToNextInterrupt : exports.GetTimeToNextInterrupt,
|
||||
Init : exports.Init,
|
||||
InvalidateTLB : exports.InvalidateTLB,
|
||||
ProgressTime : exports.ProgressTime,
|
||||
RaiseInterrupt : exports.RaiseInterrupt,
|
||||
Reset : exports.Reset,
|
||||
SetFlags : exports.SetFlags,
|
||||
Step : exports.Step
|
||||
};
|
||||
/*
|
||||
fetch('or1k.wasm').then(response =>
|
||||
|
||||
Reference in new issue
Block a user