diff --git a/core/README.md b/core/README.md index a3603068..2b437ac4 100644 --- a/core/README.md +++ b/core/README.md @@ -2,6 +2,70 @@ Introduction ============== This project aims to demonstrate wasm app management and programming model of WAMR. +Directory structure +------------------------------ +
+simple/ +├── build.sh +├── CMakeLists.txt +├── README.md +├── src +│ ├── ext-lib-export.c +│ ├── iwasm_main.c +│ └── main.c +└── wasm-apps + ├── event_publisher + │ └── event_publisher.c + ├── event_subscriber + │ └── event_subscriber.c + ├── request_handler + │ └── request_handler.c + ├── request_sender + │ └── request_sender.c + ├── sensor + │ └── sensor.c + └── timer + └── timer.c ++ +- build.sh + The script to build all binaries. +- CMakeLists.txt + CMake file used to build the simple application. +- README.md + The file you are reading currently. +- src/ext-lib-export.c + This file is used to export native APIs. See README.md in WAMR root directory for detail. +- src/iwam_main.c + This file should be implemented by platform integrator in which a host interface is provided to interact with WAMR app-manager. See `{WAMR_ROOT}/core/app-mgr/app-mgr-shared/app-manager-export.h` for the definition of the host interface. +``` + /* Interfaces of host communication */ +typedef struct host_interface { + host_init_func init; + host_send_fun send; + host_destroy_fun destroy; +} host_interface; +``` +``` +host_interface interface = { + .init = host_init, + .send = host_send, + .destroy = host_destroy + }; +``` +This interface is passed to app-manager by calling +``` +app_manager_startup(&interface); +``` + +The `host_init_func` is automatically called when app-manager startup. And `host_send_fun` will be called by app-manager to send data to host anytime. +>Note: Currently since app-manager will keep running and never exit, `host_destroy_fun` has no chance to get executed. So you can leave this API implementation empty. + +- src/main.c + The main file. +- wasm-apps + Source files of sample wasm applications. + Build all binaries ============== Execute the build.sh script then all binaries including wasm application files would be generated in 'out' directory.