mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
Merge branch 'feature/ulp_include_sdkconfig_cmake' into 'master'
feat(ulp): import all sdkconfigs macros into cmake build See merge request espressif/esp-idf!32122
This commit is contained in:
commit
42bcb84013
@ -5,8 +5,8 @@ project(${ULP_APP_NAME} ASM C)
|
|||||||
add_executable(${ULP_APP_NAME})
|
add_executable(${ULP_APP_NAME})
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||||
|
|
||||||
option(ULP_COCPU_IS_RISCV "Use RISC-V based ULP" OFF)
|
# Import all sdkconfig variables into the cmake build
|
||||||
option(ULP_COCPU_IS_LP_CORE "Use RISC-V based LP Core" OFF)
|
include(${SDKCONFIG_CMAKE})
|
||||||
|
|
||||||
function(create_arg_file arguments output_file)
|
function(create_arg_file arguments output_file)
|
||||||
# Escape all spaces
|
# Escape all spaces
|
||||||
@ -20,7 +20,7 @@ endfunction()
|
|||||||
message(STATUS "Building ULP app ${ULP_APP_NAME}")
|
message(STATUS "Building ULP app ${ULP_APP_NAME}")
|
||||||
|
|
||||||
# Check the supported assembler version
|
# Check the supported assembler version
|
||||||
if(NOT (ULP_COCPU_IS_RISCV OR ULP_COCPU_IS_LP_CORE))
|
if(CONFIG_ULP_COPROC_TYPE_FSM)
|
||||||
check_expected_tool_version("esp32ulp-elf" ${CMAKE_ASM_COMPILER})
|
check_expected_tool_version("esp32ulp-elf" ${CMAKE_ASM_COMPILER})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ endif()
|
|||||||
set(ULP_MAP_GEN ${PYTHON} ${IDF_PATH}/components/ulp/esp32ulp_mapgen.py)
|
set(ULP_MAP_GEN ${PYTHON} ${IDF_PATH}/components/ulp/esp32ulp_mapgen.py)
|
||||||
get_filename_component(sdkconfig_dir ${SDKCONFIG_HEADER} DIRECTORY)
|
get_filename_component(sdkconfig_dir ${SDKCONFIG_HEADER} DIRECTORY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach(include ${COMPONENT_INCLUDES})
|
foreach(include ${COMPONENT_INCLUDES})
|
||||||
list(APPEND component_includes -I${include})
|
list(APPEND component_includes -I${include})
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -41,9 +43,9 @@ list(APPEND ULP_PREPROCESSOR_ARGS -I${IDF_PATH}/components/esp_system/ld)
|
|||||||
target_include_directories(${ULP_APP_NAME} PRIVATE ${COMPONENT_INCLUDES})
|
target_include_directories(${ULP_APP_NAME} PRIVATE ${COMPONENT_INCLUDES})
|
||||||
|
|
||||||
# Pre-process the linker script
|
# Pre-process the linker script
|
||||||
if(ULP_COCPU_IS_RISCV)
|
if(CONFIG_ULP_COPROC_TYPE_RISCV)
|
||||||
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/ulp_riscv.ld)
|
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/ulp_riscv.ld)
|
||||||
elseif(ULP_COCPU_IS_LP_CORE)
|
elseif(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
||||||
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/lp_core_riscv.ld)
|
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/lp_core_riscv.ld)
|
||||||
else()
|
else()
|
||||||
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/ulp_fsm.ld)
|
set(ULP_LD_TEMPLATE ${IDF_PATH}/components/ulp/ld/ulp_fsm.ld)
|
||||||
@ -69,8 +71,7 @@ target_link_options(${ULP_APP_NAME} PRIVATE SHELL:-T ${CMAKE_CURRENT_BINARY_DIR}
|
|||||||
|
|
||||||
# To avoid warning "Manually-specified variables were not used by the project"
|
# To avoid warning "Manually-specified variables were not used by the project"
|
||||||
set(bypassWarning "${IDF_TARGET}")
|
set(bypassWarning "${IDF_TARGET}")
|
||||||
set(bypassWarning "${CONFIG_ESP_ROM_HAS_LP_ROM}")
|
if(CONFIG_ULP_COPROC_TYPE_RISCV)
|
||||||
if(ULP_COCPU_IS_RISCV)
|
|
||||||
#risc-v ulp uses extra files for building:
|
#risc-v ulp uses extra files for building:
|
||||||
list(APPEND ULP_S_SOURCES
|
list(APPEND ULP_S_SOURCES
|
||||||
"${IDF_PATH}/components/ulp/ulp_riscv/ulp_core/ulp_riscv_vectors.S"
|
"${IDF_PATH}/components/ulp/ulp_riscv/ulp_core/ulp_riscv_vectors.S"
|
||||||
@ -98,7 +99,7 @@ if(ULP_COCPU_IS_RISCV)
|
|||||||
target_compile_definitions(${ULP_APP_NAME} PRIVATE IS_ULP_COCPU)
|
target_compile_definitions(${ULP_APP_NAME} PRIVATE IS_ULP_COCPU)
|
||||||
target_compile_definitions(${ULP_APP_NAME} PRIVATE ULP_RISCV_REGISTER_OPS)
|
target_compile_definitions(${ULP_APP_NAME} PRIVATE ULP_RISCV_REGISTER_OPS)
|
||||||
|
|
||||||
elseif(ULP_COCPU_IS_LP_CORE)
|
elseif(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
||||||
list(APPEND ULP_S_SOURCES
|
list(APPEND ULP_S_SOURCES
|
||||||
"${IDF_PATH}/components/ulp/lp_core/lp_core/start.S"
|
"${IDF_PATH}/components/ulp/lp_core/lp_core/start.S"
|
||||||
"${IDF_PATH}/components/ulp/lp_core/lp_core/vector.S"
|
"${IDF_PATH}/components/ulp/lp_core/lp_core/vector.S"
|
||||||
@ -168,7 +169,7 @@ else()
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ULP_COCPU_IS_LP_CORE)
|
if(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
||||||
set(ULP_BASE_ADDR "0x0")
|
set(ULP_BASE_ADDR "0x0")
|
||||||
else()
|
else()
|
||||||
set(ULP_BASE_ADDR "0x50000000")
|
set(ULP_BASE_ADDR "0x50000000")
|
||||||
|
@ -30,6 +30,7 @@ function(ulp_embed_binary app_name s_sources exp_dep_srcs)
|
|||||||
string(REPLACE ";" "|" ulp_s_sources "${ulp_s_sources}")
|
string(REPLACE ";" "|" ulp_s_sources "${ulp_s_sources}")
|
||||||
|
|
||||||
idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER)
|
idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER)
|
||||||
|
idf_build_get_property(sdkconfig_cmake SDKCONFIG_CMAKE)
|
||||||
idf_build_get_property(idf_path IDF_PATH)
|
idf_build_get_property(idf_path IDF_PATH)
|
||||||
idf_build_get_property(idf_target IDF_TARGET)
|
idf_build_get_property(idf_target IDF_TARGET)
|
||||||
idf_build_get_property(python PYTHON)
|
idf_build_get_property(python PYTHON)
|
||||||
@ -41,17 +42,11 @@ function(ulp_embed_binary app_name s_sources exp_dep_srcs)
|
|||||||
elseif(IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
|
elseif(IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
|
||||||
if(CONFIG_ULP_COPROC_TYPE_RISCV STREQUAL "y")
|
if(CONFIG_ULP_COPROC_TYPE_RISCV STREQUAL "y")
|
||||||
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-ulp-riscv.cmake)
|
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-ulp-riscv.cmake)
|
||||||
set(ULP_IS_RISCV ON)
|
|
||||||
else()
|
else()
|
||||||
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-${idf_target}-ulp.cmake)
|
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-${idf_target}-ulp.cmake)
|
||||||
set(ULP_IS_RISCV OFF)
|
|
||||||
endif()
|
endif()
|
||||||
elseif(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
elseif(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
||||||
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-lp-core-riscv.cmake)
|
set(TOOLCHAIN_FLAG ${idf_path}/components/ulp/cmake/toolchain-lp-core-riscv.cmake)
|
||||||
set(ULP_IS_LP_CORE_RISCV ON)
|
|
||||||
if(CONFIG_ESP_ROM_HAS_LP_ROM)
|
|
||||||
set(CONFIG_ESP_ROM_HAS_LP_ROM ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
externalproject_add(${app_name}
|
externalproject_add(${app_name}
|
||||||
@ -68,10 +63,8 @@ function(ulp_embed_binary app_name s_sources exp_dep_srcs)
|
|||||||
-DIDF_TARGET=${idf_target}
|
-DIDF_TARGET=${idf_target}
|
||||||
-DIDF_PATH=${idf_path}
|
-DIDF_PATH=${idf_path}
|
||||||
-DSDKCONFIG_HEADER=${SDKCONFIG_HEADER}
|
-DSDKCONFIG_HEADER=${SDKCONFIG_HEADER}
|
||||||
|
-DSDKCONFIG_CMAKE=${SDKCONFIG_CMAKE}
|
||||||
-DPYTHON=${python}
|
-DPYTHON=${python}
|
||||||
-DULP_COCPU_IS_RISCV=${ULP_IS_RISCV}
|
|
||||||
-DULP_COCPU_IS_LP_CORE=${ULP_IS_LP_CORE_RISCV}
|
|
||||||
-DCONFIG_ESP_ROM_HAS_LP_ROM=${CONFIG_ESP_ROM_HAS_LP_ROM}
|
|
||||||
${extra_cmake_args}
|
${extra_cmake_args}
|
||||||
BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/${app_name} --target build
|
BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/${app_name} --target build
|
||||||
BUILD_BYPRODUCTS ${ulp_artifacts} ${ulp_artifacts_extras} ${ulp_ps_sources}
|
BUILD_BYPRODUCTS ${ulp_artifacts} ${ulp_artifacts_extras} ${ulp_ps_sources}
|
||||||
|
Loading…
Reference in New Issue
Block a user