aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Kconfig7
-rw-r--r--Makefile6
3 files changed, 17 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 29757aa..f1b8015 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,3 +85,7 @@ GTAGS
*.orig
*~
\#*#
+
+# gcc code coverage files
+*.gcda
+*.gcno
diff --git a/Kconfig b/Kconfig
index 6670913..67b8c50 100644
--- a/Kconfig
+++ b/Kconfig
@@ -59,6 +59,13 @@ config CC_OPTIMIZE_FOR_SIZE
This option is enabled by default for U-Boot.
+config CC_COVERAGE
+ bool "Enable code coverage analysis"
+ depends on SANDBOX
+ help
+ Enabling this option will pass "--coverage" to gcc to compile
+ and link code instrumented for coverage analysis.
+
config DISTRO_DEFAULTS
bool "Select defaults suitable for booting general purpose Linux distributions"
default y if ARCH_SUNXI || TEGRA
diff --git a/Makefile b/Makefile
index bfe115c..9eb7e5b 100644
--- a/Makefile
+++ b/Makefile
@@ -725,6 +725,12 @@ else
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
endif
PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+
+ifdef CONFIG_CC_COVERAGE
+KBUILD_CFLAGS += --coverage
+PLATFORM_LIBGCC += -lgcov
+endif
+
export PLATFORM_LIBS
export PLATFORM_LIBGCC