gcov: Fixes libgcov and libapp_trace cross dependency linking issue

Closes IDF-834
This commit is contained in:
Alexey Gerenkov 2019-10-01 20:42:32 +03:00
parent 02e084e2b5
commit 5b83b198c6
2 changed files with 7 additions and 2 deletions

View file

@ -33,4 +33,9 @@ idf_component_register(SRCS "${srcs}"
# disable --coverage for this component, as it is used as transport
# for gcov
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-profile-arcs" "-fno-test-coverage")
target_link_libraries(${COMPONENT_LIB} PUBLIC gcov ${LIBC} ${LIBM} gcc)
# Force app_trace to also appear later than gcov in link line
add_library(gcov_apptrace INTERFACE)
idf_component_get_property(app_trace app_trace COMPONENT_LIB)
target_link_libraries(gcov_apptrace INTERFACE $<TARGET_FILE:${app_trace}> gcov $<TARGET_FILE:${app_trace}>)
target_link_libraries(${COMPONENT_LIB} PUBLIC gcov_apptrace ${LIBC})

View file

@ -5,7 +5,7 @@
The following example demonstrates how to compile an ESP-IDF project to generate code coverage data, and how generate a code coverage report using Gcov or Lcov. Refer to the [Gcov Guide](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/app_trace.html#gcov-source-code-coverage) for more details on the code coverage features supported in ESP-IDF.
This example implements a simple blink application but with code coverage enabled. The example will demonstrate the following features:
* How to compile a project with the `--coverage` flag
* How to compile a project with coverage info enabled.
* Various methods of dumping code coverage data (e.g. Instant Run-Time Dump and Hard-coded Dump).
* How to generate a code coverage report.