Fix some compilation warnings and add esp-idf platform for experiment (#454)
And fix some code indent issues.
This commit is contained in:
55
product-mini/platforms/esp-idf/CMakeLists.txt
Normal file
55
product-mini/platforms/esp-idf/CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# from ESP-IDF 4.0 examples/build_system/cmake/idf_as_lib
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(wamr_esp_idf C)
|
||||
|
||||
enable_language (ASM)
|
||||
|
||||
# Include for ESP-IDF build system functions
|
||||
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
|
||||
|
||||
# Create idf::esp32 and idf::freertos static libraries
|
||||
idf_build_process(esp32
|
||||
# try and trim the build; additional components
|
||||
# will be included as needed based on dependency tree
|
||||
#
|
||||
# although esptool_py does not generate static library,
|
||||
# processing the component is needed for flashing related
|
||||
# targets and file generation
|
||||
COMPONENTS esp32 freertos esptool_py
|
||||
SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig
|
||||
BUILD_DIR ${CMAKE_BINARY_DIR})
|
||||
|
||||
include_directories(build/config
|
||||
xtensa/include
|
||||
$ENV{IDF_PATH}/components/esp32/include
|
||||
$ENV{IDF_PATH}/components/esp_common/include
|
||||
$ENV{IDF_PATH}/components/esp_rom/include
|
||||
$ENV{IDF_PATH}/components/freertos/include
|
||||
$ENV{IDF_PATH}/components/heap/include
|
||||
$ENV{IDF_PATH}/components/soc/esp32/include
|
||||
$ENV{IDF_PATH}/components/xtensa/include
|
||||
$ENV{IDF_PATH}/components/xtensa/esp32/include)
|
||||
|
||||
set(WAMR_BUILD_PLATFORM "esp-idf")
|
||||
set(WAMR_BUILD_TARGET "XTENSA")
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
set(WAMR_BUILD_FAST_INTERP 1)
|
||||
set(WAMR_BUILD_AOT 1)
|
||||
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
set(WAMR_BUILD_LIBC_WASI 0)
|
||||
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||
|
||||
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
||||
|
||||
set(elf_file ${CMAKE_PROJECT_NAME}.elf)
|
||||
add_executable(${elf_file} main.c iwasm_main.c)
|
||||
|
||||
# Link the static libraries to the executable
|
||||
target_link_libraries(${elf_file} idf::esp32 idf::freertos idf::spi_flash vmlib)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# TODO: set WAMR root dir
|
||||
WAMR_ROOT := ../../../../
|
||||
WAMR_ROOT := ../../..
|
||||
|
||||
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) -Wno-unused-parameter -Wno-pedantic
|
||||
|
||||
@ -12,11 +12,11 @@ override PROJECT_CFLAGS := $(PROJECT_CFLAGS) \
|
||||
-I$(WAMR_INC_ROOT)/core/shared/utils \
|
||||
-I$(WAMR_INC_ROOT)/core/shared/mem-alloc \
|
||||
-I$(WAMR_INC_ROOT)/core/shared/platform/include \
|
||||
-I$(WAMR_INC_ROOT)/core/shared/platform/freertos \
|
||||
-I$(WAMR_INC_ROOT)/core/shared/platform/esp-idf \
|
||||
-I$(WAMR_INC_ROOT)/core/iwasm/interpreter
|
||||
|
||||
override PROJECT_CFLAGS := $(PROJECT_CFLAGS) \
|
||||
-DBH_PLATFORM_FREERTOS \
|
||||
-DBH_PLATFORM_ESP_IDF \
|
||||
-DBH_MALLOC=wasm_runtime_malloc \
|
||||
-DBH_FREE=wasm_runtime_free \
|
||||
-DBUILD_TARGET_X86_32 \
|
||||
@ -25,10 +25,11 @@ override PROJECT_CFLAGS := $(PROJECT_CFLAGS) \
|
||||
-DWASM_ENABLE_LIBC_BUILTIN=1
|
||||
|
||||
override PROJECT_CSRC := $(PROJECT_CSRC) \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/freertos/freertos_platform.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/freertos/freertos_thread.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/freertos/freertos_time.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/common/math/math.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/esp-idf/espidf_platform.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/esp-idf/espidf_thread.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_malloc.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_thread.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/platform/common/freertos/freertos_time.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/mem_alloc.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/ems/ems_kfc.c \
|
||||
$(WAMR_SRC_ROOT)/core/shared/mem-alloc/ems/ems_hmu.c \
|
||||
@ -50,5 +51,5 @@ override PROJECT_CSRC := $(PROJECT_CSRC) \
|
||||
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_interp_classic.c \
|
||||
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_loader.c \
|
||||
$(WAMR_SRC_ROOT)/core/iwasm/interpreter/wasm_runtime.c \
|
||||
$(WAMR_SRC_ROOT)/product-mini/platforms/freertos/simple/iwasm_main.c \
|
||||
$(WAMR_SRC_ROOT)/product-mini/platforms/freertos/simple/main.c
|
||||
$(WAMR_SRC_ROOT)/product-mini/platforms/esp-idf/iwasm_main.c \
|
||||
$(WAMR_SRC_ROOT)/product-mini/platforms/esp-idf/main.c
|
||||
@ -134,8 +134,6 @@ else
|
||||
CFLAGS += -DWASM_ENABLE_GLOBAL_HEAP_POOL=0
|
||||
endif
|
||||
|
||||
CFLAGS += -DBH_ENABLE_MEMORY_PROFILING=0
|
||||
|
||||
CFLAGS += -Wno-strict-prototypes -Wno-shadow -Wno-unused-variable
|
||||
CFLAGS += -Wno-int-conversion -Wno-implicit-function-declaration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user