1 /* 2 * Copyright (c) 2016 Jean-Paul Etienne <fractalclone@gmail.com> 3 * 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 <stddef.h> 19 #include <zephyr/toolchain.h> 20 #include <zephyr/kernel_structs.h> 21 #include <kernel_internal.h> 22 #include <zephyr/platform/hooks.h> 23 #include <zephyr/arch/cache.h> 24 25 #if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) 26 void soc_interrupt_init(void); 27 #endif 28 29 /** 30 * 31 * @brief Prepare to and run C code 32 * 33 * This routine prepares for the execution of and runs C code. 34 */ 35 z_prep_c(void)36void z_prep_c(void) 37 { 38 #if defined(CONFIG_SOC_PREP_HOOK) 39 soc_prep_hook(); 40 #endif 41 42 z_bss_zero(); 43 z_data_copy(); 44 #if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) 45 soc_interrupt_init(); 46 #endif 47 #if CONFIG_ARCH_CACHE 48 arch_cache_init(); 49 #endif 50 z_cstart(); 51 CODE_UNREACHABLE; 52 } 53