summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh
blob: 921f88363755b8dbe20b878b8e1a2b7f18a03f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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