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

📄 romstart.s

📁 武汉创维特ARM7实验箱的全部源代码
💻 S
📖 第 1 页 / 共 2 页
字号:
		LDR     PC, =0x0c000020          		/* IRQ                   */
		LDR     PC, =0x0c000024           		/* FIQ                   */
#/*************************************************************************/
#/* Entry of reset vector interrupt                                       */
#/*************************************************************************/
ResetHandler :
#/*************************************************************************/
#/*                                                                       */
#/* FUNCTION                                                              */
#/*                                                                       */
#/*      main_entry                                                       */
#/*                                                                       */
#/* DESCRIPTION                                                           */
#/*                                                                       */
#/*      This function is the entry function of target                    */
#/*                                                                       */
#/*             -    	HardWare Initialization                           */
#/*             -       Configuration Port control registers              */
#/*             -       Set clock control registers                       */
#/*             -       Set memory control registers (every CS control)   */
#/*             -       init stack                                        */
#/*             -       Set memory control registers (every CS control)   */
#/*             -       Clear the un-initialized global and static        */
#/*                         C data areas                                  */
#/*             -       Move the initialized global and initialized       */
#/*                         C data areas                                  */
#/*             -       Initialize the vector table                       */
#/*             -       Jump to Main function                             */
#/*                                                                       */
#/* AUTHOR                                                                */
#/*                                                                       */
#/*      ShangJun,Liu                                                     */
#/* DATE:                                                                 */
#/*      2003-06-05                                                       */
#/* CALLED BY                                                             */
#/*                                                                       */
#/*                                                                       */
#/* CALLS                                                                 */
#/*                                                                       */
#/*      none                                                             */
#/*                                                                       */
#/* INPUTS                                                                */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* OUTPUTS                                                               */
#/*                                                                       */
#/*      None                                                             */
#/*                                                                       */
#/* HISTORY                                                               */
#/*                                                                       */
#/*         NAME            DATE                    REMARKS               */
#/*                                                                       */
#/*                                                                       */
#/*************************************************************************/
#VOID    main_entry(void)
#{
	.global	main_entry
main_entry :	

#
# Disable interrupt and switch to supervisor mode
#
	MRS		a1,CPSR				    /*; Pickup current CPSR*/
	BIC		a1,a1,#MODE_MASK		/*; Clear the mode bits*/
	ORR		a1,a1,#SUP_MODE			/*; Set the supervisor mode bits*/
	ORR		a1,a1,#LOCKOUT			/*; Insure IRQ and FIQ intr are locked out*/
	MSR		CPSR_cxsf,a1			/*; Setup the new CPSR*/
#
# HardWare Initialization.
# disable all interrupt
#
   	ldr    r0,=INTCON	    /*#Interrupt control register. */
    ldr    r1,=0x07         /*#non-vectored mode,disable IRQ,disable FIQ.  */		
    str    r1,[r0]

   	ldr    r0,=INTMSK	    /*#Interrupt MASK register. */
    ldr    r1,=0x07ffffff   /*#disable all(30) interrupt sources.*/  		
    str    r1,[r0]

    ldr    r0,=WTCON	    /*#watch dog disable*/ 
    ldr    r1,=0x0 		
    str    r1,[r0]

    ldr    r0,=SYSCFG	    /*#enable writer buffer, full cache enable, stall disable */
    ldr    r1,=0xE           		
    str    r1,[r0]

    ldr    r0,=NCACHBE0	    /*#non cacheable area control*/
    ldr    r1,=0xb0000000   /*#bank0,1,2,3,4,5 area*/           		
    str    r1,[r0]
    
    ldr    r0,=NCACHBE1	    /*#non cacheable area control*/
    ldr    r1,=0xc732c700   
    str    r1,[r0]
   
#;/*************************************************************************/
#;/* Call startram -- Run to uclinux from this inst                          */
#;/*************************************************************************/
#/*************************************************************************/
#/* Copy Code from Flash at 0 to sDRAM at 0x0c000000                      */
#/*     description :                                                     */
#/*         r1 --- source address, may be flash or ram                    */
#/*         r2 --- destination address, must to be ram                    */
#/*         r3 --- length of data which will be copied                    */
#/*************************************************************************/
#{
.IF COPY_CODE_TO_SDRAM == 1
copy_code_to_ram :
	    ldr		r3, =0x10000         /* 64K Bytes */
		ldr 	r2, =0xc700000 
		ldr		r1, =0				
next :		
		ldr		r0,[r1],#4
		str		r0,[r2],#4
		cmp		r1,r3
		bne		next
.ENDIF
#}
	
#/*************************************************************************/
#/* Call startram -- Run at sdram from this inst                          */
#/*************************************************************************/
		LDR		pc, = startram	
		
#/*************************************************************************/
#/* Clear the un-initialized global and static C data areas               */
#/*************************************************************************/
#{  
startram :
		LDR		a1,=Image_ZI_Base	/* Pickup the start of the BSS area */     
		MOV		a3,#0					/* Clear value in a3 */                    
		LDR		a2,=Image_ZI_Limit	/* Pickup the end of the BSS area */       
		CMP		a1,a2                                                           
		BEQ		move_data                                                       
clear_loop :                                                                 
		STR		a3,[a1],#4				/* Clear a word, a1 += 4 */                
		CMP		a1,a2					/* end of ZI ?  */                         
		BNE		clear_loop				/* If not, continue with the BSS clear */  
#                                                                            
# Move the initialized global and initialized C data areas                   
#                                                                            
move_data :                                                                   
		LDR		a1,=Image_RW_Base	/* Pickup the start of the DATA area  */   
		LDR		a2,=Image_RO_Limit	/* Pickup the start of the DATA storage  */
		LDR		a3,=Image_ZI_Base	/* Pickup the end of the BSS area  */      
		                                                                        
		CMP		a1,a3                                                           
		BEQ		goto_main                                                       
		                                                                        
move_loop :                                                                    
		LDR		a4,[a2],#4                                                      
		STR		a4,[a1],#4				/* move a word, a1 += 4, a2 += 4 */        
		CMP		a1,a3					/* end of DATA ?   */                      
		BNE		move_loop				/* If not, continue with the BSS clear  */ 
                                                                             
goto_main :                                                                    
    	LDR     r13, =0x0c7fff00                                                                          
		LDR		pc,=Main    	
	

	
	
	

⌨️ 快捷键说明

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