boards: qemu_x86_tiny: enable support for coverage

This adds the bits so that we can use qemu_x86_tiny for
coverage, as this is currently the only board that can do
demand paging.

This uses the board revision as a way to specify the RAM
size as coverage requires more memory available to store
the coverage data. By piggybacking onto board revision,
this avoids adding another board config just for coverage.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2022-07-26 13:19:17 -07:00 committed by Carles Cufí
commit fd8ffdb833
8 changed files with 66 additions and 0 deletions

View file

@ -26,3 +26,4 @@ config BOARD_QEMU_X86_TINY
depends on SOC_IA32
select QEMU_TARGET
select CPU_HAS_FPU
select HAS_COVERAGE_SUPPORT

View file

@ -189,6 +189,7 @@ MEMORY
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, cbprintf_complete) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, cbprintf_nano) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, configs) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, coverage) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, heap) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, heap-validate) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, mutex) \
@ -198,6 +199,8 @@ MEMORY
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, stdout_console) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, sys_clock_init) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, rb) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, tracing_none) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, tracing_tracking) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, thread_entry) \
LIB_ZEPHYR_OBJECT_FILE_IN_SECT(lsect, work_q)
@ -395,6 +398,10 @@ SECTIONS
*libc.a:(.text.*)
#endif /* CONFIG_NEWLIB_LIBC */
#ifdef CONFIG_COVERAGE
*(.text._sub_I_00100_0)
#endif
ZEPHYR_KERNEL_FUNCS_IN_SECT
#include <zephyr/linker/kobject-text.ld>
@ -436,6 +443,7 @@ SECTIONS
#endif /* CONFIG_NEWLIB_LIBC */
#include <snippets-rodata.ld>
#include <snippets-pinned-rodata.ld>
#include <zephyr/linker/kobject-rom.ld>
@ -466,14 +474,34 @@ SECTIONS
LIB_DRIVERS_IN_SECT(data)
LIB_SUBSYS_LOGGING_IN_SECT(data)
#ifdef CONFIG_COVERAGE
*(.data.__gcov_.*)
/*
* This is for the struct gcov_info for
* various functions.
*/
*(.data..LPBX*)
#endif
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
#include <zephyr/linker/common-ram.ld>
#include <zephyr/arch/x86/pagetables.ld>
#include <zephyr/linker/kobject-data.ld>
/* Located in generated directory. This file is populated by the
* zephyr_linker_sources() Cmake function.
*/
#include <snippets-pinned-data-sections.ld>
lnkr_pinned_data_end = .;
/* Located in generated directory. This file is populated by the
* zephyr_linker_sources() Cmake function.
*/
#include <snippets-pinned-ram-sections.ld>
SECTION_PROLOGUE(pinned.bss, (NOLOAD),)
{
. = ALIGN(4);
@ -491,6 +519,10 @@ SECTIONS
LIB_DRIVERS_IN_SECT(bss)
LIB_SUBSYS_LOGGING_IN_SECT(bss)
#ifdef CONFIG_COVERAGE
*(.bss.__gcov0.*)
#endif
lnkr_pinned_bss_end = .;
} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)

View file

@ -0,0 +1,5 @@
# Copyright (c) 2022 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0
# Enable coverage regardless since this config for coverage only.
CONFIG_COVERAGE=y

View file

@ -0,0 +1,10 @@
/*
* Copyright (c) 2022 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Override with 768KB DRAM */
&dram0 {
reg = < 0x100000 DT_SIZE_K(768) >;
};

View file

@ -0,0 +1,5 @@
# Copyright (c) 2022 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0
# We can't really do board_check_revision() here
# as it will apply to all qemu_x86* boards.

View file

@ -0,0 +1,5 @@
# Copyright (c) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Need quite some space for coverage.
CONFIG_TEST_EXTRA_STACK_SIZE=1024

View file

@ -0,0 +1,3 @@
&dram0 {
reg = < 0x100000 0x100000 >;
};

View file

@ -0,0 +1,5 @@
# Copyright 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# This is needed for coverage.
CONFIG_MAIN_STACK_SIZE=4096