kconfig: add CONFIG_CC_COVERAGE
PATCH 1/1 kconfig: add CONFIG_CC_COVERAGE
Make it possible to use gcc code coverage analysis.
--- .gitignore | 4 ++++ Kconfig | 8 ++++++++ Makefile | 6 ++++++ 3 files changed, 18 insertions(+)
.gitignore +4 -0
@@ -85,3 +85,7 @@ GTAGS *.orig *~ \#*# + +# gcc code coverage files +*.gcda +*.gcno
Kconfig +8 -0
@@ -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. + config DISTRO_DEFAULTS bool "Select defaults suitable for booting general purpose Linux distributions" default y if ARCH_SUNXI || TEGRA
Makefile +6 -0
@@ -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 +endif + export PLATFORM_LIBS export PLATFORM_LIBGCC
Signature · 1 line
2.14.3
PATCH 1/1 kconfig: add CONFIG_CC_COVERAGE
Gentle ping..
2018-03-29 9:49 GMT+02:00 Christian Gmeiner <[email protected]>:
Quoted 60 lines
Make it possible to use gcc code coverage analysis.
Signed-off-by Christian Gmeiner <[email protected]>--- .gitignore | 4 ++++ Kconfig | 8 ++++++++ Makefile | 6 ++++++ 3 files changed, 18 insertions(+).gitignore +4
-0@@ -85,3 +85,7 @@ GTAGS *.orig *~ \#*# + +# gcc code coverage files +*.gcda +*.gcnoKconfig +8
-0@@ -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. + config DISTRO_DEFAULTS bool "Select defaults suitable for booting general purpose Linux distributions" default y if ARCH_SUNXI || TEGRAMakefile +6
-1@@ -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 +endif + export PLATFORM_LIBS export PLATFORM_LIBGCC --2.14.3
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info
PATCH 1/1 kconfig: add CONFIG_CC_COVERAGE
In reply to Christian GmeinerQuoted 26 lines · Christian Gmeiner
Make it possible to use gcc code coverage analysis.
Signed-off-by Christian Gmeiner <[email protected]>--- .gitignore | 4 ++++ Kconfig | 8 ++++++++ Makefile | 6 ++++++ 3 files changed, 18 insertions(+).gitignore +4
-0@@ -85,3 +85,7 @@ GTAGS *.orig *~ \#*# + +# gcc code coverage files +*.gcda +*.gcnoKconfig +0
-0
Kconfig config CC_OPTIMIZE_FOR_SIZE · line 68
Quoted 10 lines
Kconfig +7
-0@@ -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?
Quoted 9 lines
Kconfig +1
-0+ config DISTRO_DEFAULTS bool "Select defaults suitable for booting general purpose Linux distributions" default y if ARCH_SUNXI || TEGRAMakefile +0
-0
Makefile else · line 726
Quoted 7 lines
Makefile +4
-0@@ -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!
Signature · 8 lines
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>
PATCH 1/1 kconfig: add CONFIG_CC_COVERAGE
Hi
2018-04-08 16:30 GMT+02:00 Tom Rini <[email protected]>:
Quoted 31 lines · Christian Gmeiner
Quoted 30 lines
Make it possible to use gcc code coverage analysis.
Signed-off-by Christian Gmeiner <[email protected]>--- .gitignore | 4 ++++ Kconfig | 8 ++++++++ Makefile | 6 ++++++ 3 files changed, 18 insertions(+).gitignore +4
-0@@ -85,3 +85,7 @@ GTAGS *.orig *~ \#*# + +# gcc code coverage files +*.gcda +*.gcnoKconfig +0
-0@@ -59,6 +59,14 @@ config CC_OPTIMIZE_FOR_SIZE This option is enabled by default for U-Boot.
Quoted 11 lines
Kconfig config CC_OPTIMIZE_FOR_SIZE · line 68
Quoted 7 lines
Kconfig +7
-0+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?
The default thing will get fixed in V2. If we want to record code coverage on real hardware we need to add an infrastructure to store the generated analysis data. In the sandbox case this information is stored in the local filesystem (*.gcda).
To get a feeling what may be needs to be done for the real target patch have a look at:
https://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/
My goal is it to get some code coverage data for unit tests that are run in the sandboxed environment.
Is it okay for you to only cover the sandbox case or do you want/need the full blown
solution?
Quoted 10 lines
Quoted 10 lines
Kconfig +1
-0+ config DISTRO_DEFAULTS bool "Select defaults suitable for booting general purpose Linux distributions" default y if ARCH_SUNXI || TEGRAMakefile +0
-0@@ -720,6 +720,12 @@ else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
Quoted 8 lines
Makefile else · line 726
Quoted 6 lines
Makefile +4
-0endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) + +ifdef CONFIG_CC_COVERAGE +KBUILD_CFLAGS += --coverage +PLATFORM_LIBGCC += -lgcovConsistent spacing please, thanks!
Opps.. will be fixed in V2.
Signature · 5 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info
PATCH 1/1 kconfig: add CONFIG_CC_COVERAGE
Quoted 54 lines · Christian Gmeiner
Hi
2018-04-08 16:30 GMT+02:00 Tom Rini <[email protected]>:
Quoted 31 lines · Christian Gmeiner
Quoted 30 lines
Make it possible to use gcc code coverage analysis.
Signed-off-by Christian Gmeiner <[email protected]>--- .gitignore | 4 ++++ Kconfig | 8 ++++++++ Makefile | 6 ++++++ 3 files changed, 18 insertions(+).gitignore +4
-0@@ -85,3 +85,7 @@ GTAGS *.orig *~ \#*# + +# gcc code coverage files +*.gcda +*.gcnoKconfig +0
-0@@ -59,6 +59,14 @@ config CC_OPTIMIZE_FOR_SIZE This option is enabled by default for U-Boot.Quoted 11 lines
Kconfig config CC_OPTIMIZE_FOR_SIZE · line 68
Quoted 7 lines
Kconfig +7
-0+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?
The default thing will get fixed in V2. If we want to record code coverage on real hardware we need to add an infrastructure to store the generated analysis data. In the sandbox case this information is stored in the local filesystem (*.gcda).
To get a feeling what may be needs to be done for the real target patch have a look at:
https://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/
Quoted 6 lines
My goal is it to get some code coverage data for unit tests that are run in the sandboxed environment.
Is it okay for you to only cover the sandbox case or do you want/need the full blown
solution?
While it would be cool to do this on real hardware, I guess that makes sense to do in a follow up. Thanks for explaining!
Signature · 8 lines
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/20180409/7e3e4cb4/attachment.sig>