entry_gcc.S 1.1 KB
Newer Older
J
Jiaxun Yang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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>
B
bigmagic 已提交
16 17 18
#include <rtconfig.h>

#include "asm.h"
J
Jiaxun Yang 已提交
19 20 21 22 23 24 25 26 27 28 29 30
#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
B
bigmagic 已提交
31
    PTR_LA	ra, _rtthread_entry
J
Jiaxun Yang 已提交
32 33 34 35 36

    /* disable interrupt */
    mtc0	zero, CP0_CAUSE
    mtc0	zero, CP0_STATUS	# Set CPU to disable interrupt.
    ehb
B
bigmagic 已提交
37 38 39 40 41 42

#ifdef ARCH_MIPS64
    dli		t0, ST0_KX
    MTC0	t0, CP0_STATUS
#endif

J
Jiaxun Yang 已提交
43
    /* setup stack pointer */
B
bigmagic 已提交
44 45
    PTR_LA	sp, _system_stack
    PTR_LA	gp, _gp
J
Jiaxun Yang 已提交
46 47 48 49 50

    bal	rt_cpu_early_init
    nop

    /* clear bss */
B
bigmagic 已提交
51 52 53
    PTR_LA	t0, __bss_start
    PTR_LA	t1, __bss_end

J
Jiaxun Yang 已提交
54 55
_clr_bss_loop:
    sw	zero, 0(t0)
B
bigmagic 已提交
56 57
    bne	t1, t0, _clr_bss_loop
    addu	t0, 4
J
Jiaxun Yang 已提交
58 59 60 61 62 63 64
    /* jump to RT-Thread RTOS */
    jal	rtthread_startup
    nop

    /* restart, never die */
    j	_start
    nop