Commit Graph

39 Commits

Author SHA1 Message Date
Huang Qi
c4e78cd10a wamr: Add new option to enable tail call support
See also:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/2975

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-01-06 04:34:50 -08:00
YAMAMOTO Takashi
f12586c51e interpreters/wamr: add INTERPRETERS_WAMR_DEBUG_AOT option
At least it's sometimes useful for nuttx sim.

eg. (modified a bit to avoid github autolinks)
```
spacetanuki% lldb ./nuttx
(lldb) target create "./nuttx"
Current executable set to '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64).
(lldb) settings set plugin.jit-loader.gdb.enable on
(lldb) b foo
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 37011 launched: '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64)

NuttShell (NSH) NuttX-10.4.0
nsh> mount -t hostfs -o fs=/tmp/wasm /mnt
nsh> iwasm /mnt/test.aot
1 location added to breakpoint 1
Process 37011 stopped
* thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5
   2
   3    __attribute__((noinline))
   4    void foo()
-> 5    {
   6        printf("hello from %s\n", __func__);
   7    }
   8
Target 0: (nuttx) stopped.
(lldb) bt
* thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5
    frame #_1: 0x000000010580077a JIT(0x1058002d4)`bar(exenv=0x0000000101284280) at test.c:12:2
    frame #_2: 0x000000010580086a JIT(0x1058002d4)`baz(exenv=0x0000000101284280) at test.c:19:2
    frame #_3: 0x0000000105800972 JIT(0x1058002d4)`__main_argc_argv(exenv=<unavailable>, argc=<unavailable>, argv=<unavailable>) at test.c:26:3
    frame #_4: 0x00000001058061aa JIT(0x1058002d4)`aot_func#14 + 278
    frame #_5: 0x00000001058005cd JIT(0x1058002d4)`aot_func#2 + 153
    frame #_6: 0x00000001000e250f nuttx`push_args_end at invokeNative_em64.s:61
    frame #_7: 0x000000010013851a nuttx`wasm_runtime_invoke_native(exec_env=0x0000000101284280, func_ptr=0x0000000105800534, func_type=0x00000001011e2e20, signature=0x0000000000000000, attachment=0x0000000000000000, argv=0x0000000000000000, argc=0, argv_ret=0x0000000000000000) at wasm_runtime_common.c:4631:9
    frame #_8: 0x00000001000da1ae nuttx`aot_call_function(exec_env=0x0000000101284280, function=0x00000001011e1fb0, argc=0, argv=0x0000000000000000) at aot_runtime.c:1654:15
    frame #_9: 0x0000000100134b56 nuttx`wasm_runtime_call_wasm(exec_env=0x0000000101284280, function=0x00000001011e1fb0, argc=0, argv=0x0000000000000000) at wasm_runtime_common.c:2048:15
    frame #_10: 0x00000001000fbad4 nuttx`execute_main(module_inst=0x00000001011e3890, argc=1, argv=0x00000001011b63f8) at wasm_application.c:112:15
    frame #_11: 0x00000001000fb995 nuttx`wasm_application_execute_main(module_inst=0x00000001011e3890, argc=1, argv=0x00000001011b63f8) at wasm_application.c:238:11
    frame #_12: 0x00000001000ea1a0 nuttx`app_instance_main(module_inst=0x00000001011e3890) at main.c:113:5
    frame #_13: 0x00000001000e9d60 nuttx`iwasm_main(argc=1, argv=0x00000001011b63f8) at main.c:947:21
    frame #_14: 0x0000000100023275 nuttx`nxtask_startup(entrypt=(nuttx`iwasm_main at main.c:545), argc=2, argv=0x00000001011b63f0) at task_startup.c:70:8
    frame #_15: 0x000000010001065a nuttx`nxtask_start at task_start.c:134:7
    frame #_16: 0x000000010003a15f nuttx`pre_start at sim_initialstate.c:52:3
(lldb)

```
2023-12-25 04:47:07 -08:00
Huang Qi
f57cd2cf0c tools: Move final wasm module to bin/wasm as elf
And leave all intermediate file in apps/wasm,
such as .map file, entry object etc used in
wasm module build.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
f55b8face6 wamr: Add support for thumb target triple in Toolchain.defs
Before WAMR 1.3.0, eabihf in wamrc is `gnueabihf`, so without
this patch call wamrc will failed with target abi was `eabihf`,
we should convert the standard llvm target to wamrc required.

Both `eabihf` and `gnueabihf` supported after WAMR 1.3.0.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
097411de49 wamr: Add support for custom section loading
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-11-21 08:11:59 -08:00
simbit18
e501f784c3 Fix Kconfig style
Add TABs
Add comments
2023-08-11 22:13:17 +08:00
YAMAMOTO Takashi
c078b2ee7a wamr: add a kconfig to control wasi-threads
cf. https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/pthread_impls.md
2023-07-06 09:25:14 -03:00
Huang Qi
be0e677699 interpreters/wamr: New option for configurable bounds checks
Works with https://github.com/bytecodealliance/wasm-micro-runtime/pull/2289

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-07-05 16:25:56 +08:00
Huang Qi
dec2cd9635 tools/Wasm: Decouple the wasm compilation and runtime specific AOT compilation
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-13 10:15:40 -03:00
Huang Qi
e287e4bb9e wamr: Simplify target handling by LLVM style arch info
Depends on: https://github.com/apache/nuttx/pull/8928

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-13 10:15:40 -03:00
Huang Qi
95acf6c904 interpreters/wamr: New option to dump call stack
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-24 11:37:22 +08:00
chao an
4f11f38c38 interpreters/wamr: add compile role of WebAssembly
Add compilation rules to support WebAssembly(WASM/WAMR):

1. Compile Toolchain
 1> Download WASI sdk and export the WASI_SDK_PATH path:

$ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
$ tar xf wasi-sdk-19.0-linux.tar.gz
Put wasi-sdk-19.0 to your host WASI_SDK_PATH environment variable, like:
$ export WASI_SDK_PATH=`pwd`/wasi-sdk-19.0

 2> Download Wamr "wamrc" AOT compiler and export to the PATH:
$ mkdir wamrc
$ wget https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
$ tar xf wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz
$ export PATH=$PATH:$PWD

2. Configuring and running

 1> Configuring sim/wamr and compile:

nuttx$ ./tools/configure.sh  sim/wamr
nuttx$ make
...
Wamrc Generate AoT: /home/archer/code/nuttx/n5/apps/wasm/hello.aot
Wamrc Generate AoT: /home/archer/code/nuttx/n5/apps/wasm/coremark.aot
LD:  nuttx

 2> Copy the generated wasm file(Interpreter/AoT)

nuttx$ cp ../apps/wasm/hello.aot .
nuttx$ cp ../apps/wasm/hello.wasm .
nuttx$ cp ../apps/wasm/coremark.wasm .

 3> Run iwasm

nuttx$ ./nuttx
NuttShell (NSH) NuttX-10.4.0
nsh> iwasm /data/hello.wasm
Hello, World!!
nsh> iwasm /data/hello.aot
Hello, World!!
nsh> iwasm /data/coremark.wasm
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 12000
Total time (secs): 12.000000
Iterations/Sec   : 5.000000
Iterations       : 60
Compiler version : Clang 15.0.7
Compiler flags   : Using NuttX compilation options
Memory location  : Defined by the NuttX configuration
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0xa14c
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 5.000000 / Clang 15.0.7 Using NuttX compilation options / Defined by the NuttX configuration

Co-Authored-By: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-06 13:23:44 +02:00
Gustavo Henrique Nihei
fe7b57aa11 wamr: Fix INTERPRETERS_WAMR_LIBC_WASI dependency on PSEUDOFS_SOFTLINKS
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-04 01:47:33 +08:00
Huang Qi
0357cb99b2 interpreters/wamr: New option to support spec test
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-11-17 13:28:40 +08:00
Huang Qi
31e7c5ec60 interpreters/wamr: New option to support ref types
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-11-17 13:28:40 +08:00
yinshengkai
ee4d8b738f Makefile: replace INCDIR to INCDIR_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-10 02:38:58 +08:00
yinshengkai
2c3c2edcb7 Makefile: Remove INCDIROPT
This option, which resolves to -w when CONFIG_CYGWIN_WINTOOL is
configured, is now appended to INCDIR in tools/Config.mk.

See git commit # 5eae32577e5d5226e5d3027c169eeb369f83f77d in the main
2022-10-25 13:48:16 +08:00
YAMAMOTO Takashi
65b58724ca interpreters/wamr/Kconfig: Add INTERPRETERS_WAMR_DEBUG_INTERP option
Tested with sim/Linux/amd64 and esp32 devkit-c.
2022-08-29 14:20:19 +08:00
Huang Qi
2e2630e838 Don't download tarballs if a local git repo found
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-28 17:20:47 +08:00
Huang Qi
29a49f366e wamr: Add a new option to custom stack guard size
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-10 15:21:26 +08:00
Huang Qi
167c551e82 wamr: Add a new option to enable semaphore support
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-09 23:17:00 +08:00
YAMAMOTO Takashi
e5c07b9a62 interpreters/wamr: Remove WAMR_VERSION_STUB and always use actual tags
This allows to use a commit sha1 for CONFIG_INTERPRETERS_WAMR_VERSION.

Note: the existing configs with specific wamr version
need to be updated.

Tested with:
CONFIG_INTERPRETERS_WAMR_VERSION=main
CONFIG_INTERPRETERS_WAMR_VERSION=WAMR-04-15-2021
CONFIG_INTERPRETERS_WAMR_VERSION=3168ba8dcf20d9d8539d75c637420f5fd8682335
2022-06-02 00:35:08 +08:00
YAMAMOTO Takashi
ba08c77000 interpreters/wamr/Kconfig: enable text heap when necessary 2022-05-25 15:25:05 +08:00
YAMAMOTO Takashi
562db060b7 interpreters/wamr/Kconfig: Mention limitations about wasi 2022-05-24 22:38:36 +08:00
YAMAMOTO Takashi
90e164b708 interpreters/wamr/Kconfig: Add an option to enable wasi libc 2022-05-24 22:38:36 +08:00
YAMAMOTO Takashi
137b924b93 interpreters/wamr/Kconfig: Add INTERPRETERS_WAMR_PERF_PROFILING 2022-05-20 21:53:34 +08:00
zhouliang3
1e7a2bc009 apps/wamr: Add wamr memory Kconfig
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2022-03-14 20:52:39 +08:00
Xiang Xiao
4cc0c755bf Remove CONFIG_CLOCK_MONOTONIC special code
since this opion doesn't exist anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:44 +08:00
Fotis Panagiotopoulos
bc5d8034f1 Typo fixes. 2022-01-06 10:30:41 +08:00
Alin Jerpelea
94f9dfa4df interpreters: fix relative path CI error
error: Path relative to repository other than nuttx must begin with the root directory
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-16 09:03:06 -05:00
Masayuki Ishikawa
f6f4de1ca2 interpreters: wamr: Add touch in Makefile to avoid unnecessary mv
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-27 08:20:43 +02:00
Masayuki Ishikawa
a077598b6d interpreters: wamr: Change the default version to "04-15-2021"
Summary:
- This commit changes the default version to "04-15-2021"
  to fix a compile error for Cortex-M target

Impact:
- WASM micro runtime (WAMR)
- NOTE: There are still compile warnings in the WAMR which
  should be fixed later

Testing:
- Tested with spresense (NOTE: need to add -lm)
- Tested with esp32-devkitc

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-27 08:20:43 +02:00
Huang Qi
3040c59ae9 Replace all wget with curl
wget is missing from some system (like macOS and Windows native),
it's better to use curl to simplify build environment.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-21 22:45:46 -06:00
Huang Qi
ea5a9a08bc interpreters/wamr: Support latest snapshot for main branch
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-21 05:47:12 -06:00
YAMAMOTO Takashi
46650ffc29 interpreters/wamr: This requires CLOCK_MONOTONIC to build 2020-10-13 08:09:36 +02:00
Huang Qi
1efc805b4e interpreters/wamr: Bump to latest release.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-09-29 08:45:31 +01:00
Huang Qi
c26d662951 interpreters/wamr: Add configs for heap pool & custom name sections
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-09-27 19:42:08 +01:00
Huang Qi
69956020b4 interpreters/wamr: Add missing options
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: Id1783f42842288a8f9c6ddf6105b6718dde757a1
2020-09-17 18:28:17 +01:00
Huang Qi
0b4fa2f66a interpreters: Inroduce support for WAMR
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-09-16 20:53:31 +01:00