Skip to content

Commit 7c5a84c

Browse files
authored
Update README, change wasi primitive lib position and add some exception checks (#146)
Add exception throw when some initial checks fail in executing main or specific function
1 parent 74f74b6 commit 7c5a84c

File tree

36 files changed

+432
-371
lines changed

36 files changed

+432
-371
lines changed

README.md

Lines changed: 74 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,87 +14,122 @@ WebAssembly Micro Runtime (WAMR) is a standalone WebAssembly (WASM) runtime with
1414
Current Features of WAMR
1515
=========================
1616
- WASM interpreter (AOT is planned)
17-
- Supports for a subset of Libc API.
18-
- Supports for [WASI API](https://github.com/WebAssembly/WASI)
1917
- Provides embedding C API
2018
- Provides a mechanism for exporting native API's to WASM applications
21-
- Supports the programming of firmware apps in a large range of languages (C/C++/Java/Rust/Go/TypeScript etc.)
22-
- App sandbox execution environment on embedded OS
23-
- The purely asynchronized programming model
24-
- Menu configuration for easy platform integration
25-
- Supports micro-service and pub-sub event inter-app communication models
26-
- Easy to extend to support remote FW application management from host or cloud
19+
- Supports libc for WASM applications in two modes: the built-in libc subset for embedded environment and [WASI](https://github.com/WebAssembly/WASI) for standard libc
20+
- The WASM application framework and asynchronized app programming model
21+
- Supports for micro-service and pub-sub event inter-app communication models
22+
- Supports remote WASM application management from either host or cloud
23+
- Menu configuration for easy integration of application libraries
2724

2825
Application framework architecture
2926
===================================
3027

31-
By using the iwasm VM core, we are flexible to build different application frameworks for the specific domains.
28+
By using the iwasm VM core, we are flexible to build different application frameworks for the specific domains.
3229

3330
The WAMR has offered a comprehensive application framework for device and IoT usages. The framework solves many common requirements for building a real project:
3431
- Modular design for more language runtimes support
3532
- Inter application communication
3633
- Remote application management
37-
- WASM APP programming model and API extension mechanism
34+
- WASM APP programming model and API extension mechanism
3835

3936
<img src="./doc/pics/wamr-arch.JPG" width="80%">
4037

4138

4239

43-
Build WAMR Core and run WASM applications
44-
================================================
40+
Build WAMR
41+
==========
4542

46-
WAMR VM core (iwasm) can support building on different platforms:
43+
## Build WAMR VM core
44+
45+
46+
WAMR VM core (iwasm) can support building for different target platforms:
4747
- Linux
4848
- Zephyr
4949
- Mac
5050
- VxWorks
5151
- AliOS-Things
52-
- Docker
5352
- Intel Software Guard Extention (SGX)
5453

55-
After building the iwasm, we can compile some basic WASM applications and run it from the WAMR core. As the WAMR core doesn't include the extended application library, your WASM applications can only use the [WAMR built-in APIs](./doc/wamr_api.md).
54+
See [Build WAMR VM core](./doc/build_wamr.md) for the detailed instructions.
5655

57-
See the [doc/building.md](./doc/building.md) for the detailed instructions.
56+
## Libc building options
5857

58+
WAMR supports WASI for standard libc library as well as a [built-in libc subset](./doc/wamr_api.md) for tiny footprint.
5959

60-
Embed WAMR
61-
===========
60+
WASI is supported for following platforms and enabled by default building:
61+
- Linux
6262

63-
WAMR can be built into a standalone executable which takes the WASM application file name as input, and then executes it. In some other situations, the WAMR source code is embedded the product code and built into the final product.
6463

65-
WAMR provides a set of C API for loading the WASM module, instantiating the module and invoking a WASM function from a native call.
6664

67-
See the [doc/embed_wamr.md](./doc/embed_wamr.md) for the details.
65+
## Embed WAMR VM core
6866

69-
WAMR application programming library
70-
===================================
67+
WAMR can be built into a standalone executable which takes the WASM application file name as input, and then executes it. In some other situations, the WAMR source code is embedded the product code and built into the final product.
68+
69+
WAMR provides a set of C API for loading the WASM module, instantiating the module and invoking a WASM function from a native call. See [Embed WAMR VM core](./doc/embed_wamr.md) for the details.
70+
71+
The WAMR application framework supports dynamically installing WASM application remotely by embedding the WAMR VM core. It can be used as reference for how to use the embedding API's.
72+
73+
74+
## Integrate WAMR application library
75+
76+
The WAMR provides an application framework which supports event driven programming model as below:
7177

72-
WAMR defined event driven programming model:
7378
- Single thread per WASM app instance
7479
- App must implement system callbacks: on_init, on_destroy
7580

81+
Application programming API sets are available as below:
82+
83+
- Timer
84+
- Micro service (Request/Response) and Pub/Sub inter-app communication
85+
- Sensor
86+
- Connectivity and data transmission
87+
- 2D graphic UI (based on littlevgl)
88+
89+
See [WAMR application library](./doc/wamr_api.md) for the details.
90+
91+
One WAMR runtime version can also select a subsets from the WAMR application library. Refer to the sample "simple" for how to integrate API sets into WAMR building.
92+
93+
94+
95+
## Build WAMR with customized application library
96+
97+
In general when you build a WAMR version for a specific project, you probably will create additional API's for the applications. The API's can be expansion or modification to the standard WAMR application library.
98+
99+
The extended application library should be created in the folder [core/iwasm/lib/app-libs](./core/iwasm/lib/app-libs/). See the [doc/export_native_api.md](./doc/export_native_api.md) for the details.
100+
101+
102+
103+
# Create WASM application SDK
104+
105+
When you ship your WAMR runtime with the products, you will need to distribute the associated WASM application SDK for the application developers to develop WASM applications for your products. At the most time, the WASM application SDK should have a version match with the runtime distribution.
106+
107+
108+
109+
Typically there are a few components in a WASM APP SDK package:
110+
111+
* **WASI-SDK**: only needed when WASI is enabled in the runtime. It can be a link to the WASI-SDK GitHub or the full offline copy.
112+
* **sysroot** folder: only needed when WASI is not enabled in the runtime. copied from [test-tools/toolchain/sysroot](./test-tools/toolchain/sysroot)
113+
* **app-lib** folder: copied from [core/iwasm/lib/app-libs](./core/iwasm/lib/app-libs/)
114+
* **cmake toolchain** file: copied from [test-tools/toolchain/wamr_toolchain.cmake](./test-tools/toolchain/wamr_toolchain.cmake)
115+
* optionally with some guide documents and samples
116+
117+
118+
119+
Build WASM applications
120+
===================================
76121

77-
In general there are a few API classes for the WASM application programming:
78-
- WAMR Built-in API: WAMR core provides a minimal libc API set for WASM APP
79-
- WAMR application libraries:
80-
- Timer
81-
- Micro service (Request/Response)
82-
- Pub/Sub
83-
- Sensor
84-
- Connection and data transmission
85-
- 2D graphic UI (based on littlevgl)
86-
- User extended native API: extend the native API to the WASM applications
87-
- 3rd party libraries: Programmers can download any 3rd party C/C++ source code and build it together with the WASM APP code
122+
WebAssembly as a new binary instruction can be viewed as a virtual architecture. If the WASM application is developed in C/C++ language, developers can use conventional cross-compilation procedure to build the WASM application. cmake is the recommended building tool and Clang is the preferred compiler. While emcc may still work but it is not guaranteed.
88123

89-
See the [doc/wamr_api.md](./doc/wamr_api.md) for the details.
124+
Refer to [Build WASM applications](doc/build_wasm_app.md) for details.
90125

91126

92127
Samples and demos
93128
=================
94129

95130
The WAMR samples are located in folder [./samples](./samples). A sample usually contains the WAMR runtime build, WASM applications and test tools. The WARM provides following samples:
96131
- [Simple](./samples/simple/README.md): The runtime is integrated with most of the WAMR APP libaries and multiple WASM applications are provided for using different WASM API set.
97-
- [littlevgl](./samples/littlevgl/README.md): Demostrating the graphic user interface application usage on WAMR. The whole [LittlevGL](https://github.com/littlevgl/) 2D user graphic library and the UI application is built into WASM application.
132+
- [littlevgl](./samples/littlevgl/README.md): Demostrating the graphic user interface application usage on WAMR. The whole [LittlevGL](https://github.com/littlevgl/) 2D user graphic library and the UI application is built into WASM application.
98133
- [gui](./samples/gui/README.md): Moved the [LittlevGL](https://github.com/littlevgl/) library into the runtime and defined a WASM application interface by wrapping the littlevgl API.
99134
- [IoT-APP-Store-Demo](./test-tools/IoT-APP-Store-Demo/README.md): A web site for demostrating a WASM APP store usage where we can remotely install and uninstall WASM application on remote devices.
100135

@@ -109,9 +144,9 @@ The graphic user interface demo photo:
109144
Releases and acknowledgments
110145
============================
111146

112-
WAMR is a community efforts. Since Intel Corp contributed the first release of this open source project, this project has received many good contributions from the community.
147+
WAMR is a community efforts. Since Intel Corp contributed the first release of this open source project, this project has received many good contributions from the community.
113148

114-
See the [major features releasing history and contributor names](./doc/release_ack.md)
149+
See the [major features releasing history and contributor names](./doc/release_ack.md)
115150

116151

117152
Roadmap
File renamed without changes.

core/iwasm/lib/native/libc/wasm_libc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set (WASM_LIBC_DIR ${CMAKE_CURRENT_LIST_DIR})
66
include_directories(${WASM_LIBC_DIR})
77

88

9-
file (GLOB_RECURSE source_all ${WASM_LIBC_DIR}/*.c)
9+
file (GLOB source_all ${WASM_LIBC_DIR}/*.c)
1010

1111
set (WASM_LIBC_SOURCE ${source_all})
1212

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/LICENSE renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/LICENSE

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/include/LICENSE renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/include/LICENSE

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/include/wasmtime_ssp.h renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/include/wasmtime_ssp.h

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/src/LICENSE renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/src/LICENSE

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/src/README.md renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/src/README.md

File renamed without changes.

core/iwasm/runtime/wasmtime-wasi-c/sandboxed-system-primitives/src/config.h renamed to core/iwasm/lib/native/libc/wasmtime-wasi-c/sandboxed-system-primitives/src/config.h

File renamed without changes.

0 commit comments

Comments
 (0)