2022-11-29 03:32:55 -05:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
|
|
|
# On Linux, we only support a few features, hence this simple component registration
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
idf_component_register(SRCS "heap_caps_linux.c"
|
|
|
|
INCLUDE_DIRS "include")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
set(srcs
|
2024-03-08 07:58:13 -05:00
|
|
|
"heap_caps_base.c"
|
2019-06-21 02:29:32 -04:00
|
|
|
"heap_caps.c"
|
|
|
|
"heap_caps_init.c"
|
2021-03-19 05:29:42 -04:00
|
|
|
"multi_heap.c")
|
|
|
|
|
2022-07-20 07:59:14 -04:00
|
|
|
set(includes "include")
|
|
|
|
|
2022-05-06 07:20:05 -04:00
|
|
|
if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
2022-07-20 07:59:14 -04:00
|
|
|
set(priv_includes "tlsf")
|
|
|
|
list(APPEND srcs "tlsf/tlsf.c")
|
2021-03-19 05:29:42 -04:00
|
|
|
endif()
|
2018-01-11 21:49:13 -05:00
|
|
|
|
|
|
|
if(NOT CONFIG_HEAP_POISONING_DISABLED)
|
2019-04-28 03:38:23 -04:00
|
|
|
list(APPEND srcs "multi_heap_poisoning.c")
|
2018-01-11 21:49:13 -05:00
|
|
|
endif()
|
|
|
|
|
2018-09-30 19:45:51 -04:00
|
|
|
if(CONFIG_HEAP_TASK_TRACKING)
|
2019-04-28 03:38:23 -04:00
|
|
|
list(APPEND srcs "heap_task_info.c")
|
2018-09-30 19:45:51 -04:00
|
|
|
endif()
|
|
|
|
|
2018-12-12 12:29:47 -05:00
|
|
|
if(CONFIG_HEAP_TRACING_STANDALONE)
|
2019-04-28 03:38:23 -04:00
|
|
|
list(APPEND srcs "heap_trace_standalone.c")
|
2019-07-24 13:20:11 -04:00
|
|
|
set_source_files_properties(heap_trace_standalone.c
|
|
|
|
PROPERTIES COMPILE_FLAGS
|
|
|
|
-Wno-frame-address)
|
2018-12-12 12:29:47 -05:00
|
|
|
endif()
|
|
|
|
|
2021-06-18 02:51:11 -04:00
|
|
|
# Add SoC memory layout to the sources
|
2021-11-06 05:26:37 -04:00
|
|
|
|
|
|
|
if(NOT BOOTLOADER_BUILD)
|
|
|
|
list(APPEND srcs "port/memory_layout_utils.c")
|
|
|
|
list(APPEND srcs "port/${target}/memory_layout.c")
|
|
|
|
endif()
|
2021-06-18 02:51:11 -04:00
|
|
|
|
|
|
|
|
2019-04-28 03:38:23 -04:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2022-07-20 07:59:14 -04:00
|
|
|
INCLUDE_DIRS ${includes}
|
|
|
|
PRIV_INCLUDE_DIRS ${priv_includes}
|
2019-04-28 03:38:23 -04:00
|
|
|
LDFRAGMENTS linker.lf
|
|
|
|
PRIV_REQUIRES soc)
|
2018-01-11 21:49:13 -05:00
|
|
|
|
|
|
|
if(CONFIG_HEAP_TRACING)
|
2018-02-26 23:45:30 -05:00
|
|
|
set(WRAP_FUNCTIONS
|
2024-03-08 07:58:13 -05:00
|
|
|
heap_caps_realloc_base
|
|
|
|
heap_caps_malloc_base
|
|
|
|
heap_caps_aligned_alloc_base
|
|
|
|
heap_caps_free)
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2018-02-26 23:45:30 -05:00
|
|
|
foreach(wrap ${WRAP_FUNCTIONS})
|
2019-06-04 07:05:33 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")
|
2018-02-26 23:45:30 -05:00
|
|
|
endforeach()
|
2019-12-18 11:04:49 -05:00
|
|
|
endif()
|
2018-01-11 21:49:13 -05:00
|
|
|
|
2019-12-18 11:04:49 -05:00
|
|
|
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
|
|
|
idf_build_get_property(build_components BUILD_COMPONENTS)
|
|
|
|
if(freertos IN_LIST build_components)
|
|
|
|
target_compile_options(${COMPONENT_TARGET} PRIVATE "-DMULTI_HEAP_FREERTOS")
|
|
|
|
endif()
|
2018-02-26 23:45:30 -05:00
|
|
|
endif()
|