re-org platform APIs, simplify porting process (#201)

Co-authored-by: Xu Jun <jun1.xu@intel.com>
This commit is contained in:
Xu Jun
2020-03-16 16:43:57 +08:00
committed by GitHub
parent ef5ceffe71
commit f1a0e75ab7
177 changed files with 2954 additions and 7904 deletions

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
NAME := iwasm
CORE_ROOT := wamr/core
IWASM_ROOT := wamr/core/iwasm
SHARED_ROOT := wamr/core/shared
@ -59,10 +60,13 @@ endif
GLOBAL_DEFINES += WASM_ENABLE_LIBC_BUILTIN=1
GLOBAL_INCLUDES += ${IWASM_ROOT}/include \
GLOBAL_INCLUDES += ${CORE_ROOT} \
${IWASM_ROOT}/include \
${IWASM_ROOT}/common \
${SHARED_ROOT}/include \
${SHARED_ROOT}/platform/include \
${SHARED_ROOT}/utils \
${SHARED_ROOT}/mem-alloc \
${SHARED_ROOT}/platform/alios
ifeq (${WAMR_BUILD_INTERP}, 1)
@ -73,17 +77,16 @@ ifeq (${WAMR_BUILD_AOT}, 1)
GLOBAL_INCLUDES += ${IWASM_ROOT}/aot
endif
$(NAME)_SOURCES := ${SHARED_ROOT}/platform/alios/bh_assert.c \
${SHARED_ROOT}/platform/alios/bh_math.c \
${SHARED_ROOT}/platform/alios/bh_platform.c \
${SHARED_ROOT}/platform/alios/bh_platform_log.c \
${SHARED_ROOT}/platform/alios/bh_thread.c \
${SHARED_ROOT}/platform/alios/bh_time.c \
$(NAME)_SOURCES := ${SHARED_ROOT}/platform/alios/alios_platform.c \
${SHARED_ROOT}/platform/alios/alios_thread.c \
${SHARED_ROOT}/platform/alios/alios_time.c \
${SHARED_ROOT}/platform/common/math/math.c \
${SHARED_ROOT}/mem-alloc/mem_alloc.c \
${SHARED_ROOT}/mem-alloc/ems/ems_kfc.c \
${SHARED_ROOT}/mem-alloc/ems/ems_alloc.c \
${SHARED_ROOT}/mem-alloc/ems/ems_hmu.c \
${SHARED_ROOT}/utils/bh_definition.c \
${SHARED_ROOT}/utils/bh_assert.c \
${SHARED_ROOT}/utils/bh_common.c \
${SHARED_ROOT}/utils/bh_hashmap.c \
${SHARED_ROOT}/utils/bh_list.c \
${SHARED_ROOT}/utils/bh_log.c \

View File

@ -7,7 +7,6 @@
#include <string.h>
#include "bh_platform.h"
#include "bh_log.h"
#include "bh_platform_log.h"
#include "wasm_export.h"
#include "test_wasm.h"
@ -35,7 +34,7 @@ app_instance_main(wasm_module_inst_t module_inst)
wasm_application_execute_main(module_inst, app_argc, app_argv);
if ((exception = wasm_runtime_get_exception(module_inst)))
bh_printf("%s\n", exception);
printf("%s\n", exception);
return NULL;
}
@ -63,7 +62,7 @@ void iwasm_main(void *arg1)
/* initialize runtime environment */
if (!wasm_runtime_full_init(&init_args)) {
bh_printf("Init runtime environment failed.\n");
printf("Init runtime environment failed.\n");
return;
}
@ -78,7 +77,7 @@ void iwasm_main(void *arg1)
/* load WASM module */
if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size,
error_buf, sizeof(error_buf)))) {
bh_printf("%s\n", error_buf);
printf("%s\n", error_buf);
goto fail1;
}
@ -88,7 +87,7 @@ void iwasm_main(void *arg1)
8 * 1024,
error_buf,
sizeof(error_buf)))) {
bh_printf("%s\n", error_buf);
printf("%s\n", error_buf);
goto fail2;
}