forked from bytecodealliance/wasm-micro-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a switch to build simple sample without gui support (bytecodealli…
…ance#126) * Implement memory profiler, optimize memory usage, modify code indent * Implement memory.grow and limit heap space base offset to 1G; modify iwasm build type to Release and 64 bit by default * Add a new extension library: connection * Fix bug of reading magic number and version in big endian platform * Re-org platform APIs: move most platform APIs from iwasm to shared-lib * Enhance wasm loader to fix some security issues * Fix issue about illegal load of EXC_RETURN into PC on stm32 board * Updates that let a restricted version of the interpreter run in SGX * Enable native/app address validation and conversion for wasm app * Remove wasm_application_exectue_* APIs from wasm_export.h which makes confused * Refine binary size and fix several minor issues Optimize interpreter LOAD/STORE opcodes to decrease the binary size Fix issues when using iwasm library: _bh_log undefined, bh_memory.h not found Remove unused _stdin/_stdout/_stderr global variables resolve in libc wrapper Add macros of global heap size, stack size, heap size for Zephyr main.c Clear compile warning of wasm_application.c * Add more strict security checks for libc wrapper API's * Use one libc wrapper copy for sgx and other platforms; remove bh_printf macro for other platform header files * Enhance security of libc strcpy/sprintf wrapper function * Fix issue of call native for x86_64/arm/mips, add module inst parameter for native wrapper functions * Remove get_module_inst() and fix issue of call native * Refine wgl lib: remove module_inst parameter from widget functions; move function index check to runtime instantiate * Refine interpreter call native process, refine memory boudary check * Fix issues of invokeNative function of arm/mips/general version * Add a switch to build simple sample without gui support
- Loading branch information
Showing
14 changed files
with
150 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,6 @@ | |
#define bh_printf printf | ||
#endif | ||
|
||
#ifndef WASM_ENABLE_GUI | ||
#define WASM_ENABLE_GUI 0 | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters