Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ARM and THUMB AOT support, enable Android platform support #182

Merged
merged 127 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
a967c2e
Merge pull request #7 from intel/master
wenyongh May 17, 2019
a40070e
Merge pull request #8 from intel/master
wenyongh May 17, 2019
7a76369
Merge pull request #9 from intel/master
wenyongh May 20, 2019
b5e21ea
Merge pull request #10 from intel/master
wenyongh May 23, 2019
d9c98f6
Implement memory profiler, optimize memory usage, modify code indent
wenyongh May 23, 2019
87217b6
Merge pull request #11 from intel/master
wenyongh May 23, 2019
9e41d8d
Implement memory.grow and limit heap space base offset to 1G; modify …
wenyongh May 31, 2019
68deed7
Merge pull request #12 from intel/master
wenyongh May 31, 2019
96a22c4
Merge pull request #13 from intel/master
wenyongh Jun 8, 2019
fbc4ecf
Add a new extension library: connection
wenyongh Jun 11, 2019
2ab000d
Fix bug of reading magic number and version in big endian platform
wenyongh Jun 14, 2019
3d73d80
Merge pull request #14 from intel/master
wenyongh Jun 14, 2019
dd7f521
Merge pull request #15 from intel/master
wenyongh Jun 14, 2019
bc5bcef
Merge pull request #16 from intel/master
wenyongh Jul 10, 2019
e3b6654
Re-org platform APIs: move most platform APIs from iwasm to shared-lib
wenyongh Jul 22, 2019
0168bf4
Merge pull request #17 from intel/master
wenyongh Jul 22, 2019
49a33a6
Merge pull request #18 from intel/master
wenyongh Aug 1, 2019
efdd9c1
Merge pull request #19 from intel/master
wenyongh Aug 2, 2019
c42ffea
Enhance wasm loader to fix some security issues
wenyongh Aug 8, 2019
757d024
Merge pull request #20 from intel/master
wenyongh Aug 8, 2019
c4eb477
Merge pull request #21 from intel/master
wenyongh Aug 14, 2019
77ab5c4
Fix issue about illegal load of EXC_RETURN into PC on stm32 board
wenyongh Aug 14, 2019
25ef974
Merge pull request #22 from intel/master
wenyongh Aug 14, 2019
b9d1f70
Updates that let a restricted version of the interpreter run in SGX
wenyongh Aug 19, 2019
b9ea45c
Enable native/app address validation and conversion for wasm app
wenyongh Aug 21, 2019
0110ca5
Remove wasm_application_exectue_* APIs from wasm_export.h which makes…
wenyongh Aug 21, 2019
bb77158
Refine binary size and fix several minor issues
wenyongh Aug 27, 2019
b372550
Merge pull request #23 from intel/master
wenyongh Aug 27, 2019
e9bf5ce
Merge pull request #24 from intel/master
wenyongh Aug 27, 2019
88193b4
Add more strict security checks for libc wrapper API's
wenyongh Aug 28, 2019
eb846ed
Merge pull request #25 from intel/master
wenyongh Aug 28, 2019
bd18d2f
Merge pull request #26 from intel/master
wenyongh Aug 28, 2019
c2d6d18
Use one libc wrapper copy for sgx and other platforms; remove bh_prin…
wenyongh Aug 28, 2019
11a4baa
Merge pull request #27 from intel/master
wenyongh Aug 28, 2019
a3533cc
Enhance security of libc strcpy/sprintf wrapper function
wenyongh Aug 29, 2019
a7e0207
Merge pull request #28 from intel/master
wenyongh Sep 6, 2019
a424e63
Merge pull request #29 from intel/master
wenyongh Sep 8, 2019
c60fad0
Merge pull request #30 from intel/master
wenyongh Sep 10, 2019
d1a7a5a
Fix issue of call native for x86_64/arm/mips, add module inst paramet…
wenyongh Sep 10, 2019
5f7d38a
Merge pull request #31 from intel/master
wenyongh Sep 10, 2019
4886317
Merge pull request #32 from intel/master
wenyongh Sep 10, 2019
05a40ba
Merge pull request #33 from intel/master
wenyongh Sep 11, 2019
6a6fbde
Remove get_module_inst() and fix issue of call native
wenyongh Sep 11, 2019
59b1037
Merge pull request #34 from intel/master
wenyongh Sep 11, 2019
55fd356
Refine wgl lib: remove module_inst parameter from widget functions; m…
wenyongh Sep 16, 2019
8d145f1
Merge pull request #35 from intel/master
wenyongh Sep 16, 2019
9aad41e
Refine interpreter call native process, refine memory boudary check
wenyongh Sep 19, 2019
289d0cc
Merge pull request #36 from intel/master
wenyongh Sep 19, 2019
e866e9c
Fix issues of invokeNative function of arm/mips/general version
wenyongh Sep 23, 2019
7267dcf
Merge pull request #37 from intel/master
wenyongh Sep 23, 2019
830c7ab
Add a switch to build simple sample without gui support
wenyongh Sep 25, 2019
baafddd
Merge pull request #38 from intel/master
wenyongh Sep 25, 2019
6ed582d
Merge pull request #39 from intel/master
wenyongh Sep 27, 2019
08b56a0
Merge pull request #40 from intel/master
wenyongh Oct 11, 2019
61a7103
Add BUILD_TARGET setting in makefile to replace cpu compiler flags in…
wenyongh Nov 1, 2019
30c6bd1
Merge pull request #41 from intel/master
wenyongh Nov 1, 2019
05c6a20
Re-org shared lib header files, remove unused info; fix compile issue…
wenyongh Nov 4, 2019
3095afb
Add build target general
wenyongh Nov 5, 2019
a53a251
Merge pull request #42 from intel/master
wenyongh Nov 5, 2019
35b7d75
Merge pull request #43 from intel/master
wenyongh Nov 12, 2019
ffc8918
Remove unused files
wenyongh Nov 12, 2019
2cf7da8
Update license header
wenyongh Nov 12, 2019
c6e9642
Merge pull request #44 from intel/master
wenyongh Nov 12, 2019
1659eb6
Merge pull request #45 from bytecodealliance/master
wenyongh Nov 13, 2019
2e3d54d
Merge pull request #46 from bytecodealliance/master
wenyongh Nov 20, 2019
71a2492
Merge pull request #47 from bytecodealliance/master
wenyongh Nov 20, 2019
06b88d2
Merge pull request #48 from bytecodealliance/master
wenyongh Nov 21, 2019
ecfbce1
test push
wenyongh Nov 21, 2019
3577fbc
Restore file
wenyongh Nov 21, 2019
68dd935
Merge pull request #49 from bytecodealliance/master
wenyongh Nov 22, 2019
2aaa425
Sync up with internal/feature
wenyongh Nov 25, 2019
cf3e5a9
Sync up with internal/feature
wenyongh Nov 25, 2019
e74c251
Rename build_wamr_app to build_wasm_app
wenyongh Nov 25, 2019
b869c32
Fix small issues of README
wenyongh Nov 25, 2019
2b26e07
Merge pull request #50 from bytecodealliance/master
wenyongh Nov 25, 2019
b4c2fcb
Merge pull request #51 from bytecodealliance/master
wenyongh Nov 26, 2019
538422e
Enhance malformed wasm file checking
wenyongh Nov 27, 2019
fef64a2
Merge pull request #52 from bytecodealliance/master
wenyongh Nov 27, 2019
c6466f6
Sync up with internal/feature
wenyongh Dec 12, 2019
de70ad5
Sync up with internal/feature: fix interpreter arm issue, fix read le…
wenyongh Dec 13, 2019
f8bad06
Merge pull request #53 from bytecodealliance/master
wenyongh Dec 13, 2019
1795782
Sync up with internal/feature
wenyongh Dec 16, 2019
1dbcd22
Fix bug of config.h and rename wasi config.h to ssp_config.h
wenyongh Dec 18, 2019
f602ce4
Merge pull request #54 from bytecodealliance/master
wenyongh Dec 18, 2019
e2b8b70
Sync up with internal/feature
wenyongh Dec 24, 2019
b49d418
Merge pull request #55 from bytecodealliance/master
wenyongh Dec 24, 2019
fcef206
Import wamr aot
wenyongh Dec 31, 2019
f524345
update document
wenyongh Dec 31, 2019
4ea8221
update document
wenyongh Dec 31, 2019
3f5b3b7
Update document, disable WASI in 32bit
wenyongh Dec 31, 2019
334ba49
update document
wenyongh Dec 31, 2019
17e87e9
remove files
wenyongh Dec 31, 2019
7a6009c
update document
wenyongh Jan 9, 2020
c1a63c8
Update document
wenyongh Jan 17, 2020
05cf283
Merge pull request #56 from bytecodealliance/master
wenyongh Jan 17, 2020
475ffd5
update document
wenyongh Jan 20, 2020
d9c258a
Merge branch 'master' of https://github.com/wenyongh/wasm-micro-runtime
wenyongh Jan 20, 2020
6fc1f09
update document
wenyongh Jan 20, 2020
e33c6f9
update samples
wenyongh Jan 20, 2020
9bafa15
Sync up with internal repo
wenyongh Jan 21, 2020
00bb117
Merge pull request #57 from bytecodealliance/master
wenyongh Jan 21, 2020
6778f52
Fix typo of wamr help info
wenyongh Jan 21, 2020
8fe513b
Merge pull request #58 from bytecodealliance/master
wenyongh Jan 21, 2020
6176b49
Merge from internal/feature
wenyongh Feb 10, 2020
f83d73a
Remove used smart light sample
wenyongh Feb 10, 2020
2d7ed77
Merge pull request #59 from bytecodealliance/master
wenyongh Feb 10, 2020
14da325
Fix performance issue caused by refine memory page size patch
wenyongh Feb 10, 2020
936c000
Merge pull request #60 from bytecodealliance/master
wenyongh Feb 10, 2020
dcaf670
Merge pull request #61 from bytecodealliance/master
wenyongh Feb 13, 2020
a1444ec
Merge pull request #62 from bytecodealliance/master
wenyongh Feb 17, 2020
95e74f7
Sync up with internal/feature
wenyongh Feb 17, 2020
54a10c6
Refine interpreter, fix sgx aot issue
wenyongh Feb 18, 2020
b1ab479
Refine wasm loader and interpreter, enhance wamrc to support SGX (#167)
wenyongh Feb 18, 2020
e9c7ad8
Remove build folder
wenyongh Feb 18, 2020
d0f7471
Merge pull request #63 from bytecodealliance/master
wenyongh Feb 18, 2020
e5ebd93
Remove used build folder
wenyongh Feb 18, 2020
588cdb9
Remove unused build folders (#168)
wenyongh Feb 18, 2020
aec7256
Merge pull request #64 from bytecodealliance/master
wenyongh Feb 18, 2020
748c157
Merge pull request #65 from bytecodealliance/master
wenyongh Feb 19, 2020
d6bd3e9
Merge pull request #66 from bytecodealliance/master
wenyongh Feb 22, 2020
6b6ce9d
Sync up with internal/feature
wenyongh Feb 22, 2020
61eb114
Decrease block address cache size
wenyongh Feb 22, 2020
ccdbb9c
Merge pull request #67 from bytecodealliance/master
wenyongh Feb 25, 2020
4b0c94e
Merge pull request #68 from bytecodealliance/master
wenyongh Feb 27, 2020
81aa342
Fix block addr cache uninitialized issue
wenyongh Feb 27, 2020
3bf9cfa
Merge pull request #69 from bytecodealliance/master
wenyongh Feb 27, 2020
af9853b
Sync with internal/feature: enable arm aot and android platform
wenyongh Feb 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a switch to build simple sample without gui support
  • Loading branch information
wenyongh committed Sep 25, 2019
commit 830c7ab4bd76d4627abd5b14cdeb86be6b274de4
3 changes: 3 additions & 0 deletions core/iwasm/lib/app-libs/base/wasm_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
#include "sensor.h"
#include "connection.h"
#include "timer_wasm_app.h"

#if ENABLE_WGL != 0
#include "wgl.h"
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions core/iwasm/lib/native-interface/shared_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ unpack_response(char * packet, int size, response_t * response);
void
free_req_resp_packet(char * packet);

#if WASM_ENABLE_GUI != 0
#include "wgl_shared_utils.h"
#endif

#ifdef __cplusplus
}
Expand Down
32 changes: 28 additions & 4 deletions core/iwasm/runtime/vmcore-wasm/wasm_interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,13 @@ wasm_interp_call_func_bytecode(WASMThread *self,

b = POP_F32();
a = POP_F32();
PUSH_F32(wa_fmin(a, b));

if (isnan(a))
PUSH_F32(a);
else if (isnan(b))
PUSH_F32(b);
else
PUSH_F32(wa_fmin(a, b));
HANDLE_OP_END ();
}

Expand All @@ -1805,7 +1811,13 @@ wasm_interp_call_func_bytecode(WASMThread *self,

b = POP_F32();
a = POP_F32();
PUSH_F32(wa_fmax(a, b));

if (isnan(a))
PUSH_F32(a);
else if (isnan(b))
PUSH_F32(b);
else
PUSH_F32(wa_fmax(a, b));
HANDLE_OP_END ();
}

Expand Down Expand Up @@ -1870,7 +1882,13 @@ wasm_interp_call_func_bytecode(WASMThread *self,

b = POP_F64();
a = POP_F64();
PUSH_F64(wa_fmin(a, b));

if (isnan(a))
PUSH_F64(a);
else if (isnan(b))
PUSH_F64(b);
else
PUSH_F64(wa_fmin(a, b));
HANDLE_OP_END ();
}

Expand All @@ -1880,7 +1898,13 @@ wasm_interp_call_func_bytecode(WASMThread *self,

b = POP_F64();
a = POP_F64();
PUSH_F64(wa_fmax(a, b));

if (isnan(a))
PUSH_F64(a);
else if (isnan(b))
PUSH_F64(b);
else
PUSH_F64(wa_fmax(a, b));
HANDLE_OP_END ();
}

Expand Down
3 changes: 3 additions & 0 deletions core/shared-lib/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,6 @@
#define bh_printf printf
#endif

#ifndef WASM_ENABLE_GUI
#define WASM_ENABLE_GUI 0
#endif
1 change: 1 addition & 0 deletions samples/gui/wasm-apps/lvgl-compatible/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ IWASM_DIR=../../../../core/iwasm
CFLAGS += -O3 \
-Wno-int-conversion \
-DLV_CONF_INCLUDE_SIMPLE \
-DENABLE_WGL=1 \
-I$(APP_DIR)/src/ \
-I$(IWASM_DIR)/lib/app-libs/base/ \
-I$(IWASM_DIR)/lib/native-interface/ \
Expand Down
1 change: 1 addition & 0 deletions samples/gui/wasm-apps/wgl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ IWASM_DIR=../../../../core/iwasm
CFLAGS += -O3 \
-Wno-int-conversion \
-DLV_CONF_INCLUDE_SIMPLE \
-DENABLE_WGL=1 \
-I$(APP_DIR)/src/ \
-I$(IWASM_DIR)/lib/app-libs/base/ \
-I$(IWASM_DIR)/lib/native-interface/ \
Expand Down
1 change: 1 addition & 0 deletions samples/gui/wasm-runtime-wgl/linux-build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ add_definitions (-DWASM_ENABLE_BASE_LIB)
add_definitions (-Dattr_container_malloc=bh_malloc)
add_definitions (-Dattr_container_free=bh_free)
add_definitions (-DLV_CONF_INCLUDE_SIMPLE)
add_definitions (-DWASM_ENABLE_GUI=1)

add_library (vmlib
${WASM_PLATFORM_LIB_SOURCE}
Expand Down
3 changes: 2 additions & 1 deletion samples/gui/wasm-runtime-wgl/zephyr-build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ zephyr_compile_definitions (-DNVALGRIND
-D__ZEPHYR__
-DWASM_ENABLE_BASE_LIB
-Dattr_container_malloc=bh_malloc
-Dattr_container_free=bh_free)
-Dattr_container_free=bh_free
-DWASM_ENABLE_GUI=1)

set (IWASM_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/iwasm)
set (APP_MGR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/core/app-mgr)
Expand Down
24 changes: 18 additions & 6 deletions samples/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ set(WASM_DIR ${WAMR_ROOT_DIR}/core/iwasm)
set(APP_MGR_DIR ${WAMR_ROOT_DIR}/core/app-mgr)
set(SHARED_DIR ${WAMR_ROOT_DIR}/core/shared-lib)

set (LV_DRIVERS_DIR ${WASM_DIR}/lib/3rdparty/lv_drivers)
set (LVGL_DIR ${WASM_DIR}/lib/3rdparty/lvgl)

file(GLOB_RECURSE LV_DRIVERS_SOURCES "${LV_DRIVERS_DIR}/*.c" )
if ("${ENABLE_GUI}" STREQUAL "YES")
set (LV_DRIVERS_DIR ${WASM_DIR}/lib/3rdparty/lv_drivers)
set (LVGL_DIR ${WASM_DIR}/lib/3rdparty/lvgl)
file(GLOB_RECURSE LV_DRIVERS_SOURCES "${LV_DRIVERS_DIR}/*.c" )
endif()

enable_language (ASM)

Expand All @@ -61,7 +62,9 @@ include (${WASM_DIR}/runtime/vmcore-wasm/vmcore.cmake)
include (${WASM_DIR}/lib/native/base/wasm_lib_base.cmake)
include (${WASM_DIR}/lib/native/libc/wasm_libc.cmake)
include (${WASM_DIR}/lib/native/extension/sensor/wasm_lib_sensor.cmake)
include (${WASM_DIR}/lib/native/extension/gui/wasm_lib_gui.cmake)
if ("${ENABLE_GUI}" STREQUAL "YES")
include (${WASM_DIR}/lib/native/extension/gui/wasm_lib_gui.cmake)
endif()
include (${WASM_DIR}/lib/native/extension/connection/wasm_lib_conn.cmake)
include (${WASM_DIR}/lib/native/extension/connection/${TARGET_PLATFORM}/connection_mgr.cmake)
include (${WASM_DIR}/lib/native-interface/native_interface.cmake)
Expand All @@ -83,6 +86,10 @@ add_definitions (-Dattr_container_malloc=bh_malloc)
add_definitions (-Dattr_container_free=bh_free)
add_definitions (-DLV_CONF_INCLUDE_SIMPLE)

if ("${ENABLE_GUI}" STREQUAL "YES")
add_definitions (-DWASM_ENABLE_GUI=1)
endif()

add_library (vmlib
${WASM_PLATFORM_LIB_SOURCE}
${WASM_UTILS_LIB_SOURCE}
Expand All @@ -101,7 +108,12 @@ add_library (vmlib
${NATIVE_INTERFACE_SOURCE}
)

if ("${ENABLE_GUI}" STREQUAL "YES")
add_executable (simple src/main.c src/iwasm_main.c src/ext_lib_export.c ${LV_DRIVERS_SOURCES})
target_link_libraries (simple vmlib -lm -ldl -lpthread -lSDL2)
else ()
add_executable (simple src/main.c src/iwasm_main.c src/ext_lib_export.c)
target_link_libraries (simple vmlib -lm -ldl -lpthread)
endif ()

target_link_libraries (simple vmlib -lm -ldl -lpthread -lSDL2)

5 changes: 5 additions & 0 deletions samples/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ simple/

- build.sh<br/>
The script to build all binaries.
- build_no_gui.sh<br/>
The script to build all binaries without gui library support.
- CMakeLists.txt<br/>
CMake file used to build the simple application.
- README.md<br/>
Expand Down Expand Up @@ -101,6 +103,9 @@ Build all binaries
Execute the build.sh script then all binaries including wasm application files would be generated in 'out' directory.
`./build.sh`

Or execute the build_no_gui.sh script to build all binaries without gui library support.
`./build_no_gui.sh`

Out directory structure
------------------------------
```
Expand Down
3 changes: 2 additions & 1 deletion samples/simple/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo "#####################build simple project"
cd ${CURR_DIR}
mkdir -p cmake_build
cd cmake_build
cmake ..
cmake -DENABLE_GUI=YES ..
make
if [ $? != 0 ];then
echo "BUILD_FAIL simple exit as $?\n"
Expand Down Expand Up @@ -66,6 +66,7 @@ OUT_FILE=${i%.*}.wasm
emcc -O3 -I${APP_LIBS}/base -I${APP_LIBS}/extension/sensor -I${NATIVE_LIBS} \
-I${APP_LIBS}/extension/connection \
-I${APP_LIBS}/extension/gui \
-DENABLE_WGL=1 \
-s WASM=1 -s SIDE_MODULE=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 \
-s TOTAL_MEMORY=65536 -s TOTAL_STACK=4096 \
-s "EXPORTED_FUNCTIONS=['_on_init', '_on_destroy', '_on_request', '_on_response', \
Expand Down
71 changes: 71 additions & 0 deletions samples/simple/build_no_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

CURR_DIR=$PWD
WAMR_DIR=${PWD}/../..
OUT_DIR=${PWD}/out
BUILD_DIR=${PWD}/build

IWASM_ROOT=${PWD}/../../core/iwasm
APP_LIBS=${IWASM_ROOT}/lib/app-libs
NATIVE_LIBS=${IWASM_ROOT}/lib/native-interface
APP_LIB_SRC="${APP_LIBS}/base/*.c ${APP_LIBS}/extension/sensor/*.c ${APP_LIBS}/extension/connection/*.c ${NATIVE_LIBS}/*.c"
WASM_APPS=${PWD}/wasm-apps

rm -rf ${OUT_DIR}
mkdir ${OUT_DIR}
mkdir ${OUT_DIR}/wasm-apps

cd ${WAMR_DIR}/core/shared-lib/mem-alloc
if [ ! -d "tlsf" ]; then
git clone https://github.com/mattconte/tlsf
fi

echo "#####################build simple project"
cd ${CURR_DIR}
mkdir -p cmake_build
cd cmake_build
cmake -DENABLE_GUI=NO ..
make
if [ $? != 0 ];then
echo "BUILD_FAIL simple exit as $?\n"
exit 2
fi
cp -a simple ${OUT_DIR}
echo "#####################build simple project success"

echo "#####################build host-tool"
cd ${WAMR_DIR}/test-tools/host-tool
mkdir -p bin
cd bin
cmake ..
make
if [ $? != 0 ];then
echo "BUILD_FAIL host tool exit as $?\n"
exit 2
fi
cp host_tool ${OUT_DIR}
echo "#####################build host-tool success"


echo "#####################build wasm apps"

cd ${WASM_APPS}

for i in `ls *.c | grep -v gui`
do
APP_SRC="$i ${APP_LIB_SRC}"
OUT_FILE=${i%.*}.wasm
emcc -O3 -I${APP_LIBS}/base -I${APP_LIBS}/extension/sensor -I${NATIVE_LIBS} \
-I${APP_LIBS}/extension/connection \
-s WASM=1 -s SIDE_MODULE=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 \
-s TOTAL_MEMORY=65536 -s TOTAL_STACK=4096 \
-s "EXPORTED_FUNCTIONS=['_on_init', '_on_destroy', '_on_request', '_on_response', \
'_on_sensor_event', '_on_timer_callback', '_on_connection_data']" \
-o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
echo "build ${OUT_FILE} success"
else
echo "build ${OUT_FILE} fail"
fi
done
echo "#####################build wasm apps done"
5 changes: 5 additions & 0 deletions samples/simple/src/ext_lib_export.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#include "lib_export.h"
#include "sensor_api.h"
#include "connection_api.h"

#if WASM_ENABLE_GUI != 0
#include "gui_api.h"
#endif

static NativeSymbol extended_native_symbol_defs[] = {
#include "runtime_sensor.inl"
#include "connection.inl"
#if WASM_ENABLE_GUI != 0
#include "wamr_gui.inl"
#endif
};

#include "ext_lib_export.h"
8 changes: 8 additions & 0 deletions samples/simple/src/iwasm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
#include "module_wasm_app.h"
#include "wasm_export.h"

#if WASM_ENABLE_GUI != 0
#include "lv_drivers/display/monitor.h"
#include "lv_drivers/indev/mouse.h"
#endif

#define MAX 2048

Expand Down Expand Up @@ -430,6 +432,7 @@ static bool parse_args(int argc, char *argv[])
return true;
}

#if WASM_ENABLE_GUI != 0
/**
* Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics library
*/
Expand Down Expand Up @@ -461,6 +464,8 @@ static void hal_init(void)
indev_drv.read_cb = mouse_read; /*This function will be called periodically (by the library) to get the mouse position and state*/
lv_indev_drv_register(&indev_drv);
}
#endif

// Driver function
int iwasm_main(int argc, char *argv[])
{
Expand All @@ -484,8 +489,11 @@ int iwasm_main(int argc, char *argv[])
goto fail1;
}

#if WASM_ENABLE_GUI != 0
wgl_init();
hal_init();
#endif

init_sensor_framework();

// timer manager
Expand Down