1 /*
2  * Copyright (c) 2021 KT-Elektronik, Klaucke und Partner GmbH
3  * Copyright (c) 2024 Renesas Electronics Corporation
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Full C support initialization
10  *
11  *
12  * Initialization of full C support: zero the .bss and call z_cstart().
13  *
14  * Stack is available in this module, but not the global data/bss until their
15  * initialization is performed.
16  */
17 
18 #include <zephyr/kernel.h>
19 #include <zephyr/logging/log.h>
20 #include <zephyr/toolchain.h>
21 #include <zephyr/linker/sections.h>
22 #include <zephyr/arch/common/xip.h>
23 #include <zephyr/arch/common/init.h>
24 
25 K_KERNEL_PINNED_STACK_ARRAY_DEFINE(z_initialization_process_stacks, CONFIG_MP_MAX_NUM_CPUS,
26 				   CONFIG_INITIALIZATION_STACK_SIZE);
27 /**
28  * @brief Prepare to and run C code
29  *
30  * This routine prepares for the execution of and runs C code.
31  *
32  * @return N/A
33  */
z_prep_c(void)34 FUNC_NORETURN void z_prep_c(void)
35 {
36 	arch_bss_zero();
37 
38 	arch_data_copy();
39 
40 	z_cstart();
41 	CODE_UNREACHABLE;
42 }
43