From 5b83b198c60394a9e544aaf239d2432c81c54a20 Mon Sep 17 00:00:00 2001 From: Alexey Gerenkov Date: Tue, 1 Oct 2019 20:42:32 +0300 Subject: [PATCH] gcov: Fixes libgcov and libapp_trace cross dependency linking issue Closes IDF-834 --- components/app_trace/CMakeLists.txt | 7 ++++++- examples/system/gcov/README.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/app_trace/CMakeLists.txt b/components/app_trace/CMakeLists.txt index b9bcdddccc..609c50cfff 100644 --- a/components/app_trace/CMakeLists.txt +++ b/components/app_trace/CMakeLists.txt @@ -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 $ gcov $) +target_link_libraries(${COMPONENT_LIB} PUBLIC gcov_apptrace ${LIBC}) diff --git a/examples/system/gcov/README.md b/examples/system/gcov/README.md index 3bd93810af..5404cb96de 100644 --- a/examples/system/gcov/README.md +++ b/examples/system/gcov/README.md @@ -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.