CMakeLists.txt 1.4 KB

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