Skip to content

Commit

Permalink
xtensa: introduce prep_c for xtensa
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nashif committed Aug 5, 2024
1 parent 491e6ca commit 43898cb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/xtensa/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions arch/xtensa/core/crt1.S
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

.global __start
.type z_cstart, @function
.type z_prep_c, @function


/* Macros to abstract away ABI differences */
Expand Down Expand Up @@ -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 changes: 22 additions & 0 deletions arch/xtensa/core/prep_c.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 43898cb

Please sign in to comment.