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

📄 boot_gfd.s

📁 基于东南大学开发的SEP3203的ARM7中的所有驱动
💻 S
字号:
;/*****************************************************
;	file name :	 	boot.s
;	descrition:		boot the arm processor
;	history:		2003-1-7 15:59 lc create
;*****************************************************/

	
	include hardware_gfd.h
	
	extern	main
	
	AREA BOOT, CODE, READONLY                                                     
	       ENTRY                           		; Mark first instruction to execute 


;vector table
    bal		RST_DO  
	bal		EXTENT_INSTRU
	bal		SWI_DO
	bal		ABORT_PREFETCH_DO
	bal		ABORT_DATA_DO
	mov		R1,		R1				;reserved exception
	bal		Irq_Do
	mov		r0, r0
	bal		Fiq_Do   
	;the code for the fiq

;*****************************************************************
;	init all the stacks under all CPU mode
;*****************************************************************	

	
RST_DO 
	EXPORT	RST_DO
	
	ldr		sp, =0x1fff5000  		;init sp_svc
	
		
;****************************************************************
; 	init the EMI and get the memory space
;****************************************************************
  
     ;ldr		r1, =0x11000004    ;THE ADD OF EMI_CSGBAB   
     ;ldr		r2, =0x24002000	                       
     ;str		r2, [ r1 ]     
     
     
     ;ldr		r1, =0x11000008    ;THE ADD OF EMI_CSGBCD   
     ;ldr		r2, =0x2c002800	                       
     ;str		r2, [ r1 ]     
     
     ;ldr		r1, =0x1100000c    ;THE ADD OF EMI_CSGBEF   
     ;ldr		r2, =0x34003000	                       
     ;str		r2, [ r1 ]     
        
                                  
    ldr		r1, =0x11000000    ;THE ADD OF EMIADDR_SMCONF
    ldr		r2, =0x000000ff
    str		r2, [ r1 ]
    
    ;ldr		r1, =0x11000000        ;16 bit
    ;ldr		r2, =0x9b0133ff
    ;str		r2, [ r1 ]
  
 	;ldr		r1, =0x11000014        ;THE ADD OF EMIADDR_SMCONF1
    ;ldr		r2, =0x01104077
    ;str		r2, [ r1 ]
  
  	;ldr		r1, =0x11000018        ;THE ADD OF EMIADDR_SMCONF2
    ;ldr		r2, =0xc0001860
    ;str		r2, [ r1 ]
    
    ;ldr		r1, =0x11000010
    ;ldr     r2, =0x0000000b
    ;str		r2, [r1]

   ;******************************* 
  	;ldr	r1, =0x1000100c
   	;ldr	r2, =0x17fff
   	;str	r2, [r1]
   
	;ldr		r1, =0x1000b038		;sel   porte1
	;ldr		r2, =0x2
	;str		r2,[r1]
	
	;ldr		r1, =0x1000b048		;data
	;ldr		r2, =0x2
	;str		r2,[r1]
	
	;ldr		r1, =0x1000b034		;dir out
	;ldr		r2, =0x0
	;str		r2,[r1]

	
	
;***************************************************************
	IMPORT	__main
	b		__main 


;***********************************************************  


;*****************************************************************
;* entry to the interrupt handler 
;*****************************************************************
 
;*****************************************************************                                      
;*                                         *IRQ service handler flow*
;*                                         **********************
;*interrupt prehandler entrance
;*     save the registers used in the IRQ model R4, R5, R6 
;*     save the lr and spsr to the local var
;*     read the PLV
;*     save the PLV
;*     read the INT mumber, if necessary mask INTC_MSK
;*     judge and jump to the interrupt handler entrance
;*     
;*the int_handler entrance
;*     
;*     restore the reg used in the IRQ model
;*     change the model to the SYS model
;*
;*     save the spsr and lr to the sp_sys
;*     __________________________________________one layer
;*     save the reg used in the int_handler      ;useless
;*     ent int
;*     open the irq
;*     jump to the int_handler
;*     close irq
;*     jump to the end_int
;*
;*ent_int
;*     disable irq
;*
;*     restore the intc_plv   ,if necessary unmask the INTC_MSK  
;*     restore reg saved for the int_handler
;*     ret_int
;********************************************************************

Irq_Do
       stmfd   sp!, {r0-r12}         ;save all the registers
              
       mov     R6,  lr	        	;save spsr to the variable SPSR_IRQ
       sub	   r6, r6, #4	
       stmfd   sp!, {r6}		; save lr-4 to stack  
		
       ldr     R4,  =INTC_FNLSTS	    ;read the interrupt number,if necessary mask INTC_MSK
       ldr     R7,  [ R4 ]
	 
	 			 
       ldr     R4,  =0XFFFF0000	        ;clear the low 16 bits, low 16 bits are for GPIO Ints	
       AND     R5,  R7, R4				;r5 stores which device send interrupt request
	
       	
        cmp      R5,  #INTSRC_DMA        ;if need, please add the file ENT_INT_*
       ;IMPORT	ENT_INT_DMA
       ;beq	ENT_INT_DMA
	
        cmp	    R5,  #INTSRC_MMC
       ;IMPORT	ENT_INT_MMC
       ;beq	ENT_INT_MMC
	
        cmp	    R5, #INTSRC_UART1
       ;IMPORT	ENT_INT_UART2
       ;beq	ENT_INT_UART2    
	
        cmp	    R5, #INTSRC_UART2
       ;IMPORT	ENT_INT_UART1
       ;beq  	ENT_INT_UART1
		
		cmp	    r5, #INTSRC_I2C
		;IMPORT ENT_INT_I2C
		;beq ENT_INT_I2C
		
        cmp	    R5, #INTSRC_MMA
       ;IMPORT  ENT_INT_MMA
       ;beq	    ENT_INT_MMA

;ERROR  ;IF ERROR PRINT THE ERROR
;IMPORT	HA_INTC_ERROR
;BL		HA_INTC_ERROR
;SUBS	PC, LR, #4


;******************************************************************
;*	 ;end_int	
;*	 		DISABLE IRQ
;*	 		
;*	 		;restore the intc_plv. if necessary unmask the INTC_MSK
;* 			;restore reg saved for the int_handler
;*	 		;ret_int
;*******************************************************************

END_INT
        EXPORT	END_INT
	
	ldr     R6,  =INTC_PLV
	;ldr	R5,  [ R4 ]
	ldmfd	sp!, { R5 }
	str	R5, [R6]                ;restore the INTC_PLV
	
	ldmfd   sp!, {lr}		; move lr-4 to lr 
	ldmfd	sp!, {r0-r12}
	
	mov pc, lr		
			
 
EXTENT_INSTRU                                                         
	b	EXTENT_INSTRU                                                                                                    
	                                                                  
SWI_DO    
	;movs	pc, lr                                                            
	b       SWI_DO                                                    
	                                                                  
ABORT_PREFETCH_DO                                                     
	b	ABORT_PREFETCH_DO                                         
	                                                                  
ABORT_DATA_DO                                                         
	;b	ABORT_DATA_DO 
	
;ABORT_DATA_DO                                                         
	;bl	dmahandler                                             
                                  
Fiq_Do                                                                
	b	Fiq_Do                                                      
                                                                      
	

	
	;*************************************************************************                                         

;*************************************************************************

;DEFINE THE VARIABLE END
  	;DATA SECTION                        
  	
  	AREA DATA_SECTION, DATA, READWRITE   
                                         
        KEEP                             
LR_USR		DCD	0X0              
LR_SYS		DCD	0X0                  
LR_SVC	        DCD     0X0              
LR_IRQ  	DCD     0X0                  
LR_FIQ	        DCD     0X0                  
LR_UND	        DCD     0X0                  
LR_ABT	        DCD     0X0                  
                                         
                                         
SPSR_SVC	DCD     0X0                  
SPSR_IRQ	DCD     0X0                  
SPSR_FIQ	DCD     0X0                  
SPSR_UND	DCD     0X0                  
SPSR_ABT	DCD     0X0                  
                                         
INTC_PLV_V	DCD	0X0                  

	EXPORT	 LR_IRQ   
	EXPORT	 SPSR_IRQ
                             
;*************************************************************************
;*************************************************************************
;DEFINE THE VARIABLE END                   


	
	END                                                                                             

⌨️ 快捷键说明

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