CMakeLists.txt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. set(srcs
  2. "app_trace.c"
  3. "app_trace_util.c"
  4. "host_file_io.c"
  5. "gcov/gcov_rtio.c")
  6. set(include_dirs "include")
  7. set(priv_include_dirs "private_include" "port/include")
  8. if(CONFIG_APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE)
  9. list(APPEND srcs
  10. "app_trace_membufs_proto.c")
  11. if(CONFIG_IDF_TARGET_ARCH_XTENSA)
  12. list(APPEND srcs
  13. "port/xtensa/port.c")
  14. endif()
  15. if(CONFIG_IDF_TARGET_ARCH_RISCV)
  16. list(APPEND srcs
  17. "port/riscv/port.c")
  18. endif()
  19. endif()
  20. list(APPEND srcs
  21. "port/port_uart.c")
  22. if(CONFIG_APPTRACE_SV_ENABLE)
  23. list(APPEND include_dirs
  24. sys_view/Config
  25. sys_view/SEGGER
  26. sys_view/Sample/OS)
  27. list(APPEND srcs
  28. "sys_view/SEGGER/SEGGER_SYSVIEW.c"
  29. "sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c"
  30. "sys_view/Sample/OS/SEGGER_SYSVIEW_FreeRTOS.c"
  31. "sys_view/esp/SEGGER_RTT_esp.c"
  32. "sys_view/ext/heap_trace_module.c"
  33. "sys_view/ext/logging.c")
  34. endif()
  35. if(CONFIG_HEAP_TRACING_TOHOST)
  36. list(APPEND srcs "heap_trace_tohost.c")
  37. set_source_files_properties(heap_trace_tohost.c
  38. PROPERTIES COMPILE_FLAGS
  39. -Wno-frame-address)
  40. endif()
  41. idf_component_register(SRCS "${srcs}"
  42. INCLUDE_DIRS "${include_dirs}"
  43. PRIV_INCLUDE_DIRS "${priv_include_dirs}"
  44. # Requires "driver" for GPTimer in "SEGGER_SYSVIEW_Config_FreeRTOS.c"
  45. PRIV_REQUIRES soc driver
  46. REQUIRES esp_timer
  47. LDFRAGMENTS linker.lf)
  48. # disable --coverage for this component, as it is used as transport
  49. # for gcov
  50. target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
  51. # Force app_trace to also appear later than gcov in link line
  52. idf_component_get_property(app_trace app_trace COMPONENT_LIB)
  53. target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> c)
  54. # This function adds a dependency on the given component if the component is included into the build.
  55. function(maybe_add_component component_name)
  56. idf_build_get_property(components BUILD_COMPONENTS)
  57. if(${component_name} IN_LIST components)
  58. idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
  59. target_link_libraries(${COMPONENT_LIB} PUBLIC ${lib_name})
  60. endif()
  61. endfunction()
  62. if(CONFIG_APPTRACE_DEST_UART0 OR CONFIG_APPTRACE_DEST_UART1 OR CONFIG_APPTRACE_DEST_UART2)
  63. maybe_add_component(driver)
  64. endif()