summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt60
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md25
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf8
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf7
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf6
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf7
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf6
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf6
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf6
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf6
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh124
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld274
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c272
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h46
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h41
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh27
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c29
17 files changed, 950 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt
new file mode 100644
index 000000000..8b2af15eb
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt
@@ -0,0 +1,60 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+cmake_minimum_required(VERSION 3.8.2)
+
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+project(wamr)
+
+enable_language (ASM)
+
+set (WAMR_BUILD_PLATFORM "zephyr")
+
+# Build as X86_32 by default, change to "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS" or "XTENSA"
+# if we want to support arm, thumb, mips or xtensa
+if (NOT DEFINED WAMR_BUILD_TARGET)
+ set (WAMR_BUILD_TARGET "X86_32")
+endif ()
+
+if (NOT DEFINED WAMR_BUILD_INTERP)
+ # Enable Interpreter by default
+ set (WAMR_BUILD_INTERP 1)
+endif ()
+
+if (NOT DEFINED WAMR_BUILD_AOT)
+ # Enable AOT by default.
+ set (WAMR_BUILD_AOT 1)
+endif ()
+
+if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
+ # Enable libc builtin support by default
+ set (WAMR_BUILD_LIBC_BUILTIN 1)
+endif ()
+
+if (NOT DEFINED WAMR_BUILD_LIBC_WASI)
+ # Disable libc wasi support by default
+ set (WAMR_BUILD_LIBC_WASI 0)
+endif ()
+
+if (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64" OR WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32")
+ set (WAMR_BUILD_FAST_INTERP 1)
+endif ()
+
+# Override the global heap usage
+if (NOT DEFINED WAMR_BUILD_GLOBAL_HEAP_POOL)
+ set (WAMR_BUILD_GLOBAL_HEAP_POOL 1)
+endif ()
+
+# Override the global heap size for small devices
+if (NOT DEFINED WAMR_BUILD_GLOBAL_HEAP_SIZE)
+ set (WAMR_BUILD_GLOBAL_HEAP_SIZE 131072) # 128 KB
+endif ()
+
+set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
+
+include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
+
+target_sources(app PRIVATE
+ ${WAMR_RUNTIME_LIB_SOURCE}
+ src/main.c)
+
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md
new file mode 100644
index 000000000..e02398b0b
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md
@@ -0,0 +1,25 @@
+# Build with Docker
+
+To have a quicker start, a Docker container of the Zephyr setup can be generated.
+
+## Build Docker container
+
+``` Bash
+docker build --build-arg DOCKER_UID=$(id -u) . -t wamr-zephyr
+```
+
+## Run Docker container to build images
+
+Enter the docker container (maps the toplevel wasm-micro-runtime repo as volume):
+
+``` Bash
+docker run -ti -v $PWD/../../../..:/home/wamr/source --device=/dev/ttyUSB0 wamr-zephyr
+```
+
+Adopt the device or remove if not needed.
+
+And then in the docker container:
+
+``` Bash
+./build_and_run.sh esp32c3
+``` \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf
new file mode 100644
index 000000000..5d6a67f9d
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf
@@ -0,0 +1,8 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
+CONFIG_HAVE_CUSTOM_LINKER_SCRIPT=y
+CONFIG_CUSTOM_LINKER_SCRIPT="esp32_custom_linker.ld"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf
new file mode 100644
index 000000000..c495644b7
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf
@@ -0,0 +1,7 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_ARM_MPU=y
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf
new file mode 100644
index 000000000..7f4a32832
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf
new file mode 100644
index 000000000..d248565fa
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf
@@ -0,0 +1,7 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_ARM_MMU=n
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf
new file mode 100644
index 000000000..f3705504b
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=n
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf
new file mode 100644
index 000000000..f3705504b
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=n
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf
new file mode 100644
index 000000000..7f4a32832
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf
new file mode 100644
index 000000000..7f4a32832
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf
@@ -0,0 +1,6 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+CONFIG_STACK_SENTINEL=y
+CONFIG_PRINTK=y
+CONFIG_LOG=y
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh
new file mode 100755
index 000000000..921f88363
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+X86_TARGET="x86"
+STM32_TARGET="stm32"
+ESP32_TARGET="esp32"
+ESP32C3_TARGET="esp32c3"
+PARTICLE_ARGON_TARGET="particle_argon"
+QEMU_CORTEX_A53="qemu_cortex_a53"
+QEMU_XTENSA_TARGET="qemu_xtensa"
+QEMU_RISCV64_TARGET="qemu_riscv64"
+QEMU_RISCV32_TARGET="qemu_riscv32"
+QEMU_ARC_TARGET="qemu_arc"
+
+usage ()
+{
+ echo "USAGE:"
+ echo "$0 $X86_TARGET|$STM32_TARGET|$ESP32_TARGET|$ESP32C3_TARGET|$PARTICLE_ARGON_TARGET|$QEMU_CORTEX_A53|$QEMU_XTENSA_TARGET|$QEMU_RISCV64_TARGET|$QEMU_RISCV32_TARGET|$QEMU_ARC_TARGET"
+ echo "Example:"
+ echo " $0 $X86_TARGET"
+ echo " $0 $STM32_TARGET"
+ echo " $0 $ESP32_TARGET"
+ echo " $0 $ESP32C3_TARGET"
+ echo " $0 $PARTICLE_ARGON_TARGET"
+ echo " $0 $QEMU_CORTEX_A53"
+ echo " $0 $QEMU_XTENSA_TARGET"
+ echo " $0 $QEMU_RISCV64_TARGET"
+ echo " $0 $QEMU_RISCV32_TARGET"
+ echo " $0 $QEMU_ARC_TARGET"
+ exit 1
+}
+
+if [ $# != 1 ] ; then
+ usage
+fi
+
+TARGET=$1
+
+case $TARGET in
+ $X86_TARGET)
+ west build -b qemu_x86_nommu \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=X86_32
+ west build -t run
+ ;;
+ $STM32_TARGET)
+ west build -b nucleo_f767zi \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=THUMBV7
+ west flash
+ ;;
+ $ESP32_TARGET)
+ export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
+ if [[ -z "${ESPRESSIF_TOOLCHAIN_PATH}" ]]; then
+ echo "Set ESPRESSIF_TOOLCHAIN_PATH to your espressif toolchain"
+ exit 1
+ fi
+ west build -b esp32 \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=XTENSA
+ # west flash will discover the device
+ west flash
+ ;;
+ $ESP32C3_TARGET)
+ export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
+ if [[ -z "${ESPRESSIF_TOOLCHAIN_PATH}" ]]; then
+ echo "Set ESPRESSIF_TOOLCHAIN_PATH to your espressif toolchain"
+ exit 1
+ fi
+ west build -b esp32c3_devkitm \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=RISCV32_ILP32
+ # west flash will discover the device
+ west flash
+ ;;
+ $PARTICLE_ARGON_TARGET)
+ west build -b particle_argon \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=THUMBV7
+ # west flash will discover the device
+ west flash
+ ;;
+ $QEMU_XTENSA_TARGET)
+ west build -b qemu_xtensa \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=XTENSA
+ west build -t run
+ ;;
+ $QEMU_CORTEX_A53)
+ west build -b qemu_cortex_a53 \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=AARCH64
+ west build -t run
+ ;;
+ $QEMU_RISCV64_TARGET)
+ west build -b qemu_riscv64 \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=RISCV64_LP64 \
+ -DWAMR_BUILD_AOT=0
+ west build -t run
+ ;;
+ $QEMU_RISCV32_TARGET)
+ west build -b qemu_riscv32 \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=RISCV32_ILP32 \
+ -DWAMR_BUILD_AOT=0
+ west build -t run
+ ;;
+ $QEMU_ARC_TARGET)
+ west build -b qemu_arc_em \
+ . -p always -- \
+ -DWAMR_BUILD_TARGET=ARC \
+ -DWAMR_BUILD_AOT=0
+ west build -t run
+ ;;
+ *)
+ echo "unsupported target: $TARGET"
+ usage
+ exit 1
+ ;;
+esac
+
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld
new file mode 100644
index 000000000..35932050f
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2016 Cadence Design Systems, Inc.
+ * Copyright (c) 2017 Intel Corporation
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * @file
+ * @brief Linker command/script file
+ *
+ * Linker script for the Xtensa platform.
+ */
+
+#include <devicetree.h>
+#include <autoconf.h>
+#include <linker/sections.h>
+#include <linker/linker-defs.h>
+#include <linker/linker-tool.h>
+
+#define RAMABLE_REGION dram0_0_seg :dram0_0_phdr
+#define RAMABLE_REGION1 dram0_1_seg :dram0_0_phdr
+#define ROMABLE_REGION iram0_0_seg :iram0_0_phdr
+
+PROVIDE ( __stack = 0x3ffe3f20 );
+
+PROVIDE ( esp32_rom_uart_tx_one_char = 0x40009200 );
+PROVIDE ( esp32_rom_uart_rx_one_char = 0x400092d0 );
+PROVIDE ( esp32_rom_uart_attach = 0x40008fd0 );
+PROVIDE ( esp32_rom_intr_matrix_set = 0x4000681c );
+PROVIDE ( esp32_rom_gpio_matrix_in = 0x40009edc );
+PROVIDE ( esp32_rom_gpio_matrix_out = 0x40009f0c );
+PROVIDE ( esp32_rom_Cache_Flush = 0x40009a14 );
+PROVIDE ( esp32_rom_Cache_Read_Enable = 0x40009a84 );
+PROVIDE ( esp32_rom_ets_set_appcpu_boot_addr = 0x4000689c );
+
+MEMORY
+{
+ iram0_0_seg(RX): org = 0x40080000, len = 0x20000
+ iram0_2_seg(RX): org = 0x400D0018, len = 0x330000
+ dram0_0_seg(RW): org = 0x3FFB0000, len = 0x30000
+ dram0_1_seg(RWX):org = 0x400A0000, len = 0x20000
+ drom0_0_seg(R): org = 0x3F400010, len = 0x800000
+ rtc_iram_seg(RWX): org = 0x400C0000, len = 0x2000
+ rtc_slow_seg(RW): org = 0x50000000, len = 0x1000
+#ifdef CONFIG_GEN_ISR_TABLES
+ IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000
+#endif
+}
+
+PHDRS
+{
+ iram0_0_phdr PT_LOAD;
+ dram0_0_phdr PT_LOAD;
+}
+
+/* Default entry point: */
+PROVIDE ( _ResetVector = 0x40000400 );
+ENTRY(CONFIG_KERNEL_ENTRY)
+
+_rom_store_table = 0;
+
+PROVIDE(_memmap_vecbase_reset = 0x40000450);
+PROVIDE(_memmap_reset_vector = 0x40000400);
+
+SECTIONS
+{
+
+#include <linker/rel-sections.ld>
+
+ /* RTC fast memory holds RTC wake stub code,
+ including from any source file named rtc_wake_stub*.c
+ */
+ .rtc.text :
+ {
+ . = ALIGN(4);
+ *(.rtc.literal .rtc.text)
+ *rtc_wake_stub*.o(.literal .text .literal.* .text.*)
+ } >rtc_iram_seg
+
+ /* RTC slow memory holds RTC wake stub
+ data/rodata, including from any source file
+ named rtc_wake_stub*.c
+ */
+ .rtc.data :
+ {
+ _rtc_data_start = ABSOLUTE(.);
+ *(.rtc.data)
+ *(.rtc.rodata)
+ *rtc_wake_stub*.o(.data .rodata .data.* .rodata.* .bss .bss.*)
+ _rtc_data_end = ABSOLUTE(.);
+ } > rtc_slow_seg
+
+ /* RTC bss, from any source file named rtc_wake_stub*.c */
+ .rtc.bss (NOLOAD) :
+ {
+ _rtc_bss_start = ABSOLUTE(.);
+ *rtc_wake_stub*.o(.bss .bss.*)
+ *rtc_wake_stub*.o(COMMON)
+ _rtc_bss_end = ABSOLUTE(.);
+ } > rtc_slow_seg
+
+ /* Send .iram0 code to iram */
+ .iram0.vectors : ALIGN(4)
+ {
+ /* Vectors go to IRAM */
+ _init_start = ABSOLUTE(.);
+ /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */
+ . = 0x0;
+ KEEP(*(.WindowVectors.text));
+ . = 0x180;
+ KEEP(*(.Level2InterruptVector.text));
+ . = 0x1c0;
+ KEEP(*(.Level3InterruptVector.text));
+ . = 0x200;
+ KEEP(*(.Level4InterruptVector.text));
+ . = 0x240;
+ KEEP(*(.Level5InterruptVector.text));
+ . = 0x280;
+ KEEP(*(.DebugExceptionVector.text));
+ . = 0x2c0;
+ KEEP(*(.NMIExceptionVector.text));
+ . = 0x300;
+ KEEP(*(.KernelExceptionVector.text));
+ . = 0x340;
+ KEEP(*(.UserExceptionVector.text));
+ . = 0x3C0;
+ KEEP(*(.DoubleExceptionVector.text));
+ . = 0x400;
+ *(.*Vector.literal)
+
+ *(.UserEnter.literal);
+ *(.UserEnter.text);
+ . = ALIGN (16);
+ *(.entry.text)
+ *(.init.literal)
+ *(.init)
+ _init_end = ABSOLUTE(.);
+
+ /* This goes here, not at top of linker script, so addr2line finds it last,
+ and uses it in preference to the first symbol in IRAM */
+ _iram_start = ABSOLUTE(0);
+ } GROUP_LINK_IN(ROMABLE_REGION)
+
+#include <linker/common-ram.ld>
+#include <linker/common-rom.ld>
+
+ SECTION_PROLOGUE(_TEXT_SECTION_NAME, , ALIGN(4))
+ {
+ /* Code marked as running out of IRAM */
+ _iram_text_start = ABSOLUTE(.);
+ *(.iram1 .iram1.*)
+ *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text)
+ *(.literal .text .literal.* .text.*)
+ _iram_text_end = ABSOLUTE(.);
+ } GROUP_LINK_IN(ROMABLE_REGION)
+
+ .dram0.text :
+ {
+ _data_start = ABSOLUTE(.);
+ *(.aot_code_buf)
+ _data_end = ABSOLUTE(.);
+ . = ALIGN(4);
+ } GROUP_LINK_IN(RAMABLE_REGION1)
+
+
+ .dram0.data :
+ {
+ _data_start = ABSOLUTE(.);
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d.*)
+ *(.data1)
+ *(.sdata)
+ *(.sdata.*)
+ *(.gnu.linkonce.s.*)
+ *(.sdata2)
+ *(.sdata2.*)
+ *(.gnu.linkonce.s2.*)
+ KEEP(*(.jcr))
+ *(.dram1 .dram1.*)
+ _data_end = ABSOLUTE(.);
+ . = ALIGN(4);
+ } GROUP_LINK_IN(RAMABLE_REGION)
+
+ SECTION_PROLOGUE(_RODATA_SECTION_NAME,,ALIGN(4))
+ {
+ _rodata_start = ABSOLUTE(.);
+ *(.rodata)
+ *(.rodata.*)
+ *(.gnu.linkonce.r.*)
+ *(.rodata1)
+ __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
+ KEEP (*(.xt_except_table))
+ KEEP (*(.gcc_except_table .gcc_except_table.*))
+ *(.gnu.linkonce.e.*)
+ *(.gnu.version_r)
+ KEEP (*(.eh_frame))
+ /* C++ constructor and destructor tables, properly ordered: */
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ /* C++ exception handlers table: */
+ __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
+ *(.xt_except_desc)
+ *(.gnu.linkonce.h.*)
+ __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
+ *(.xt_except_desc_end)
+ *(.dynamic)
+ *(.gnu.version_d)
+ . = ALIGN(4); /* this table MUST be 4-byte aligned */
+ _rodata_end = ABSOLUTE(.);
+ } GROUP_LINK_IN(RAMABLE_REGION)
+
+
+ /* Shared RAM */
+ SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),)
+ {
+ . = ALIGN (8);
+ _bss_start = ABSOLUTE(.);
+ *(.dynsbss)
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.sb.*)
+ *(.scommon)
+ *(.sbss2)
+ *(.sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ *(.dynbss)
+ *(.bss)
+ *(.bss.*)
+ *(.share.mem)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN (8);
+ _bss_end = ABSOLUTE(.);
+ } GROUP_LINK_IN(RAMABLE_REGION)
+
+
+ SECTION_DATA_PROLOGUE(_APP_NOINIT_SECTION_NAME, (NOLOAD),)
+ {
+ . = ALIGN (8);
+ *(.app_noinit)
+ *("app_noinit.*")
+ . = ALIGN (8);
+ _app_end = ABSOLUTE(.);
+ } GROUP_LINK_IN(RAMABLE_REGION)
+
+
+ SECTION_DATA_PROLOGUE(_NOINIT_SECTION_NAME, (NOLOAD),)
+ {
+ . = ALIGN (8);
+ *(.noinit)
+ *(".noinit.*")
+ . = ALIGN (8);
+ _heap_start = ABSOLUTE(.);
+ } GROUP_LINK_IN(RAMABLE_REGION)
+
+#ifdef CONFIG_GEN_ISR_TABLES
+#include <linker/intlist.ld>
+#endif
+
+#include <linker/debug-sections.ld>
+
+ SECTION_PROLOGUE(.xtensa.info, 0,)
+ {
+ *(.xtensa.info)
+ }
+
+}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c
new file mode 100644
index 000000000..8799e737a
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c
@@ -0,0 +1,272 @@
+/*
+ * 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_assert.h"
+#include "bh_log.h"
+#include "wasm_export.h"
+#if defined(BUILD_TARGET_RISCV64_LP64) || defined(BUILD_TARGET_RISCV32_ILP32)
+#include "test_wasm_riscv64.h"
+#else
+#include "test_wasm.h"
+#endif /* end of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */
+
+#if defined(BUILD_TARGET_RISCV64_LP64) || defined(BUILD_TARGET_RISCV32_ILP32)
+#if defined(BUILD_TARGET_RISCV64_LP64)
+#define CONFIG_GLOBAL_HEAP_BUF_SIZE 4360
+#define CONFIG_APP_STACK_SIZE 288
+#define CONFIG_MAIN_THREAD_STACK_SIZE 2400
+#else
+#define CONFIG_GLOBAL_HEAP_BUF_SIZE 5120
+#define CONFIG_APP_STACK_SIZE 512
+#define CONFIG_MAIN_THREAD_STACK_SIZE 4096
+#endif
+#define CONFIG_APP_HEAP_SIZE 256
+#else /* else of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */
+
+#define CONFIG_GLOBAL_HEAP_BUF_SIZE WASM_GLOBAL_HEAP_SIZE
+#define CONFIG_APP_STACK_SIZE 8192
+#define CONFIG_APP_HEAP_SIZE 8192
+
+#ifdef CONFIG_NO_OPTIMIZATIONS
+#define CONFIG_MAIN_THREAD_STACK_SIZE 8192
+#else
+#define CONFIG_MAIN_THREAD_STACK_SIZE 4096
+#endif
+
+#endif /* end of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */
+
+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, int argc,
+ char *argv[]);
+
+static void *
+app_instance_main(wasm_module_inst_t module_inst)
+{
+ const char *exception;
+ wasm_function_inst_t func;
+ wasm_exec_env_t exec_env;
+ unsigned argv[2] = { 0 };
+
+ if (wasm_runtime_lookup_function(module_inst, "main", NULL)
+ || wasm_runtime_lookup_function(module_inst, "__main_argc_argv",
+ NULL)) {
+ LOG_VERBOSE("Calling main funciton\n");
+ wasm_application_execute_main(module_inst, app_argc, app_argv);
+ }
+ else if ((func = wasm_runtime_lookup_function(module_inst, "app_main",
+ NULL))) {
+ exec_env =
+ wasm_runtime_create_exec_env(module_inst, CONFIG_APP_HEAP_SIZE);
+ if (!exec_env) {
+ os_printf("Create exec env failed\n");
+ return NULL;
+ }
+
+ LOG_VERBOSE("Calling app_main funciton\n");
+ wasm_runtime_call_wasm(exec_env, func, 0, argv);
+
+ if (!wasm_runtime_get_exception(module_inst)) {
+ os_printf("result: 0x%x\n", argv[0]);
+ }
+
+ wasm_runtime_destroy_exec_env(exec_env);
+ }
+ else {
+ os_printf("Failed to lookup function main or app_main to call\n");
+ return NULL;
+ }
+
+ if ((exception = wasm_runtime_get_exception(module_inst)))
+ os_printf("%s\n", exception);
+
+ return NULL;
+}
+
+#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
+static char global_heap_buf[CONFIG_GLOBAL_HEAP_BUF_SIZE] = { 0 };
+#endif
+
+#ifdef CONFIG_BOARD_ESP32
+#include "mem_alloc.h"
+/*
+esp32_technical_reference_manual:
+"
+The capacity of Internal SRAM 1 is 128 KB. Either CPU can read and write this
+memory at addresses 0x3FFE_0000 ~ 0x3FFF_FFFF of the data bus, and also at
+addresses 0x400A_0000 ~ 0x400B_FFFF of the instruction bus.
+"
+
+The custom linker script defines dram0_1_seg and map it to 0x400A_0000 ~
+0x400B_FFFF for instruction bus access. Here we define the buffer that will be
+placed to dram0_1_seg.
+*/
+static char esp32_executable_memory_buf[100 * 1024]
+ __attribute__((section(".aot_code_buf"))) = { 0 };
+
+/* the poll allocator for executable memory */
+static mem_allocator_t esp32_exec_mem_pool_allocator;
+
+static int
+esp32_exec_mem_init()
+{
+ if (!(esp32_exec_mem_pool_allocator =
+ mem_allocator_create(esp32_executable_memory_buf,
+ sizeof(esp32_executable_memory_buf))))
+ return -1;
+
+ return 0;
+}
+
+static void
+esp32_exec_mem_destroy()
+{
+ mem_allocator_destroy(esp32_exec_mem_pool_allocator);
+}
+
+static void *
+esp32_exec_mem_alloc(unsigned int size)
+{
+ return mem_allocator_malloc(esp32_exec_mem_pool_allocator, size);
+}
+
+static void
+esp32_exec_mem_free(void *addr)
+{
+ mem_allocator_free(esp32_exec_mem_pool_allocator, addr);
+}
+#endif /* end of #ifdef CONFIG_BOARD_ESP32 */
+
+void
+iwasm_main(void *arg1, void *arg2, void *arg3)
+{
+ int start, end;
+ start = k_uptime_get_32();
+ 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;
+ (void)arg2;
+ (void)arg3;
+
+ 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 Zephyr.
+#endif
+
+ /* initialize runtime environment */
+ if (!wasm_runtime_full_init(&init_args)) {
+ printf("Init runtime environment failed.\n");
+ return;
+ }
+
+#ifdef CONFIG_BOARD_ESP32
+ /* Initialize executable memory */
+ if (esp32_exec_mem_init() != 0) {
+ printf("Init executable memory failed.\n");
+ goto fail1;
+ }
+ /* Set hook functions for executable memory management */
+ set_exec_mem_alloc_func(esp32_exec_mem_alloc, esp32_exec_mem_free);
+#endif
+
+#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);
+#ifdef CONFIG_BOARD_ESP32
+ goto fail1_1;
+#else
+ goto fail1;
+#endif
+ }
+
+ /* instantiate the module */
+ if (!(wasm_module_inst = wasm_runtime_instantiate(
+ wasm_module, CONFIG_APP_STACK_SIZE, CONFIG_APP_HEAP_SIZE,
+ error_buf, sizeof(error_buf)))) {
+ printf("%s\n", error_buf);
+ goto fail2;
+ }
+
+ /* invoke the main function */
+ 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);
+
+#ifdef CONFIG_BOARD_ESP32
+fail1_1:
+ /* destroy executable memory */
+ esp32_exec_mem_destroy();
+#endif
+
+fail1:
+ /* destroy runtime environment */
+ wasm_runtime_destroy();
+
+ end = k_uptime_get_32();
+
+ printf("elpase: %d\n", (end - start));
+}
+
+#define MAIN_THREAD_STACK_SIZE (CONFIG_MAIN_THREAD_STACK_SIZE)
+#define MAIN_THREAD_PRIORITY 5
+
+K_THREAD_STACK_DEFINE(iwasm_main_thread_stack, MAIN_THREAD_STACK_SIZE);
+static struct k_thread iwasm_main_thread;
+
+bool
+iwasm_init(void)
+{
+ k_tid_t tid = k_thread_create(
+ &iwasm_main_thread, iwasm_main_thread_stack, MAIN_THREAD_STACK_SIZE,
+ iwasm_main, NULL, NULL, NULL, MAIN_THREAD_PRIORITY, 0, K_NO_WAIT);
+ return tid ? true : false;
+}
+void
+main(void)
+{
+ iwasm_init();
+}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h
new file mode 100644
index 000000000..a729cadef
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h
@@ -0,0 +1,46 @@
+/*
+ * 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 __aligned(4) 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
+};
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h
new file mode 100644
index 000000000..1b45211d7
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+unsigned char __aligned(4) 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, 0x12, 0x03,
+ 0x7F, 0x01, 0x41, 0xC0, 0x01, 0x0B, 0x7F, 0x00, 0x41, 0x3A, 0x0B, 0x7F,
+ 0x00, 0x41, 0xC0, 0x01, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, 0x6D,
+ 0x6F, 0x72, 0x79, 0x02, 0x00, 0x04, 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x04,
+ 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, 0x0A, 0xB1, 0x01, 0x01, 0xAE, 0x01, 0x01, 0x03, 0x7F,
+ 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, 0x24,
+ 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x80, 0x80, 0x80, 0x00, 0x10,
+ 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, 0x10,
+ 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, 0x41, 0xA8,
+ 0x80, 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, 0x80, 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, 0x80, 0x80, 0x80,
+ 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, 0x8D, 0x80,
+ 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, 0x36, 0x02,
+ 0x00, 0x41, 0x93, 0x80, 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, 0x40, 0x01, 0x00, 0x41, 0x00, 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
+};
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh
new file mode 100755
index 000000000..73e734935
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh
@@ -0,0 +1,27 @@
+# Copyright (C) 2019 Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+WAMR_DIR=${PWD}/../../..
+
+echo "Build wasm app .."
+/opt/wasi-sdk/bin/clang -O3 \
+ -z stack-size=128 -Wl,--initial-memory=65536 \
+ -Wl,--global-base=0 \
+ -o test.wasm main.c \
+ -Wl,--export=main -Wl,--export=__main_argc_argv \
+ -Wl,--export=__data_end -Wl,--export=__heap_base \
+ -Wl,--strip-all,--no-entry \
+ -Wl,--allow-undefined \
+ -nostdlib \
+
+echo "Build binarydump tool .."
+rm -fr build && mkdir build && cd build
+cmake ../../../../../../../test-tools/binarydump-tool
+make
+cd ..
+
+echo "Generate test_wasm.h .."
+./build/binarydump -o test_wasm.h -n wasm_test_file test.wasm
+cp -a test_wasm.h ../test_wasm_riscv64.h
+
+echo "Done"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c
new file mode 100644
index 000000000..026cb8fd1
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char **argv)
+{
+ char *buf;
+
+ printf("Hello world!\n");
+
+ buf = malloc(16);
+ if (!buf) {
+ printf("malloc buf failed\n");
+ return -1;
+ }
+
+ printf("buf ptr: %p\n", buf);
+
+ snprintf(buf, 1024, "%s", "1234\n");
+ printf("buf: %s", buf);
+
+ free(buf);
+ return 0;
+}