2020-12-01 18:29:58 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Antony Pavlov <antonynpavlov@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Full C support initialization
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel_internal.h>
|
2022-05-06 16:49:15 +08:00
|
|
|
#include <zephyr/irq.h>
|
2023-09-13 20:03:10 +08:00
|
|
|
#include <zephyr/platform/hooks.h>
|
2024-07-09 03:18:49 +08:00
|
|
|
#include <zephyr/arch/cache.h>
|
2020-12-01 18:29:58 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
|
2023-12-08 20:55:21 +08:00
|
|
|
void z_prep_c(void)
|
2020-12-01 18:29:58 +08:00
|
|
|
{
|
2023-09-13 20:03:10 +08:00
|
|
|
#if defined(CONFIG_SOC_PREP_HOOK)
|
|
|
|
soc_prep_hook();
|
|
|
|
#endif
|
2020-12-01 18:29:58 +08:00
|
|
|
z_bss_zero();
|
|
|
|
|
|
|
|
interrupt_init();
|
2024-07-09 03:18:49 +08:00
|
|
|
#if CONFIG_ARCH_CACHE
|
|
|
|
arch_cache_init();
|
|
|
|
#endif
|
2020-12-01 18:29:58 +08:00
|
|
|
|
|
|
|
z_cstart();
|
|
|
|
CODE_UNREACHABLE;
|
|
|
|
}
|