2022-11-29 16:32:55 +08: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 18:40:01 +11:00
|
|
|
set(srcs
|
2024-03-08 13:58:13 +01:00
|
|
|
"heap_caps_base.c"
|
2019-06-21 14:29:32 +08:00
|
|
|
"heap_caps.c"
|
|
|
|
"heap_caps_init.c"
|
2021-03-19 17:29:42 +08:00
|
|
|
"multi_heap.c")
|
|
|
|
|
2022-07-20 13:59:14 +02:00
|
|
|
set(includes "include")
|
|
|
|
|
2022-05-06 19:20:05 +08:00
|
|
|
if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL)
|
2022-07-20 13:59:14 +02:00
|
|
|
set(priv_includes "tlsf")
|
|
|
|
list(APPEND srcs "tlsf/tlsf.c")
|
2021-03-19 17:29:42 +08:00
|
|
|
endif()
|
2018-01-12 13:49:13 +11:00
|
|
|
|
|
|
|
if(NOT CONFIG_HEAP_POISONING_DISABLED)
|
2019-04-28 15:38:23 +08:00
|
|
|
list(APPEND srcs "multi_heap_poisoning.c")
|
2018-01-12 13:49:13 +11:00
|
|
|
endif()
|
|
|
|
|
2018-09-30 16:45:51 -07:00
|
|
|
if(CONFIG_HEAP_TASK_TRACKING)
|
2019-04-28 15:38:23 +08:00
|
|
|
list(APPEND srcs "heap_task_info.c")
|
2018-09-30 16:45:51 -07:00
|
|
|
endif()
|
|
|
|
|
2018-12-12 20:29:47 +03:00
|
|
|
if(CONFIG_HEAP_TRACING_STANDALONE)
|
2019-04-28 15:38:23 +08:00
|
|
|
list(APPEND srcs "heap_trace_standalone.c")
|
2019-07-24 20:20:11 +03:00
|
|
|
set_source_files_properties(heap_trace_standalone.c
|
|
|
|
PROPERTIES COMPILE_FLAGS
|
|
|
|
-Wno-frame-address)
|
2018-12-12 20:29:47 +03:00
|
|
|
endif()
|
|
|
|
|
2021-06-18 14:51:11 +08:00
|
|
|
# Add SoC memory layout to the sources
|
2021-11-06 17:26:37 +08: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 14:51:11 +08:00
|
|
|
|
|
|
|
|
2019-04-28 15:38:23 +08:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2022-07-20 13:59:14 +02:00
|
|
|
INCLUDE_DIRS ${includes}
|
|
|
|
PRIV_INCLUDE_DIRS ${priv_includes}
|
2019-04-28 15:38:23 +08:00
|
|
|
LDFRAGMENTS linker.lf
|
|
|
|
PRIV_REQUIRES soc)
|
2018-01-12 13:49:13 +11:00
|
|
|
|
|
|
|
if(CONFIG_HEAP_TRACING)
|
2018-02-27 15:45:30 +11:00
|
|
|
set(WRAP_FUNCTIONS
|
2024-03-08 13:58:13 +01:00
|
|
|
heap_caps_realloc_base
|
|
|
|
heap_caps_malloc_base
|
|
|
|
heap_caps_aligned_alloc_base
|
|
|
|
heap_caps_free)
|
2018-01-12 13:49:13 +11:00
|
|
|
|
2018-02-27 15:45:30 +11:00
|
|
|
foreach(wrap ${WRAP_FUNCTIONS})
|
2019-06-04 19:05:33 +08:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")
|
2018-02-27 15:45:30 +11:00
|
|
|
endforeach()
|
2019-12-18 17:04:49 +01:00
|
|
|
endif()
|
2018-01-12 13:49:13 +11:00
|
|
|
|
2019-12-18 17:04:49 +01: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-27 15:45:30 +11:00
|
|
|
endif()
|