Add a new extension library: connection (#39)

This commit is contained in:
wenyongh
2019-06-10 21:52:15 -05:00
committed by GitHub
parent 69d62f573a
commit 7f1e024fce
38 changed files with 1677 additions and 70 deletions

View File

@ -57,6 +57,8 @@ 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/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)
include (${APP_MGR_DIR}/app-manager/app_mgr.cmake)
include (${APP_MGR_DIR}/app-mgr-shared/app_mgr_shared.cmake)
@ -81,6 +83,8 @@ add_library (vmlib
${WASM_LIB_BASE_SOURCE}
${WASM_LIB_EXT_SOURCE}
${WASM_LIB_SENSOR_SOURCE}
${WASM_LIB_CONN_SOURCE}
${WASM_LIB_CONN_MGR_SOURCE}
${PLATFORM_SHARED_SOURCE}
${UTILS_SHARED_SOURCE}
${MEM_ALLOC_SHARED_SOURCE}

View File

@ -1,8 +1,11 @@
#include "lib_export.h"
#include "native_interface.h"
#include "connection_api.h"
#include "display_indev.h"
static NativeSymbol extended_native_symbol_defs[] = {
#include "runtime_sensor.inl"
#include "connection.inl"
EXPORT_WASM_API(display_init),
EXPORT_WASM_API(display_input_read),
EXPORT_WASM_API(display_flush),

View File

@ -46,6 +46,7 @@ static int baudrate = B115200;
extern void * thread_timer_check(void *);
extern void init_sensor_framework();
extern int aee_host_msg_callback(void *msg, uint16_t msg_len);
extern bool init_connection_framework();
#ifndef CONNECTION_UART
int listenfd = -1;
@ -441,6 +442,12 @@ int iwasm_main(int argc, char *argv[])
if (vm_thread_sys_init() != 0) {
goto fail1;
}
if (!init_connection_framework()) {
vm_thread_sys_destroy();
goto fail1;
}
extern void display_SDL_init();
display_SDL_init();

View File

@ -38,6 +38,7 @@ target_include_directories(app PRIVATE ${IWASM_ROOT}/runtime/include
${IWASM_ROOT}/lib/native/base
${IWASM_ROOT}/lib/native/libc
${IWASM_ROOT}/lib/native/extension/sensor
${IWASM_ROOT}/lib/native/extension/connection
${IWASM_ROOT}/lib/native-interface
${APP_MGR_ROOT}/app-manager
${APP_MGR_ROOT}/app-mgr-shared
@ -69,6 +70,8 @@ set (IWASM_SRCS ${IWASM_ROOT}/runtime/platform/zephyr/wasm_math.c
${IWASM_ROOT}/lib/native/base/timer_wrapper.c
${IWASM_ROOT}/lib/native/libc/libc_wrapper.c
${IWASM_ROOT}/lib/native/extension/sensor/runtime_sensor.c
${IWASM_ROOT}/lib/native/extension/connection/connection_wrapper.c
${IWASM_ROOT}/lib/native/extension/connection/zephyr/connection_lib_impl.c
${IWASM_ROOT}/lib/native-interface/attr_container.c
${IWASM_ROOT}/lib/native-interface/restful_utils.c
${APP_MGR_ROOT}/app-manager/app_manager.c

View File

@ -14,7 +14,17 @@
CC = emcc
LVGL_DIR = ${shell pwd}
CFLAGS += -O3 -DLV_CONF_INCLUDE_SIMPLE=1 -I$(LVGL_DIR)/ -I$(LVGL_DIR)/lvgl/ -I$(LVGL_DIR)/lv_drivers/ -I$(LVGL_DIR)/src/ -I../../../core/iwasm/lib/app-libs/base/ -I../../../core/iwasm/lib/native-interface/ -I../../../core/iwasm/lib/app-libs/extension/sensor
IWASM_DIR=../../../core/iwasm
CFLAGS += -O3 \
-DLV_CONF_INCLUDE_SIMPLE=1 \
-I$(LVGL_DIR)/ \
-I$(LVGL_DIR)/lvgl/ \
-I$(LVGL_DIR)/lv_drivers/ \
-I$(LVGL_DIR)/src/ \
-I$(IWASM_DIR)/lib/app-libs/base/ \
-I$(IWASM_DIR)/lib/native-interface/ \
-I$(IWASM_DIR)/lib/app-libs/extension/sensor \
-I$(IWASM_DIR)/lib/app-libs/extension/connection
SRCS += lvgl/lv_draw/lv_draw_line.c lvgl/lv_draw/lv_draw_rbasic.c
SRCS += lvgl/lv_draw/lv_draw_img.c lvgl/lv_draw/lv_draw_arc.c
@ -46,10 +56,11 @@ SRCS += lvgl/lv_core/lv_group.c lvgl/lv_core/lv_style.c lvgl/lv_core/lv_indev.c
SRCS += lvgl/lv_core/lv_vdb.c lvgl/lv_core/lv_obj.c lvgl/lv_core/lv_refr.c
SRCS += $(LVGL_DIR)/src/main.c
SRCS += ../../../core/iwasm/lib/app-libs/base/timer.c
# For app size consideration, not all but necessary app libs are included
SRCS += $(IWASM_DIR)/lib/app-libs/base/timer.c
all:
@$(CC) $(CFLAGS) $(SRCS) \
-s WASM=1 -s SIDE_MODULE=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 \
-s TOTAL_MEMORY=65536 -s TOTAL_STACK=2048\
-s "EXPORTED_FUNCTIONS=['_on_init', '_on_request', '_on_sensor_event', '_on_timer_callback']" \
-s "EXPORTED_FUNCTIONS=['_on_init', '_on_timer_callback']" \
-o ui_app.wasm