Skip to content

Commit

Permalink
kernel: init: exclude some funcs from coverage
Browse files Browse the repository at this point in the history
data copying and bss zero are called from arch code
before z_cstart(), and coverage data gathering doesn't
work properly at that point. Not all arches use this
code anyway, some do it in optimized assembly instead.

Weak main() is also excluded; it does nothing and every
test overrides it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information
Andrew Boie authored and nashif committed Jun 18, 2019
1 parent d87a90e commit fe228a8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion kernel/init.c
Expand Up @@ -133,6 +133,13 @@ K_THREAD_STACK_DEFINE(_interrupt_stack3, CONFIG_ISR_STACK_SIZE);
extern void idle(void *unused1, void *unused2, void *unused3);


/* LCOV_EXCL_START
*
* This code is called so early in the boot process that code coverage
* doesn't work properly. In addition, not all arches call this code,
* some like x86 do this with optimized assembly
*/

/**
*
* @brief Clear BSS
Expand Down Expand Up @@ -215,7 +222,9 @@ void z_data_copy(void)
#endif /* CONFIG_STACK_CANARIES */
#endif /* CONFIG_USERSPACE */
}
#endif
#endif /* CONFIG_XIP */

/* LCOV_EXCL_STOP */

/**
*
Expand Down Expand Up @@ -284,12 +293,16 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
_main_thread->base.user_options &= ~K_ESSENTIAL;
}

/* LCOV_EXCL_START */

void __weak main(void)
{
/* NOP default main() if the application does not provide one. */
arch_nop();
}

/* LCOV_EXCL_STOP */

#if defined(CONFIG_MULTITHREADING)
static void init_idle_thread(struct k_thread *thr, k_thread_stack_t *stack)
{
Expand Down

0 comments on commit fe228a8

Please sign in to comment.