diff --git a/doc/build_wamr.md b/doc/build_wamr.md index 1203008f2..871f0708a 100644 --- a/doc/build_wamr.md +++ b/doc/build_wamr.md @@ -302,11 +302,8 @@ Zephyr You need to download the Zephyr source code first and embed WAMR into it. ``` Bash git clone https://github.com/zephyrproject-rtos/zephyr.git -cd zephyr/samples/ -cp -a /product-mini/platforms/zephyr/simple . -cd simple -ln -s wamr -source ../../zephyr-env.sh +source ../zephyr-env.sh +cd /product-mini/platforms/zephyr/simple # Execute the ./build_and_run.sh script with board name as parameter. Here take x86 as example: ./build_and_run.sh x86 diff --git a/product-mini/platforms/zephyr/simple/CMakeLists.txt b/product-mini/platforms/zephyr/simple/CMakeLists.txt index ed9b66e1e..148876af7 100644 --- a/product-mini/platforms/zephyr/simple/CMakeLists.txt +++ b/product-mini/platforms/zephyr/simple/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.8.2) -include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) -project(NONE) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wamr) enable_language (ASM) @@ -40,7 +40,7 @@ if (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64" OR WAMR_BUILD_TARGET STREQUAL "RIS set (WAMR_BUILD_FAST_INTERP 1) endif () -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wamr) +set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) diff --git a/product-mini/platforms/zephyr/simple/prj_esp32.conf b/product-mini/platforms/zephyr/simple/boards/esp32.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_esp32.conf rename to product-mini/platforms/zephyr/simple/boards/esp32.conf diff --git a/product-mini/platforms/zephyr/simple/prj_nucleo767zi.conf b/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_nucleo767zi.conf rename to product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_arc.conf b/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_arc.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_arc.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_cortex_a53.conf b/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_cortex_a53.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_riscv32.conf b/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_riscv32.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_riscv64.conf b/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_riscv64.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_x86_nommu.conf b/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_x86_nommu.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf diff --git a/product-mini/platforms/zephyr/simple/prj_qemu_xtensa.conf b/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf similarity index 100% rename from product-mini/platforms/zephyr/simple/prj_qemu_xtensa.conf rename to product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf diff --git a/product-mini/platforms/zephyr/simple/build_and_run.sh b/product-mini/platforms/zephyr/simple/build_and_run.sh index b5d1b6177..0d5d8146f 100755 --- a/product-mini/platforms/zephyr/simple/build_and_run.sh +++ b/product-mini/platforms/zephyr/simple/build_and_run.sh @@ -37,14 +37,12 @@ case $TARGET in $X86_TARGET) west build -b qemu_x86_nommu \ . -p always -- \ - -DCONF_FILE=prj_qemu_x86_nommu.conf \ -DWAMR_BUILD_TARGET=X86_32 west build -t run ;; $STM32_TARGET) west build -b nucleo_f767zi \ . -p always -- \ - -DCONF_FILE=prj_nucleo767zi.conf \ -DWAMR_BUILD_TARGET=THUMBV7 west flash ;; @@ -53,7 +51,6 @@ case $TARGET in west build -b esp32 \ . -p always -- \ -DESP_IDF_PATH=$ESP_IDF_PATH \ - -DCONF_FILE=prj_esp32.conf \ -DWAMR_BUILD_TARGET=XTENSA # suppose the serial port is /dev/ttyUSB1 and you should change to # the real name accordingly @@ -62,21 +59,18 @@ case $TARGET in $QEMU_XTENSA_TARGET) west build -b qemu_xtensa \ . -p always -- \ - -DCONF_FILE=prj_qemu_xtensa.conf \ -DWAMR_BUILD_TARGET=XTENSA west build -t run ;; $QEMU_CORTEX_A53) west build -b qemu_cortex_a53 \ . -p always -- \ - -DCONF_FILE=prj_qemu_cortex_a53.conf \ -DWAMR_BUILD_TARGET=AARCH64 west build -t run ;; $QEMU_RISCV64_TARGET) west build -b qemu_riscv64 \ . -p always -- \ - -DCONF_FILE=prj_qemu_riscv64.conf \ -DWAMR_BUILD_TARGET=RISCV64_LP64 \ -DWAMR_BUILD_AOT=0 west build -t run @@ -84,7 +78,6 @@ case $TARGET in $QEMU_RISCV32_TARGET) west build -b qemu_riscv32 \ . -p always -- \ - -DCONF_FILE=prj_qemu_riscv32.conf \ -DWAMR_BUILD_TARGET=RISCV32_ILP32 \ -DWAMR_BUILD_AOT=0 west build -t run @@ -92,7 +85,6 @@ case $TARGET in $QEMU_ARC_TARGET) west build -b qemu_arc_em \ . -p always -- \ - -DCONF_FILE=prj_qemu_arc.conf \ -DWAMR_BUILD_TARGET=ARC \ -DWAMR_BUILD_AOT=0 west build -t run