CMakeLists.txt 1.9 KB

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