Skip to content

Commit

Permalink
sdk build tools and app framework updates (bytecodealliance#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
xwang98 authored Feb 22, 2020
1 parent a4ac16a commit 82b0bb4
Show file tree
Hide file tree
Showing 30 changed files with 564 additions and 725 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Menu configuration is supported for easy integration of runtime components and a

```
cd wamr-sdk
./menuconfig.sh
./build_sdk.sh -i -n [profile name]
```

<img src="./doc/pics/wamr_menu_config.png" alt="wamr build menu configuration" style="zoom:80%;" />
Expand All @@ -141,7 +141,7 @@ simple/
└── lib
```

The tool **build_sdk.sh** can be also directly executed by passing the configuration arguments, which is how each WAMR sample project builds the WAMR SDK for its own building profile.


### Use Runtime SDK

Expand Down
94 changes: 0 additions & 94 deletions core/app-framework/app-native-shared/native_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,100 +34,6 @@

/*char *wa_strdup(const char *);*/

/*
* request/response interfaces
*/

bool
wasm_response_send(wasm_exec_env_t exec_env,
int32 buffer_offset, int size);
void
wasm_register_resource(wasm_exec_env_t exec_env,
int32 url_offset);
void
wasm_post_request(wasm_exec_env_t exec_env,
int32 buffer_offset, int size);
void
wasm_sub_event(wasm_exec_env_t exec_env,
int32 url_offset);

/*
* sensor interfaces
*/

bool
wasm_sensor_config(wasm_exec_env_t exec_env,
uint32 sensor, int interval, int bit_cfg, int delay);
uint32
wasm_sensor_open(wasm_exec_env_t exec_env,
int32 name_offset, int instance);
bool
wasm_sensor_config_with_attr_container(wasm_exec_env_t exec_env,
uint32 sensor,
int32 buffer_offset, int len);
bool
wasm_sensor_close(wasm_exec_env_t exec_env,
uint32 sensor);

/*
* timer interfaces
*/

typedef unsigned int timer_id_t;

timer_id_t
wasm_create_timer(wasm_exec_env_t exec_env,
int interval, bool is_period, bool auto_start);
void
wasm_timer_destroy(wasm_exec_env_t exec_env, timer_id_t timer_id);
void
wasm_timer_cancel(wasm_exec_env_t exec_env, timer_id_t timer_id);
void
wasm_timer_restart(wasm_exec_env_t exec_env,
timer_id_t timer_id, int interval);
uint32
wasm_get_sys_tick_ms(wasm_exec_env_t exec_env);

/*
* connection interfaces
*/

uint32
wasm_open_connection(wasm_exec_env_t exec_env,
int32 name_offset, int32 args_offset, uint32 len);
void
wasm_close_connection(wasm_exec_env_t exec_env,
uint32 handle);
int
wasm_send_on_connection(wasm_exec_env_t exec_env,
uint32 handle, int32 data_offset, uint32 len);
bool
wasm_config_connection(wasm_exec_env_t exec_env,
uint32 handle, int32 cfg_offset, uint32 len);

/**
* gui interfaces
*/

void
wasm_obj_native_call(wasm_exec_env_t exec_env,
int32 func_id, uint32 argv_offset, uint32 argc);

void
wasm_btn_native_call(wasm_exec_env_t exec_env,
int32 func_id, uint32 argv_offset, uint32 argc);

void
wasm_label_native_call(wasm_exec_env_t exec_env,
int32 func_id, uint32 argv_offset, uint32 argc);

void
wasm_cb_native_call(wasm_exec_env_t exec_env,
int32 func_id, uint32 argv_offset, uint32 argc);

void
wasm_list_native_call(wasm_exec_env_t exec_env,
int32 func_id, uint32 argv_offset, uint32 argc);

#endif /* end of _NATIVE_INTERFACE_H */

14 changes: 14 additions & 0 deletions core/app-framework/base/native/base_lib.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

EXPORT_WASM_API(wasm_register_resource),
EXPORT_WASM_API(wasm_response_send),
EXPORT_WASM_API(wasm_post_request),
EXPORT_WASM_API(wasm_sub_event),
EXPORT_WASM_API(wasm_create_timer),
EXPORT_WASM_API(wasm_timer_destroy),
EXPORT_WASM_API(wasm_timer_cancel),
EXPORT_WASM_API(wasm_timer_restart),
EXPORT_WASM_API(wasm_get_sys_tick_ms),
14 changes: 4 additions & 10 deletions core/app-framework/base/native/base_lib_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@
#include <stdlib.h>
#include <string.h>
#include "lib_export.h"
#include "base_lib_export.h"
#include "req_resp_native_api.h"
#include "timer_native_api.h"


static NativeSymbol extended_native_symbol_defs[] = {
/* TODO: use macro EXPORT_WASM_API() or EXPORT_WASM_API2() to
add functions to register. */
EXPORT_WASM_API(wasm_register_resource),
EXPORT_WASM_API(wasm_response_send),
EXPORT_WASM_API(wasm_post_request),
EXPORT_WASM_API(wasm_sub_event),
EXPORT_WASM_API(wasm_create_timer),
EXPORT_WASM_API(wasm_timer_destroy),
EXPORT_WASM_API(wasm_timer_cancel),
EXPORT_WASM_API(wasm_timer_restart),
EXPORT_WASM_API(wasm_get_sys_tick_ms),
#include "base_lib.inl"
};

int get_base_lib_export_apis(NativeSymbol **p_base_lib_apis)
Expand Down
13 changes: 0 additions & 13 deletions core/app-framework/base/native/base_lib_export.h

This file was deleted.

32 changes: 0 additions & 32 deletions core/app-framework/base/native/req_resp_api.h

This file was deleted.

36 changes: 36 additions & 0 deletions core/app-framework/base/native/req_resp_native_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#ifndef _REQ_RESP_API_H_
#define _REQ_RESP_API_H_

#include "bh_platform.h"
#include "wasm_export.h"

#ifdef __cplusplus
extern "C" {
#endif

bool
wasm_response_send(wasm_exec_env_t exec_env,
int32 buffer_offset, int size);
void
wasm_register_resource(wasm_exec_env_t exec_env,
int32 url_offset);
void
wasm_post_request(wasm_exec_env_t exec_env,
int32 buffer_offset, int size);
void
wasm_sub_event(wasm_exec_env_t exec_env,
int32 url_offset);



#ifdef __cplusplus
}
#endif

#endif /* end of _REQ_RESP_API_H_ */

37 changes: 0 additions & 37 deletions core/app-framework/base/native/timer_api.h

This file was deleted.

43 changes: 43 additions & 0 deletions core/app-framework/base/native/timer_native_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#ifndef _TIMER_API_H_
#define _TIMER_API_H_

#include "bh_platform.h"
#include "wasm_export.h"


#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned int timer_id_t;

/*
* timer interfaces
*/

typedef unsigned int timer_id_t;

timer_id_t
wasm_create_timer(wasm_exec_env_t exec_env,
int interval, bool is_period, bool auto_start);
void
wasm_timer_destroy(wasm_exec_env_t exec_env, timer_id_t timer_id);
void
wasm_timer_cancel(wasm_exec_env_t exec_env, timer_id_t timer_id);
void
wasm_timer_restart(wasm_exec_env_t exec_env,
timer_id_t timer_id, int interval);
uint32
wasm_get_sys_tick_ms(wasm_exec_env_t exec_env);

#ifdef __cplusplus
}
#endif

#endif /* end of _TIMER_API_H_ */

1 change: 1 addition & 0 deletions core/app-framework/base/native/timer_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "bh_list.h"
#include "bh_thread.h"
#include "bh_time.h"
#include "timer_native_api.h"

static bool timer_thread_run = true;

Expand Down
32 changes: 0 additions & 32 deletions core/app-framework/connection/native/connection_api.h

This file was deleted.

Loading

0 comments on commit 82b0bb4

Please sign in to comment.