diff --git a/arch/xtensa/core/CMakeLists.txt b/arch/xtensa/core/CMakeLists.txt index 56ca1071b01304..d03e3641b42b4b 100644 --- a/arch/xtensa/core/CMakeLists.txt +++ b/arch/xtensa/core/CMakeLists.txt @@ -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) diff --git a/arch/xtensa/core/crt1.S b/arch/xtensa/core/crt1.S index e881a41fc9224b..5e3bf9e8a2c1a3 100644 --- a/arch/xtensa/core/crt1.S +++ b/arch/xtensa/core/crt1.S @@ -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 diff --git a/arch/xtensa/core/prep_c.c b/arch/xtensa/core/prep_c.c new file mode 100644 index 00000000000000..963958cd2449e5 --- /dev/null +++ b/arch/xtensa/core/prep_c.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +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; +}