zephyr/include/arch/posix/native_tasks.ld
Alberto Escolar Piedras 550225b668 native: Generalize native tasks
Some drivers or tests need to execute some code before Zephyr is
booted, dynamically register command line arguments, etc.

For this purpose, we generalize the NATIVE_EXIT_TASK to also
provide hooks to run a function at a given point during the startup
of native_posix.

Also, test/boards/native_posix/exit_tasks is generalized to cover
this new functionality.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-07-30 22:13:46 -04:00

22 lines
577 B
Plaintext

/*
* Copyright (c) 2018 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
#define NATIVE_INIT_LEVEL(level) \
__native_##level##_tasks_start = .; \
KEEP(*(SORT(.native_##level[0-9]_task))); \
KEEP(*(SORT(.native_##level[1-9][0-9]_task))); \
KEEP(*(SORT(.native_##level[1-9][0-9][0-9]_task))); \
SECTION_PROLOGUE (native_pre_tasks, (OPTIONAL),)
{
__native_tasks_start = .;
NATIVE_INIT_LEVEL(PRE_BOOT_1)
NATIVE_INIT_LEVEL(PRE_BOOT_2)
NATIVE_INIT_LEVEL(PRE_BOOT_3)
NATIVE_INIT_LEVEL(FIRST_SLEEP)
NATIVE_INIT_LEVEL(ON_EXIT)
__native_tasks_end = .;
}