1 /* 2 * Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Full C support initialization 10 */ 11 12 #include <kernel_internal.h> 13 #include <zephyr/irq.h> 14 #include <zephyr/platform/hooks.h> 15 #include <zephyr/arch/cache.h> 16 interrupt_init(void)17static void interrupt_init(void) 18 { 19 extern char __isr_vec[]; 20 extern uint32_t mips_cp0_status_int_mask; 21 unsigned long ebase; 22 23 irq_lock(); 24 25 mips_cp0_status_int_mask = 0; 26 27 ebase = 0x80000000; 28 29 memcpy((void *)(ebase + 0x180), __isr_vec, 0x80); 30 31 /* 32 * Disable boot exception vector in BOOTROM, 33 * use exception vector in RAM. 34 */ 35 write_c0_status(read_c0_status() & ~(ST0_BEV)); 36 } 37 38 /** 39 * 40 * @brief Prepare to and run C code 41 * 42 * This routine prepares for the execution of and runs C code. 43 * 44 * @return N/A 45 */ 46 z_prep_c(void)47void z_prep_c(void) 48 { 49 #if defined(CONFIG_SOC_PREP_HOOK) 50 soc_prep_hook(); 51 #endif 52 z_bss_zero(); 53 54 interrupt_init(); 55 #if CONFIG_ARCH_CACHE 56 arch_cache_init(); 57 #endif 58 59 z_cstart(); 60 CODE_UNREACHABLE; 61 } 62