Skip to content

Commit

Permalink
gcov: arm,arm64 add coverage global
Browse files Browse the repository at this point in the history
Signed-off-by: wangmingrong1 <[email protected]>
  • Loading branch information
W-M-R committed Nov 14, 2024
1 parent b893ce5 commit 132445a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif

ifeq ($(CONFIG_COVERAGE_ALL),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
else ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
ARCHOPTIMIZATION += -fprofile-instr-generate -fcoverage-mapping
endif
endif

ifeq ($(CONFIG_PROFILE_ALL),y)
ARCHOPTIMIZATION += -pg
endif
Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/src/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
ARCHOPTIMIZATION += -finstrument-functions
endif

ifeq ($(CONFIG_COVERAGE_ALL),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
else ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
ARCHOPTIMIZATION += -fprofile-instr-generate -fcoverage-mapping
endif
endif

ifeq ($(CONFIG_PROFILE_ALL),y)
ARCHOPTIMIZATION += -pg
endif
Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/src/cmake/Toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ if(CONFIG_ARCH_INSTRUMENT_ALL)
add_compile_options(-finstrument-functions)
endif()

if(CONFIG_COVERAGE_ALL)
if(CONFIG_ARCH_TOOLCHAIN_GCC)
add_compile_options(-fprofile-generate -ftest-coverage)
elseif(CONFIG_ARCH_TOOLCHAIN_CLANG)
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
endif()
endif()

if(CONFIG_PROFILE_ALL)
add_compile_options(-pg)
endif()
Expand Down

0 comments on commit 132445a

Please sign in to comment.