xtensa: introduce prep_c for xtensa

xtensa is the only architecutre doing thing differently and introduces
inconsistency in the init process and dependencies as we attemp to
cleanup init levels and remove misused of SYS_INIT.

Introduce prep_c for this architecture and align with other
architectures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2024-07-06 13:00:14 -04:00 committed by Carles Cufí
parent 299dddfdce
commit 42396735bf
3 changed files with 25 additions and 2 deletions

View File

@ -12,6 +12,7 @@ zephyr_library_sources(
irq_manage.c
thread.c
vector_handlers.c
prep_c.c
)
zephyr_library_sources_ifdef(CONFIG_XTENSA_USE_CORE_CRT1 crt1.S)

View File

@ -22,7 +22,7 @@
*/
.global __start
.type z_cstart, @function
.type z_prep_c, @function
/* Macros to abstract away ABI differences */
@ -189,6 +189,6 @@ _start:
#endif /* !XCHAL_HAVE_BOOTLOADER */
/* Enter C domain, never returns from here */
CALL z_cstart
CALL z_prep_c
.size _start, . - _start

22
arch/xtensa/core/prep_c.c Normal file
View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2024 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <kernel_internal.h>
extern FUNC_NORETURN void z_cstart(void);
/**
*
* @brief Prepare to and run C code
*
* This routine prepares for the execution of and runs C code.
*
*/
void z_prep_c(void)
{
z_cstart();
CODE_UNREACHABLE;
}