1set(srcs
2    "app_trace.c"
3    "app_trace_util.c"
4    "host_file_io.c"
5    "gcov/gcov_rtio.c")
6
7set(include_dirs "include")
8
9if(CONFIG_SYSVIEW_ENABLE)
10    list(APPEND include_dirs
11        sys_view/Config
12        sys_view/SEGGER
13        sys_view/Sample/OS)
14
15    list(APPEND srcs
16        "sys_view/SEGGER/SEGGER_SYSVIEW.c"
17        "sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c"
18        "sys_view/Sample/OS/SEGGER_SYSVIEW_FreeRTOS.c"
19        "sys_view/esp32/SEGGER_RTT_esp32.c"
20        "sys_view/ext/heap_trace_module.c"
21        "sys_view/ext/logging.c")
22endif()
23
24if(CONFIG_HEAP_TRACING_TOHOST)
25    list(APPEND srcs "heap_trace_tohost.c")
26    set_source_files_properties(heap_trace_tohost.c
27        PROPERTIES COMPILE_FLAGS
28        -Wno-frame-address)
29endif()
30
31idf_component_register(SRCS "${srcs}"
32                       INCLUDE_DIRS "${include_dirs}"
33                       PRIV_REQUIRES soc
34                       LDFRAGMENTS linker.lf)
35
36# disable --coverage for this component, as it is used as transport
37# for gcov
38target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
39
40# Force app_trace to also appear later than gcov in link line
41idf_component_get_property(app_trace app_trace COMPONENT_LIB)
42target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}> c)
43