2019-12-07 00:54:03 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2019, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2019-12-04 Jiaxun Yang Initial version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#define __ASSEMBLY__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <mips.h>
|
2020-04-05 13:29:29 +08:00
|
|
|
#include <rtconfig.h>
|
|
|
|
|
|
|
|
#include "asm.h"
|
2019-12-07 00:54:03 +08:00
|
|
|
#include <rtconfig.h>
|
|
|
|
|
|
|
|
.section ".start", "ax"
|
|
|
|
.set noreorder
|
|
|
|
|
|
|
|
/* the program entry */
|
|
|
|
.globl _rtthread_entry
|
|
|
|
_rtthread_entry:
|
|
|
|
#ifndef RT_USING_SELF_BOOT
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
#endif
|
2020-04-05 13:29:29 +08:00
|
|
|
PTR_LA ra, _rtthread_entry
|
2019-12-07 00:54:03 +08:00
|
|
|
|
|
|
|
/* disable interrupt */
|
2020-04-06 15:46:28 +08:00
|
|
|
MTC0 zero, CP0_CAUSE
|
|
|
|
MTC0 zero, CP0_STATUS # Set CPU to disable interrupt.
|
2019-12-07 00:54:03 +08:00
|
|
|
ehb
|
2020-04-05 13:29:29 +08:00
|
|
|
|
|
|
|
#ifdef ARCH_MIPS64
|
|
|
|
dli t0, ST0_KX
|
|
|
|
MTC0 t0, CP0_STATUS
|
|
|
|
#endif
|
|
|
|
|
2019-12-07 00:54:03 +08:00
|
|
|
/* setup stack pointer */
|
2020-04-05 13:29:29 +08:00
|
|
|
PTR_LA sp, _system_stack
|
|
|
|
PTR_LA gp, _gp
|
2019-12-07 00:54:03 +08:00
|
|
|
|
|
|
|
bal rt_cpu_early_init
|
|
|
|
nop
|
|
|
|
|
|
|
|
/* clear bss */
|
2020-04-05 13:29:29 +08:00
|
|
|
PTR_LA t0, __bss_start
|
|
|
|
PTR_LA t1, __bss_end
|
|
|
|
|
2019-12-07 00:54:03 +08:00
|
|
|
_clr_bss_loop:
|
|
|
|
sw zero, 0(t0)
|
2020-04-05 13:29:29 +08:00
|
|
|
bne t1, t0, _clr_bss_loop
|
|
|
|
addu t0, 4
|
2019-12-07 00:54:03 +08:00
|
|
|
/* jump to RT-Thread RTOS */
|
|
|
|
jal rtthread_startup
|
|
|
|
nop
|
|
|
|
|
|
|
|
/* restart, never die */
|
|
|
|
j _start
|
|
|
|
nop
|