esp-idf/components/heap/CMakeLists.txt
Guillaume Souchere a2b60946ac heap: Remove TLSF related files and replace them with the tlsf submodule
As the tlsf implementation is a fork from https://github.com/mattconte/tlsf,
the sources are moved to a separate repository and used as a submodule in the esp-idf instead.

In this commit:
- Removing TLSF related files and using tlsf submodule instead.

- Adding components/heap/tlsf_platform.h header gathering all IDF specifics.

- The multi_heap_poisoning.c provides the declaration of the
function block_absorb_post_hook() definied weak in the TLSF repository.

- The tlsf_platform.h includes the tlsf_common.h file after the definition
of FL_INDEX_MAX_PLATFORM macro to make sure that this macro will be available
in tlsf_common.h without having to include tlaf_platform.h from IDF in the
tlsf_common.h header from the TLSF repository.

- Add missing include from tlsf_block_functions.h in the multi_heap.c file.
Change related to the changes made in TLSF repository (tlsf_block_functions.h
no longer included in tlsf.h)
2022-08-15 11:11:52 +02:00

72 lines
1.9 KiB
CMake

set(srcs
"heap_caps.c"
"heap_caps_init.c"
"multi_heap.c")
set(includes "include")
if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL)
set(priv_includes "tlsf")
list(APPEND srcs "tlsf/tlsf.c")
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
set_source_files_properties(tlsf/tlsf.c
PROPERTIES COMPILE_FLAGS
"-include ../tlsf_platform.h")
endif()
endif()
if(NOT CONFIG_HEAP_POISONING_DISABLED)
list(APPEND srcs "multi_heap_poisoning.c")
endif()
if(CONFIG_HEAP_TASK_TRACKING)
list(APPEND srcs "heap_task_info.c")
endif()
if(CONFIG_HEAP_TRACING_STANDALONE)
list(APPEND srcs "heap_trace_standalone.c")
set_source_files_properties(heap_trace_standalone.c
PROPERTIES COMPILE_FLAGS
-Wno-frame-address)
endif()
# Add SoC memory layout to the sources
if(NOT BOOTLOADER_BUILD)
list(APPEND srcs "port/memory_layout_utils.c")
list(APPEND srcs "port/${target}/memory_layout.c")
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ${includes}
PRIV_INCLUDE_DIRS ${priv_includes}
LDFRAGMENTS linker.lf
PRIV_REQUIRES soc)
if(CONFIG_HEAP_TRACING)
set(WRAP_FUNCTIONS
calloc
malloc
free
realloc
heap_caps_malloc
heap_caps_free
heap_caps_realloc
heap_caps_malloc_default
heap_caps_realloc_default)
foreach(wrap ${WRAP_FUNCTIONS})
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")
endforeach()
endif()
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()
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")