summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:19:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-24 09:53:24 +0000
commitb5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch)
treed4d31289c39fc00da064a825df13a0b98ce95b10 /fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things
parentAdding upstream version 1.44.3. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.46.3.upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk130
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c121
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h46
3 files changed, 0 insertions, 297 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk
deleted file mode 100644
index 383e0b239..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk
+++ /dev/null
@@ -1,130 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# 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
-
-GLOBAL_DEFINES += BH_MALLOC=wasm_runtime_malloc
-GLOBAL_DEFINES += BH_FREE=wasm_runtime_free
-
-# Change it to THUMBV7M if you want to build for developerkit
-WAMR_BUILD_TARGET := X86_32
-
-WAMR_BUILD_PLATFORM := alios-things
-
-ifeq (${WAMR_BUILD_TARGET}, X86_32)
- GLOBAL_DEFINES += BUILD_TARGET_X86_32
- INVOKE_NATIVE := invokeNative_ia32.s
- AOT_RELOC := aot_reloc_x86_32.c
-else ifeq (${WAMR_BUILD_TARGET}, X86_64)
- GLOBAL_DEFINES += BUILD_TARGET_X86_64
- INVOKE_NATIVE := invokeNative_em64.s
- AOT_RELOC := aot_reloc_x86_64.c
-else ifeq ($(findstring ARM,$(WAMR_BUILD_TARGET)), ARM)
- GLOBAL_DEFINES += BUILD_TARGET_ARM
- GLOBAL_DEFINES += BUILD_TARGET=\"$(WAMR_BUILD_TARGET)\"
- INVOKE_NATIVE := invokeNative_arm.s
- AOT_RELOC := aot_reloc_arm.c
-else ifeq ($(findstring THUMB,$(WAMR_BUILD_TARGET)), THUMB)
- GLOBAL_DEFINES += BUILD_TARGET_THUMB
- GLOBAL_DEFINES += BUILD_TARGET=\"$(WAMR_BUILD_TARGET)\"
- INVOKE_NATIVE := invokeNative_thumb.s
- AOT_RELOC := aot_reloc_thumb.c
-else ifeq (${WAMR_BUILD_TARGET}, MIPS)
- GLOBAL_DEFINES += BUILD_TARGET_MIPS
- INVOKE_NATIVE := invokeNative_mips.s
- AOT_RELOC := aot_reloc_mips.c
-else ifeq (${WAMR_BUILD_TARGET}, XTENSA)
- GLOBAL_DEFINES += BUILD_TARGET_XTENSA
- INVOKE_NATIVE := invokeNative_xtensa.s
- AOT_RELOC := aot_reloc_xtensa.c
-else
- $(error Build target isn't set)
-endif
-
-# Enable Interpreter by default.
-WAMR_BUILD_INTERP = 1
-
-# Enable AOT by default.
-WAMR_BUILD_AOT = 1
-
-# Override the global heap usage
-ifndef WAMR_BUILD_GLOBAL_HEAP_POOL
-WAMR_BUILD_GLOBAL_HEAP_POOL=1
-endif
-GLOBAL_DEFINES += WASM_ENABLE_GLOBAL_HEAP_POOL=${WAMR_BUILD_GLOBAL_HEAP_POOL}
-
-# Override the global heap size for small devices
-ifndef WAMR_BUILD_GLOBAL_HEAP_SIZE
-WAMR_BUILD_GLOBAL_HEAP_SIZE = 262144 # 256 kB
-endif
-GLOBAL_DEFINES += WASM_GLOBAL_HEAP_SIZE=${WAMR_BUILD_GLOBAL_HEAP_SIZE}
-
-ifeq (${WAMR_BUILD_INTERP}, 1)
-GLOBAL_DEFINES += WASM_ENABLE_INTERP=1
-endif
-
-ifeq (${WAMR_BUILD_AOT}, 1)
-GLOBAL_DEFINES += WASM_ENABLE_AOT=1
-endif
-
-GLOBAL_DEFINES += WASM_ENABLE_LIBC_BUILTIN=1
-
-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)
-GLOBAL_INCLUDES += ${IWASM_ROOT}/interpreter
-endif
-
-ifeq (${WAMR_BUILD_AOT}, 1)
-GLOBAL_INCLUDES += ${IWASM_ROOT}/aot
-endif
-
-$(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_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 \
- ${SHARED_ROOT}/utils/bh_queue.c \
- ${SHARED_ROOT}/utils/bh_vector.c \
- ${SHARED_ROOT}/utils/runtime_timer.c \
- ${IWASM_ROOT}/libraries/libc-builtin/libc_builtin_wrapper.c \
- ${IWASM_ROOT}/common/wasm_application.c \
- ${IWASM_ROOT}/common/wasm_runtime_common.c \
- ${IWASM_ROOT}/common/wasm_native.c \
- ${IWASM_ROOT}/common/wasm_exec_env.c \
- ${IWASM_ROOT}/common/wasm_memory.c \
- ${IWASM_ROOT}/common/wasm_c_api.c \
- ${IWASM_ROOT}/common/arch/${INVOKE_NATIVE} \
- src/main.c
-
-ifeq (${WAMR_BUILD_INTERP}, 1)
-$(NAME)_SOURCES += ${IWASM_ROOT}/interpreter/wasm_interp_classic.c \
- ${IWASM_ROOT}/interpreter/wasm_loader.c \
- ${IWASM_ROOT}/interpreter/wasm_runtime.c
-endif
-
-ifeq (${WAMR_BUILD_AOT}, 1)
-$(NAME)_SOURCES += ${IWASM_ROOT}/aot/aot_loader.c \
- ${IWASM_ROOT}/aot/arch/${AOT_RELOC} \
- ${IWASM_ROOT}/aot/aot_runtime.c \
- ${IWASM_ROOT}/aot/aot_intrinsic.c
-endif
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c
deleted file mode 100644
index f2c6f85c1..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "bh_platform.h"
-#include "bh_log.h"
-#include "wasm_export.h"
-#include "test_wasm.h"
-
-static int app_argc;
-static char **app_argv;
-
-/**
- * Find the unique main function from a WASM module instance
- * and execute that function.
- *
- * @param module_inst the WASM module instance
- * @param argc the number of arguments
- * @param argv the arguments array
- *
- * @return true if the main function is called, false otherwise.
- */
-bool
-wasm_application_execute_main(wasm_module_inst_t module_inst, int32_t argc,
- char *argv[]);
-
-static void *
-app_instance_main(wasm_module_inst_t module_inst)
-{
- const char *exception;
-
- wasm_application_execute_main(module_inst, app_argc, app_argv);
- if ((exception = wasm_runtime_get_exception(module_inst)))
- printf("%s\n", exception);
- return NULL;
-}
-
-#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
-static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 };
-#endif
-
-void
-iwasm_main(void *arg1)
-{
- uint8 *wasm_file_buf = NULL;
- uint32 wasm_file_size;
- wasm_module_t wasm_module = NULL;
- wasm_module_inst_t wasm_module_inst = NULL;
- RuntimeInitArgs init_args;
- char error_buf[128];
-#if WASM_ENABLE_LOG != 0
- int log_verbose_level = 2;
-#endif
-
- (void)arg1;
-
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
-#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-#else
-#error Another memory allocation scheme than global heap pool is not implemented yet for Alios.
-#endif
-
- /* initialize runtime environment */
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return;
- }
-
-#if WASM_ENABLE_LOG != 0
- bh_log_set_verbose_level(log_verbose_level);
-#endif
-
- /* load WASM byte buffer from byte buffer of include file */
- wasm_file_buf = (uint8 *)wasm_test_file;
- wasm_file_size = sizeof(wasm_test_file);
-
- /* load WASM module */
- if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size,
- error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail1;
- }
-
- /* instantiate the module */
- if (!(wasm_module_inst = wasm_runtime_instantiate(
- wasm_module, 8 * 1024, 8 * 1024, error_buf, sizeof(error_buf)))) {
- printf("%s\n", error_buf);
- goto fail2;
- }
-
- app_instance_main(wasm_module_inst);
-
- /* destroy the module instance */
- wasm_runtime_deinstantiate(wasm_module_inst);
-
-fail2:
- /* unload the module */
- wasm_runtime_unload(wasm_module);
-
-fail1:
- /* destroy runtime environment */
- wasm_runtime_destroy();
-}
-
-#define DEFAULT_THREAD_STACKSIZE (6 * 1024)
-#define DEFAULT_THREAD_PRIORITY 50
-
-bool
-iwasm_init(void)
-{
- int ret =
- aos_task_new("wasm-main", iwasm_main, NULL, DEFAULT_THREAD_STACKSIZE);
- return ret == 0 ? true : false;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h
deleted file mode 100644
index 0c343024a..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-/**
- * The byte array buffer is the file content of a test wasm binary file,
- * which is compiled by wasi-sdk toolchain from C source file of:
- * product-mini/app-samples/hello-world/main.c.
- */
-unsigned char wasm_test_file[] = {
- 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60,
- 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01,
- 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75,
- 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C,
- 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72,
- 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66,
- 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01,
- 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03,
- 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B,
- 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65,
- 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74,
- 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65,
- 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61,
- 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03,
- 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02,
- 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00,
- 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41,
- 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00,
- 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00,
- 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03,
- 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41,
- 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21,
- 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88,
- 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00,
- 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03,
- 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10,
- 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80,
- 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80,
- 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08,
- 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25,
- 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66,
- 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77,
- 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63,
- 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00
-};