Simplify build setup for zephyr (#789)

Zephyr can apply board specific .conf and .overlay automatically,
move .conf to boards to make it easy to support different board without
addition command parameters.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2021-10-15 20:15:17 +08:00 committed by GitHub
parent b46b663c16
commit a121e45a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 5 additions and 16 deletions

View File

@ -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 <wamr_root_dir>/product-mini/platforms/zephyr/simple .
cd simple
ln -s <wamr_root_dir> wamr
source ../../zephyr-env.sh
source ../zephyr-env.sh
cd <wamr_root_dir>/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

View File

@ -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)

View File

@ -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