Switch Android example to run CoreMark instead of fib(40)

extensions
Volodymyr Shymanskyy 3 years ago
parent 1c44e6b75f
commit b9c5072796

@ -142,7 +142,7 @@ jobs:
./gradlew build
- name: Copy
run: |
cp ./platforms/android/app/build/outputs/apk/debug/app-debug.apk ./wasm3-android-test.apk
cp ./platforms/android/app/build/outputs/apk/debug/app-debug.apk ./wasm3-android-coremark.apk
- name: Publish
uses: softprops/action-gh-release@v1
with:

@ -10,9 +10,9 @@
#include <time.h>
#include "m3/wasm3.h"
#include "m3/m3_config.h"
#include "m3/m3_api_libc.h"
#include "m3/extra/fib32.wasm.h"
#include "m3/extra/coremark_minimal.wasm.h"
#define FATAL(msg, ...) { printf("Fatal: " msg "\n", ##__VA_ARGS__); return; }
@ -20,8 +20,8 @@ void run_wasm()
{
M3Result result = m3Err_none;
uint8_t* wasm = (uint8_t*)fib32_wasm;
size_t fsize = fib32_wasm_len;
uint8_t* wasm = (uint8_t*)coremark_minimal_wasm;
size_t fsize = coremark_minimal_wasm_len;
printf("Loading WebAssembly...\n");
@ -38,20 +38,23 @@ void run_wasm()
result = m3_LoadModule (runtime, module);
if (result) FATAL("m3_LoadModule: %s", result);
result = m3_LinkLibC (module);
if (result) FATAL("m3_LinkLibC: %s", result);
IM3Function f;
result = m3_FindFunction (&f, runtime, "fib");
result = m3_FindFunction (&f, runtime, "run");
if (result) FATAL("m3_FindFunction: %s", result);
printf("Running...\n");
printf("Running CoreMark 1.0...\n");
result = m3_CallV (f, 40);
result = m3_CallV (f);
if (result) FATAL("m3_Call: %s", result);
uint32_t value = 0;
float value = 0;
result = m3_GetResultsV (f, &value);
if (result) FATAL("m3_GetResults: %s", result);
printf("Result: %d\n", value);
printf("Result: %0.3f\n", value);
}
int main()

@ -75,11 +75,11 @@ m3ApiRawFunction(m3_libc_print)
m3ApiReturn(i_size);
}
m3ApiRawFunction(m3_libc_clock)
m3ApiRawFunction(m3_libc_clock_ms)
{
m3ApiReturnType (uint32_t)
m3ApiReturn(clock());
m3ApiReturn(clock() / (CLOCKS_PER_SEC/1000));
}
static
@ -127,7 +127,7 @@ _ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "_memmove",
_ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "_memcpy", "*(**i)", &m3_libc_memmove))); // just alias of memmove
_ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "_abort", "v()", &m3_libc_abort)));
_ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "_exit", "v(i)", &m3_libc_exit)));
_ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "_clock", "i()", &m3_libc_clock)));
_ (SuppressLookupFailure (m3_LinkRawFunction (module, env, "clock_ms", "i()", &m3_libc_clock_ms)));
_catch:
return result;

Loading…
Cancel
Save