1set(srcs
2    "heap_caps.c"
3    "heap_caps_init.c"
4    "multi_heap.c"
5    "heap_tlsf.c")
6
7if(NOT CONFIG_HEAP_POISONING_DISABLED)
8    list(APPEND srcs "multi_heap_poisoning.c")
9endif()
10
11if(CONFIG_HEAP_TASK_TRACKING)
12    list(APPEND srcs "heap_task_info.c")
13endif()
14
15if(CONFIG_HEAP_TRACING_STANDALONE)
16    list(APPEND srcs "heap_trace_standalone.c")
17    set_source_files_properties(heap_trace_standalone.c
18        PROPERTIES COMPILE_FLAGS
19        -Wno-frame-address)
20endif()
21
22# Add SoC memory layout to the sources
23list(APPEND srcs "port/memory_layout_utils.c")
24list(APPEND srcs "port/${target}/memory_layout.c")
25
26
27idf_component_register(SRCS "${srcs}"
28                    INCLUDE_DIRS include
29                    LDFRAGMENTS linker.lf
30                    PRIV_REQUIRES soc)
31
32if(CONFIG_HEAP_TRACING)
33    set(WRAP_FUNCTIONS
34        calloc
35        malloc
36        free
37        realloc
38        heap_caps_malloc
39        heap_caps_free
40        heap_caps_realloc
41        heap_caps_malloc_default
42        heap_caps_realloc_default)
43
44    foreach(wrap ${WRAP_FUNCTIONS})
45        target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")
46    endforeach()
47endif()
48
49if(NOT CMAKE_BUILD_EARLY_EXPANSION)
50    idf_build_get_property(build_components BUILD_COMPONENTS)
51    if(freertos IN_LIST build_components)
52        target_compile_options(${COMPONENT_TARGET} PRIVATE "-DMULTI_HEAP_FREERTOS")
53    endif()
54endif()
55