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

📄 startup.s

📁 SmartARM2400系列开发板全套资料
💻 S
📖 第 1 页 / 共 2 页
字号:
;/****************************************Copyright (c)***************************************************
**                         Guangzhou ZHIYUAN electronics Co.,LTD.                               
**                                     
**                               http://www.embedtools.com
;**
;**--------------File Info--------------------------------------------------------------------------------
;** File name: 			Startup.s
;** Last modified Date:  
;** Last Version: 		
;** Descriptions: 		The start up codes for LPC2100, including the initializing codes for the entry 
;**                     point of exceptions and the stacks of user tasks. Every project should have a 
;**                     independent copy of this file for related modifications
;**-------------------------------------------------------------------------------------------------------
;** Created by: 		Chenmingji
;** Created date:   	2004-02-02
;** Version:			1.0
;** Descriptions: 		The original version
;**-------------------------------------------------------------------------------------------------------
;** Modified by: 		LinEnqiang
;** Modified date:		2008-05-05	
;** Version:			1.01
;** Descriptions: 		增加中断管理支持、中断服务函数不必使用 Handler fo LPC2400
;**
;********************************************************************************************************/
                                INCLUDE     LPC2400.INC                 ;/*  引入头文件                 */
                                                                        ;/*  定义堆栈的大小             */
SVC_STACK_LEGTH     EQU         0
FIQ_STACK_LEGTH     EQU         10
IRQ_STACK_LEGTH     EQU         9 * 8                                   ;/*  每层嵌套需要9个字堆栈,允许*/
                                                                        ;/*  8嵌套层                    */
ABT_STACK_LEGTH     EQU         0
UND_STACK_LEGTH     EQU         0

NoInt               EQU         0x80                                    ;/*  禁止 IRQ 中断宏定义        */
NoFIQ		        EQU	        0x40                                    ;/*  禁止 FIQ 中断宏定义        */

USR32Mode           EQU         0x10                                    ;/*  用户模式宏定义             */
SVC32Mode           EQU         0x13                                    ;/*  管理模式宏定义             */
SYS32Mode           EQU         0x1f                                    ;/*  系统模式宏定义             */
IRQ32Mode           EQU         0x12                                    ;/*  IRQ模式宏定义              */
FIQ32Mode           EQU         0x11                                    ;/*  FIQ模式宏定义              */

WAITWEN0            EQU         0x0F                                    ;/* 配置EMCStaticWaitWen0       */
WAITOEN0            EQU         0x0F                                    ;/* 配置EMCStaticWaitOen0       */ 
WAITRD0             EQU         0x0F                                    ;/* 配置EMCStaticWaitRd0        */
WAITPAGE0           EQU         0x1F                                    ;/* 配置EMCStaticWaitPage0      */
WAITWR0             EQU         0x0F                                    ;/* 配置EMCStaticWaitWr0        */
WAITTURN0           EQU         0x0F                                    ;/* 配置EMCStaticWaitTurn0      */

WAITWEN1            EQU         0x00                                    ;/* 配置EMCStaticWaitWen1       */
WAITOEN1            EQU         0x01                                    ;/* 配置EMCStaticWaitOen1       */ 
WAITRD1             EQU         0x04                                    ;/* 配置EMCStaticWaitRd1        */
WAITPAGE1           EQU         0x1F                                    ;/* 配置EMCStaticWaitPage1      */
WAITWR1             EQU         0x02                                    ;/* 配置EMCStaticWaitWr1        */
WAITTURN1           EQU         0x0F                                    ;/* 配置EMCStaticWaitTurn1      */

WAITWEN2            EQU         0x0F                                    ;/* 配置EMCStaticWaitWen2       */
WAITOEN2            EQU         0x0F                                    ;/* 配置EMCStaticWaitOen2       */ 
WAITRD2             EQU         0x0F                                    ;/* 配置EMCStaticWaitRd2        */
WAITPAGE2           EQU         0x1F                                    ;/* 配置EMCStaticWaitPage2      */
WAITWR2             EQU         0x0F                                    ;/* 配置EMCStaticWaitWr2        */
WAITTURN2           EQU         0x0F                                    ;/* 配置EMCStaticWaitTurn2      */

WAITWEN3            EQU         0x0F                                    ;/* 配置EMCStaticWaitWen3       */
WAITOEN3            EQU         0x0F                                    ;/* 配置EMCStaticWaitOen3       */ 
WAITRD3             EQU         0x0F                                    ;/* 配置EMCStaticWaitRd3        */
WAITPAGE3           EQU         0x1F                                    ;/* 配置EMCStaticWaitPage3      */
WAITWR3             EQU         0x0F                                    ;/* 配置EMCStaticWaitWr3        */
WAITTURN3           EQU         0x0F                                    ;/* 配置EMCStaticWaitTurn3      */


BCFG_08DEF	        EQU	        0x00000000                              ;/*   8Bit Bus                  */
BCFG_16DEF	        EQU	        0x00000001                              ;/*  16Bit Bus                  */
BCFG_32DEF	        EQU	        0x00000002                              ;/*  32Bit Bus                  */

;//                       |  页模式    |  片选极性  |字节定位状态|  延长等待  |  写缓冲区  |   写保护   |
;//                       |    PM      |    PC      |    PB      |     EW     |     B      |     P      |
;//                       |0:禁能1:使能| 0:低 1:高  |            |0:禁能1:使能|0:禁能1:使能|0:禁能1:使能|
BCFG0               EQU   ( (0x00<<03) | (0x00<<06) | (0x01<<07) | (0x00<<8)  | (0x00<<19) | (0x00<<20) )
BCFG1               EQU   ( (0x00<<03) | (0x00<<06) | (0x01<<07) | (0x00<<8)  | (0x00<<19) | (0x00<<20) )
BCFG2               EQU   ( (0x00<<03) | (0x00<<06) | (0x01<<07) | (0x00<<8)  | (0x00<<19) | (0x00<<20) )
BCFG3               EQU   ( (0x00<<03) | (0x00<<06) | (0x01<<07) | (0x00<<8)  | (0x00<<19) | (0x00<<20) )

STATICCFG0	        EQU   ( BCFG_16DEF | BCFG0 ) 
STATICCFG1          EQU	  ( BCFG_16DEF | BCFG1 )
STATICCFG2	        EQU	  ( BCFG_16DEF | BCFG2 )
STATICCFG3          EQU	  ( BCFG_16DEF | BCFG3 )

;/********************************************************************************************************
; The imported labels    
; 引入的外部标号在这声明
;********************************************************************************************************/

    IMPORT  __main                                                      ;/*  C语言主程序入口            */        
    IMPORT  RunFirst
    IMPORT  SDRAMInit
    IMPORT  vicControl
    IMPORT  FIQ_Exception                                               ;/*  快速中断异常处理程序       */
    IMPORT  TargetResetInit                                             ;/*  目标板基本初始化           */    
    IMPORT	SoftwareInterrupt    
    IMPORT __use_two_region_memory
    IMPORT __use_no_semihosting_swi
;/********************************************************************************************************
; The emported labels    
; 给外部使用的标号在这声明
;********************************************************************************************************/

    EXPORT  Reset    
	EXPORT  StackUsr   
	EXPORT  InitStack
	EXPORT  bottom_of_heap  
	EXPORT  SoftwareInterruptAdd
	EXPORT  __user_initial_stackheap
	
    CODE32

    AREA    vectors,CODE,READONLY
        ENTRY
Reset                                                                   ;/*  中断向量表                 */
        LDR         PC, ResetAddr
        LDR     	PC, UndefinedAddr
        LDR    	 	PC, SWI_Addr
        LDR     	PC, PrefetchAddr 
        LDR     	PC, DataAbortAddr
        DCD     	0xB8A06F58
        LDR     	PC, IRQ_Addr
        LDR     	PC, FIQ_Addr

ResetAddr           DCD     ResetInit
UndefinedAddr       DCD     Undefined
SWI_Addr            DCD     SoftwareInterruptAdd
PrefetchAddr        DCD     PrefetchAbort
DataAbortAddr       DCD     DataAbort
Nouse               DCD     0
IRQ_Addr            DCD     IRQ_Handler
FIQ_Addr            DCD     FIQ_Handler

Undefined
        B       .
PrefetchAbort
        B       .
DataAbort
        B       .               
SoftwareInterruptAdd 
        CMP     R0, #0x100
        BLO     SoftwareInterrupt
        B       vicControl    
;/********************************************************************************************************
; IRQ中断
;********************************************************************************************************/
    MACRO
    ISR
        LDR     R2, =VICVectAddr
        LDR     R3, [R2]
        MOV     LR, PC
        BX      R3
    MEND
    INCLUDE		irq.inc	
IRQ_Handler  HANDLER

;/********************************************************************************************************
; 快速中断
;********************************************************************************************************/
FIQ_Handler
        STMFD   SP!, {R0-R3, LR}
        LDR     R2, =FIQ_Exception+1
        ADD     LR, PC, #1
        BX      R2
    CODE16
        BX      PC
        NOP
    CODE32         
        LDMFD   SP!, {R0-R3, LR}
        SUBS    PC,  LR,  #4
;/********************************************************************************************************
;** Function name:          ResetInit
;**
;** Descriptions:           复位处理
;**
;** input parameters:       None
;** Returned value:         None
;**
;** Created by:             Chenmingji
;** Created Date:           2004/02/02
;**-------------------------------------------------------------------------------------------------------
;** Modified by:            LinEnqiang
;** Modified date:          2008-01-15
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
ResetInit 
        
        BL      RunFirst
              
        LDR     R1, =STATICCFG0		                                    ;/* 配置EMCStaticConfig0        */
        LDR     R2, =WAITWEN0			                                ;/* 配置EMCStaticWaitWen0       */
        LDR     R2, =WAITWEN0			                                ;/* 配置EMCStaticWaitWen0       */
        LDR     R3, =WAITOEN0		                                    ;/* 配置EMCStaticWaitOen0       */
        LDR     R4, =WAITRD0		    	                            ;/* 配置EMCStaticWaitRd0        */

⌨️ 快捷键说明

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