[U-Boot] [PATCH] kconfig: add CONFIG_CC_COVERAGE

Tom Rini trini at konsulko.com
Sun Apr 8 14:30:35 UTC 2018


On Thu, Mar 29, 2018 at 09:49:30AM +0200, Christian Gmeiner wrote:

> Make it possible to use gcc code coverage analysis.
> 
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
>  .gitignore | 4 ++++
>  Kconfig    | 8 ++++++++
>  Makefile   | 6 ++++++
>  3 files changed, 18 insertions(+)
> 
> diff --git a/.gitignore b/.gitignore
> index 29757aa51e..f1b801579c 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -85,3 +85,7 @@ GTAGS
>  *.orig
>  *~
>  \#*#
> +
> +# gcc code coverage files
> +*.gcda
> +*.gcno
> diff --git a/Kconfig b/Kconfig
> index 6670913799..f092f72b25 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -59,6 +59,14 @@ config CC_OPTIMIZE_FOR_SIZE
>  
>  	  This option is enabled by default for U-Boot.
>  
> +config CC_COVERAGE
> +	bool "Enable code coverage analysis"
> +	default n
> +	depends on SANDBOX
> +	help
> +	  Enabling this option will pass "--coverage" to gcc to compile
> +	  and link code instrumented for coverage analysis.

We shouldn't need default n, as that is the normal default.  And why is
this only on SANDBOX?

> +
>  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 5fa14789d9..d06193e8f4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -720,6 +720,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

Consistent spacing please, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180408/d7d54c9e/attachment.sig>


More information about the U-Boot mailing list