1idf_build_get_property(target IDF_TARGET) 2 3# On Linux, we only support a few features, hence this simple component registration 4if(${target} STREQUAL "linux") 5 idf_component_register(SRCS "heap_caps_linux.c" 6 INCLUDE_DIRS "include") 7 return() 8endif() 9 10set(srcs 11 "heap_caps.c" 12 "heap_caps_init.c" 13 "multi_heap.c") 14 15set(includes "include") 16 17if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL) 18 set(priv_includes "tlsf") 19 list(APPEND srcs "tlsf/tlsf.c") 20endif() 21 22if(NOT CONFIG_HEAP_POISONING_DISABLED) 23 list(APPEND srcs "multi_heap_poisoning.c") 24endif() 25 26if(CONFIG_HEAP_TASK_TRACKING) 27 list(APPEND srcs "heap_task_info.c") 28endif() 29 30if(CONFIG_HEAP_TRACING_STANDALONE) 31 list(APPEND srcs "heap_trace_standalone.c") 32 set_source_files_properties(heap_trace_standalone.c 33 PROPERTIES COMPILE_FLAGS 34 -Wno-frame-address) 35endif() 36 37# Add SoC memory layout to the sources 38 39if(NOT BOOTLOADER_BUILD) 40 list(APPEND srcs "port/memory_layout_utils.c") 41 list(APPEND srcs "port/${target}/memory_layout.c") 42endif() 43 44 45idf_component_register(SRCS "${srcs}" 46 INCLUDE_DIRS ${includes} 47 PRIV_INCLUDE_DIRS ${priv_includes} 48 LDFRAGMENTS linker.lf 49 PRIV_REQUIRES soc) 50 51if(CONFIG_HEAP_TRACING) 52 set(WRAP_FUNCTIONS 53 calloc 54 malloc 55 free 56 realloc 57 heap_caps_malloc 58 heap_caps_free 59 heap_caps_realloc 60 heap_caps_malloc_default 61 heap_caps_realloc_default) 62 63 foreach(wrap ${WRAP_FUNCTIONS}) 64 target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}") 65 endforeach() 66endif() 67 68if(NOT CMAKE_BUILD_EARLY_EXPANSION) 69 idf_build_get_property(build_components BUILD_COMPONENTS) 70 if(freertos IN_LIST build_components) 71 target_compile_options(${COMPONENT_TARGET} PRIVATE "-DMULTI_HEAP_FREERTOS") 72 endif() 73endif() 74