Skip to content

Commit d1665d3

Browse files
wangnuannuannashif
authored andcommitted
gcov: Add coverage support for arc nsim platform
* add toolchain abstraction for coverage * add select HAS_COVERAGE_SUPPORT to kconfig * port gcov linker code to CKake for arc * give user permission to gcov bss section * expand the size of iccm and dccm to 1M Signed-off-by: Jingru Wang <[email protected]>
1 parent e710d36 commit d1665d3

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

boards/arc/nsim/Kconfig.board

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config BOARD_NSIM
77
bool "ARC nSIM simulator"
88
depends on SOC_NSIM
9+
select HAS_COVERAGE_SUPPORT
910
help
1011
The DesignWare ARC nSIM board is a virtual board based on
1112
the ARC nSIM simulator. It demonstrates the ARC core features

boards/arc/nsim/arc_mpu_regions.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
* All regions not listed here are shared by secure world and normal world.
1515
*/
1616
static struct arc_mpu_region mpu_regions[] = {
17+
18+
#if defined(CONFIG_COVERAGE_GCOV) && defined(CONFIG_USERSPACE)
19+
/* Region Coverage */
20+
MPU_REGION_ENTRY("COVERAGE",
21+
(uint32_t)&(__gcov_bss_start),
22+
(uint32_t)&__gcov_bss_size,
23+
REGION_IO_ATTR),
24+
#endif /* CONFIG_COVERAGE_GCOV && CONFIG_USERSPACE */
25+
1726
#if DT_REG_SIZE(DT_INST(0, arc_iccm)) > 0
1827
/* Region ICCM */
1928
MPU_REGION_ENTRY("ICCM",

boards/arc/nsim/nsim.dtsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
#endif
1515

1616
#ifndef ICCM_SIZE
17-
#define ICCM_SIZE DT_SIZE_K(512)
17+
#define ICCM_SIZE DT_SIZE_K(1024)
1818
#endif
1919

2020
#ifndef DCCM_ADDR
2121
#define DCCM_ADDR 80000000
2222
#endif
2323

2424
#ifndef DCCM_SIZE
25-
#define DCCM_SIZE DT_SIZE_K(512)
25+
#define DCCM_SIZE DT_SIZE_K(1024)
2626
#endif
2727

2828
/ {

boards/arc/nsim/support/mdb_em.args

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
-dcache_feature=2
4949
-icache=16384,32,2,a
5050
-icache_feature=2
51-
-dccm_size=0x80000
51+
-dccm_size=0x100000
5252
-dccm_base=0x80000000
5353
-dccm_interleave
54-
-iccm0_size=0x80000
54+
-iccm0_size=0x100000
5555
-iccm0_base=0x00000000
5656
-Xpct_counters=8
5757
-dmac

boards/arc/nsim/support/nsim_em.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
nsim_isa_dc_feature_level=2
5656
icache=16384,32,2,a
5757
nsim_isa_ic_feature_level=2
58-
dccm_size=0x80000
58+
dccm_size=0x100000
5959
dccm_base=0x80000000
6060
nsim_isa_dccm_interleave=1
61-
iccm0_size=0x80000
61+
iccm0_size=0x100000
6262
iccm0_base=0x00000000
6363
nsim_isa_pct_counters=8
6464
nsim_isa_dmac_option=1

subsys/testsuite/coverage/coverage_ram.ld

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ __gcov_bss_size = __gcov_bss_end - __gcov_bss_start;
6464
SECTION_PROLOGUE(_GCOV_BSS_SECTION_NAME, (NOLOAD),)
6565
{
6666
MPU_MIN_SIZE_ALIGN
67-
. = ALIGN(4);
6867
__gcov_bss_start = .;
6968
*(".bss.__gcov0.*");
69+
#ifdef CONFIG_USERSPACE
70+
. = ALIGN(1 << LOG2CEIL(. - __gcov_bss_start));
71+
#else
7072
MPU_MIN_SIZE_ALIGN
73+
#endif
7174
__gcov_bss_end = .;
7275
}GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
7376

0 commit comments

Comments
 (0)