⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.s

📁 用UCOS系统实现的MIPS平台源码
💻 S
字号:
/**************************************************************************
*                                                                         *
*   PROJECT     : TMON (Transparent monitor)                              *
*                                                                         *
*   MODULE      : INIT.s                                                  *
*                                                                         *
*   AUTHOR      : Michael Anburaj                                         *
*                 URL  : http://geocities.com/michaelanburaj/             *
*                 EMAIL: michaelanburaj@hotmail.com                       *
*                                                                         *
*   PROCESSOR   : MIPS 4Kc (32 bit RISC) - ATLAS board                    *
*                                                                         *
*   Tool-chain  : SDE & Cygnus                                            *
*                                                                         *
*   DESCRIPTION :                                                         *
*   Startup code for RAM application over TMON.                           *
*                                                                         *
**************************************************************************/

#include "ArchDefs.h"
#include "frmwrk.h"

	
/* ********************************************************************* */
/* Global definitions */


/* ********************************************************************* */
/* File local definitions */


/* ********************************************************************* */
/* Local functions */


/* ********************************************************************* */
/* Global functions */

      .text

/*
*********************************************************************************************
*                                       _start
*
* Description: This routine initializes sp and gp registers, clears bss section and starts
*              the application C code.
*
* Arguments  : none
*
* Return     : none.
*
* Note(s)    : Function linked to application start address.
*********************************************************************************************
*/
      .globl _start
      .ent   _start
	
_start:	

      .set noreorder

      /* Setup sp (top of memory) and gp */
      la    gp, _gp
      la    sp, _freemem
      li	t0, _SYS_STKSIZE
      addu	sp, t0
      
	  /* Align sp to 16 byte boundary (required by Cygnus) */
	  li	 t0, ~0xf
	  and	 sp, t0
      
      /* Clear bss */

      la    t0, _fbss	/* First address */
      la    t1, _end	/* Last  address */
1:
      sw    zero, 0(t0)
      bne   t0, t1, 1b
      addiu t0, 4

      /* Get ready to jump to main */
      move  s0, ra
      la    t0, C_vMain
      /* Jump to main */
      jal   t0
      nop

      /* Return to monitor */
      jr    s0
      nop	

      .set reorder

      .end   _start


/*
*********************************************************************************************
*                                       __main, _gccmain
*
* Description: This routine initializes sp and gp registers, clears bss section and starts
*              the application C code.
*
* Arguments  : none
*
* Return     : none.
*
* Note(s)    : Function linked to application start address.
*********************************************************************************************
*/
/************************************************************************
 *
 *                          __main, _gccmain
 *  Description :
 *  -------------
 *
 *  Dummy functions called by main() function.
 *
 *  GNU-gcc 2.8.1 : main() calls __main
 *  GNU-gcc 2.9   : main() calls __gccmain
 *	
 *  Return values :
 *  ---------------
 *
 *  None
 *
 ************************************************************************/

      .set noreorder
		
      .globl __main
      .ent   __main

__main:	
      jr	ra
      nop

      .end   __main


	
      .globl __gccmain
      .ent   __gccmain

__gccmain:
      jr	ra
      nop

      .end   __gccmain
	
	
/* ********************************************************************* */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -