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