entry.s 916 Bytes
#include <regdef.h>
#include <asm.h>
#include <PR/R4300.h>

#include <PR/bcp.h>
#include <PR/bbsim.h>

#define APP_STACK_SIZE 8192

/* reserve space for the stack pointer */
.bss
.align 4
.comm __stack, APP_STACK_SIZE

.text
.align 2
.set   reorder 
.ent __start
.globl __start
__start:
        la      sp, __stack + APP_STACK_SIZE

        .set noreorder
        la      t0, __bss_start
        la      t1, _end - 4
zero_bss:
        sw      zero, (t0)
        bge     t1, t0, zero_bss
        add     t0, 4
        .set reorder

#ifdef BIG_APP
        /* make app big for testing */
        .set noreorder
        .rept (1024*16)/4
        nop
        .endr
        .set reorder
#endif

        jal     boot

        /* simulator off */
        sh      zero, PHYS_TO_K1(PI_IDE3_SIM_HALT)
        lw      t0, PHYS_TO_K1(PI_IDE_FC_BASE_REG)
power_down_loop:
        beq     zero, zero, power_down_loop

.end __start