mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-11 12:11:14 +00:00

* 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 * Add BUILD_TARGET setting in makefile to replace cpu compiler flags in source code * Re-org shared lib header files, remove unused info; fix compile issues of vxworks * Add build target general * Remove unused files * Update license header * test push * Restore file * Sync up with internal/feature * Sync up with internal/feature * Rename build_wamr_app to build_wasm_app * Fix small issues of README * Enhance malformed wasm file checking Fix issue of print hex int and implement utf8 string check Fix wasi file read/write right issue Fix minor issue of build wasm app doc * Sync up with internal/feature * Sync up with internal/feature: fix interpreter arm issue, fix read leb issue * Sync up with internal/feature * Fix bug of config.h and rename wasi config.h to ssp_config.h * Sync up with internal/feature * Import wamr aot * update document * update document * Update document, disable WASI in 32bit * update document * remove files * update document * Update document * update document * update document * update samples * Sync up with internal repo
122 lines
3.0 KiB
Bash
Executable File
122 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
CURR_DIR=$PWD
|
|
WAMR_DIR=${PWD}/../..
|
|
OUT_DIR=${PWD}/out
|
|
BUILD_DIR=${PWD}/build
|
|
|
|
IWASM_ROOT=${PWD}/../../core/iwasm
|
|
APP_FRAMEWORK_DIR=${PWD}/../../core/app-framework
|
|
NATIVE_LIBS=${APP_FRAMEWORK_DIR}/app-native-shared
|
|
APP_LIB_SRC="${APP_FRAMEWORK_DIR}/base/app/*.c ${APP_FRAMEWORK_DIR}/sensor/app/*.c \
|
|
${APP_FRAMEWORK_DIR}/connection/app/*.c ${NATIVE_LIBS}/*.c"
|
|
WASM_APPS=${PWD}/wasm-apps
|
|
CLEAN=
|
|
|
|
usage ()
|
|
{
|
|
echo "build.sh [options]"
|
|
echo " -p [platform]"
|
|
echo " -t [target]"
|
|
echo " -c, rebuild SDK"
|
|
exit 1
|
|
}
|
|
|
|
|
|
while getopts "p:t:ch" opt
|
|
do
|
|
case $opt in
|
|
p)
|
|
PLATFORM=$OPTARG
|
|
;;
|
|
t)
|
|
TARGET=$OPTARG
|
|
;;
|
|
c)
|
|
CLEAN="TRUE"
|
|
;;
|
|
h)
|
|
usage
|
|
exit 1;
|
|
;;
|
|
?)
|
|
echo "Unknown arg: $arg"
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
rm -rf ${OUT_DIR}
|
|
mkdir ${OUT_DIR}
|
|
mkdir ${OUT_DIR}/wasm-apps
|
|
|
|
cd ${WAMR_DIR}/core/shared/mem-alloc
|
|
if [ ! -d "tlsf" ]; then
|
|
git clone https://github.com/mattconte/tlsf
|
|
fi
|
|
|
|
echo "#####################build wamr sdk"
|
|
cd ${WAMR_DIR}/wamr-sdk
|
|
./build_sdk.sh -n simple -x ${CURR_DIR}/wamr_config_simple.cmake $*
|
|
|
|
echo "#####################build simple project"
|
|
cd ${CURR_DIR}
|
|
mkdir -p cmake_build
|
|
cd cmake_build
|
|
cmake .. -DWAMR_BUILD_SDK_PROFILE=simple
|
|
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 -e "\n\n"
|
|
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 -e "\n\n"
|
|
echo "#####################build wasm apps"
|
|
|
|
cd ${WASM_APPS}
|
|
|
|
for i in `ls *.c`
|
|
do
|
|
APP_SRC="$i"
|
|
OUT_FILE=${i%.*}.wasm
|
|
|
|
/opt/wasi-sdk/bin/clang \
|
|
-I${WAMR_DIR}/wamr-sdk/out/simple/app-sdk/wamr-app-framework/include \
|
|
-L${WAMR_DIR}/wamr-sdk/out/simple/app-sdk/wamr-app-framework/lib \
|
|
-lapp_framework \
|
|
--target=wasm32 -O3 -z stack-size=4096 -Wl,--initial-memory=65536 \
|
|
--sysroot=${WAMR_DIR}/wamr-sdk/out/simple/app-sdk/libc-builtin-sysroot \
|
|
-Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/out/simple/app-sdk/libc-builtin-sysroot/share/defined-symbols.txt \
|
|
-Wl,--no-threads,--strip-all,--no-entry -nostdlib \
|
|
-Wl,--export=on_init -Wl,--export=on_destroy \
|
|
-Wl,--export=on_request -Wl,--export=on_response \
|
|
-Wl,--export=on_sensor_event -Wl,--export=on_timer_callback \
|
|
-Wl,--export=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"
|