1# SPDX-License-Identifier: Apache-2.0 2# Copyright The Zephyr Project Contributors 3# 4menu "Coverage" 5 6config HAS_COVERAGE_SUPPORT 7 bool 8 help 9 The code coverage report generation is only available on boards 10 with enough spare RAM to buffer the coverage data, or on boards 11 based on the POSIX ARCH. 12 13config COVERAGE 14 bool "Create coverage data" 15 depends on HAS_COVERAGE_SUPPORT 16 help 17 This option will build your application with the -coverage option 18 which will generate data that can be used to create coverage reports. 19 For more information see 20 https://docs.zephyrproject.org/latest/guides/coverage.html 21 22choice 23 prompt "Coverage mode" 24 default COVERAGE_NATIVE_GCOV if NATIVE_BUILD 25 default COVERAGE_GCOV if !NATIVE_BUILD 26 depends on COVERAGE 27 28config COVERAGE_NATIVE_GCOV 29 bool "Host compiler gcov based code coverage" 30 depends on NATIVE_BUILD 31 help 32 Build natively with the compiler standard `--coverage` options, 33 that is with gcov/GCC-compatible coverage 34 35config COVERAGE_NATIVE_SOURCE 36 bool "Host compiler source based code coverage" 37 depends on NATIVE_BUILD 38 depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm" 39 help 40 Build natively with the compiler source based coverage options. 41 Today this is only supported with LLVM 42 43config COVERAGE_GCOV 44 bool "Create Coverage data from hardware platform" 45 depends on !NATIVE_BUILD 46 help 47 This option will select the custom gcov library. The reports will 48 be available over serial. This serial dump can be passed to 49 gen_gcov_files.py which creates the required .gcda files. These 50 can be read by gcov utility. For more details see gcovr.com . 51 52endchoice 53 54config COVERAGE_GCOV_HEAP_SIZE 55 int "Size of heap allocated for gcov coverage data dump" 56 depends on COVERAGE_GCOV 57 default 32768 if X86 || SOC_SERIES_MPS2 58 default 16384 59 help 60 This option configures the heap size allocated for gcov coverage 61 data to be dumped over serial. If the value is 0, no buffer will be used, 62 data will be dumped directly over serial. 63 64if COVERAGE_GCOV 65 66choice COVERAGE_DUMP_METHOD 67 prompt "Method to dump coverage data" 68 default COVERAGE_DUMP 69 70config COVERAGE_DUMP 71 bool "Dump coverage data to console on exit" 72 help 73 Dump collected coverage information to console on exit. 74 75config COVERAGE_SEMIHOST 76 bool "Use semihosting to write coverage data" 77 depends on SEMIHOST 78 help 79 Use semihosting to write coverage data to a file on the host. 80 81endchoice 82 83endif # COVERAGE_GCOV 84 85config FORCE_COVERAGE 86 bool "Force coverage" 87 select HAS_COVERAGE_SUPPORT 88 help 89 Regardless of platform support, it will enable coverage data production. 90 If the platform does not support coverage by default, setting this config 91 does not guarantee that coverage data will be gathered. 92 Application may not fit memory or crash at runtime. 93 94config COVERAGE_DUMP_PATH_EXCLUDE 95 string "Exclude files matching this pattern from the coverage data" 96 default "" 97 help 98 Filenames are matched against the pattern using the POSIX fnmatch 99 function. Filenames are based on their path in the build folder, not the 100 original source tree. The empty string "" disables the pattern 101 matching. 102 103endmenu 104