|
|
@@ -1,63 +1,18 @@
|
|
|
-if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
|
|
- spaces2list(ULP_S_SOURCES)
|
|
|
- foreach(ulp_s_source ${ULP_S_SOURCES})
|
|
|
- get_filename_component(ulp_s_source ${ulp_s_source} ABSOLUTE)
|
|
|
- list(APPEND ulp_s_sources ${ulp_s_source})
|
|
|
- endforeach()
|
|
|
+message(WARNING "Embedding ULP binary by including \
|
|
|
+${IDF_PATH}/components/ulp/component_ulp_common.cmake is deprecated. Use `ulp_embed_binary` instead. \
|
|
|
+See API Guide for more details.")
|
|
|
|
|
|
- foreach(ulp_s_source ${ulp_s_sources})
|
|
|
- get_filename_component(ulp_ps_source ${ulp_s_source} NAME_WE)
|
|
|
- set(ulp_ps_output ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ulp_ps_source}.ulp.S)
|
|
|
- list(APPEND ulp_ps_sources ${ulp_ps_output})
|
|
|
- endforeach()
|
|
|
+spaces2list(ULP_S_SOURCES)
|
|
|
+spaces2list(ULP_EXP_DEP_SRCS)
|
|
|
|
|
|
- set(ulp_artifacts_prefix ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME})
|
|
|
+foreach(ulp_s_source ${ULP_S_SOURCES})
|
|
|
+ get_filename_component(ulp_src ${ulp_s_source} ABSOLUTE BASE_DIR ${COMPONENT_DIR})
|
|
|
+ list(APPEND ulp_srcs ${ulp_src})
|
|
|
+endforeach()
|
|
|
|
|
|
- set(ulp_artifacts ${ulp_artifacts_prefix}.bin
|
|
|
- ${ulp_artifacts_prefix}.ld
|
|
|
- ${ulp_artifacts_prefix}.h)
|
|
|
+foreach(ulp_exp_dep_src ${ULP_EXP_DEP_SRCS})
|
|
|
+ get_filename_component(ulp_dep_src ${ulp_exp_dep_src} ABSOLUTE BASE_DIR ${COMPONENT_DIR})
|
|
|
+ list(APPEND ulp_dep_srcs ${ulp_dep_src})
|
|
|
+endforeach()
|
|
|
|
|
|
- set(ulp_artifacts_extras ${ulp_artifacts_prefix}.map
|
|
|
- ${ulp_artifacts_prefix}.sym
|
|
|
- ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/esp32.ulp.ld)
|
|
|
-
|
|
|
- # Replace the separator for the list of ULP source files that will be passed to
|
|
|
- # the external ULP project. This is a workaround to the bug https://public.kitware.com/Bug/view.php?id=16137.
|
|
|
- string(REPLACE ";" "|" ulp_s_sources "${ulp_s_sources}")
|
|
|
-
|
|
|
- idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER)
|
|
|
- idf_build_get_property(idf_path IDF_PATH)
|
|
|
- idf_build_get_property(python PYTHON)
|
|
|
- externalproject_add(${ULP_APP_NAME}
|
|
|
- SOURCE_DIR ${idf_path}/components/ulp/cmake
|
|
|
- BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}
|
|
|
- INSTALL_COMMAND ""
|
|
|
- CMAKE_ARGS -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
|
|
- -DCMAKE_TOOLCHAIN_FILE=${idf_path}/components/ulp/cmake/toolchain-ulp.cmake
|
|
|
- -DULP_S_SOURCES=${ulp_s_sources} -DULP_APP_NAME=${ULP_APP_NAME}
|
|
|
- -DCOMPONENT_DIR=${COMPONENT_DIR}
|
|
|
- # Even though this resolves to a ';' separated list, this is fine. This must be special behavior
|
|
|
- # for generator expressions.
|
|
|
- -DCOMPONENT_INCLUDES=$<TARGET_PROPERTY:${COMPONENT_LIB},INTERFACE_INCLUDE_DIRECTORIES>
|
|
|
- -DIDF_PATH=${idf_path}
|
|
|
- -DSDKCONFIG=${sdkconfig_header}
|
|
|
- -DPYTHON=${python}
|
|
|
- BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME} --target build
|
|
|
- BUILD_BYPRODUCTS ${ulp_artifacts} ${ulp_artifacts_extras} ${ulp_ps_sources}
|
|
|
- ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME}
|
|
|
- BUILD_ALWAYS 1
|
|
|
- LIST_SEPARATOR |
|
|
|
- )
|
|
|
-
|
|
|
- spaces2list(ULP_EXP_DEP_SRCS)
|
|
|
- set_source_files_properties(${ULP_EXP_DEP_SRCS} PROPERTIES OBJECT_DEPENDS ${ulp_artifacts})
|
|
|
-
|
|
|
- include_directories(${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME})
|
|
|
-
|
|
|
- add_custom_target(${ULP_APP_NAME}_artifacts DEPENDS ${ULP_APP_NAME})
|
|
|
-
|
|
|
- add_dependencies(${COMPONENT_LIB} ${ULP_APP_NAME}_artifacts)
|
|
|
-
|
|
|
- target_linker_script(${COMPONENT_LIB} ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME}.ld)
|
|
|
- target_add_binary_data(${COMPONENT_LIB} ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}/${ULP_APP_NAME}.bin BINARY)
|
|
|
-endif()
|
|
|
+ulp_embed_binary(${ULP_APP_NAME} ${ulp_srcs} ${ulp_dep_srcs})
|