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

📄 startup.s

📁 基于ARM7下的2100系列得uc-osII的工程模板!
💻 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: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:			1.01
;** Descriptions: 		Modified the bus setting to adapt for many common situations 
;**
;**-------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:			1.02
;** Descriptions: 		Added codes to support the enciphering of the chip
;**
;**-------------------------------------------------------------------------------------------------------
;** Modified by: 		Chenmingji
;** Modified date:		2004-09-17
;** Version:			1.04
;** Descriptions: 		Renewed the template, added codes to support more compilers 
;**
;**-------------------------------------------------------------------------------------------------------
;** Modified by: 		LinEnqiang
;** Modified date:		2008-01-15	
;** Version:			1.05
;** Descriptions: 		增加中断管理支持、中断服务函数不必使用 Handler
;**
;********************************************************************************************************/
                                INCLUDE     LPC2200.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模式宏定义              */

;/********************************************************************************************************
; The imported labels    
; 引入的外部标号在这声明
;********************************************************************************************************/
    IMPORT  __main                                                      ;/*  C语言主程序入口            */
    IMPORT  RunFirst                                                    ;/*  vic初始化                  */
    IMPORT  vicControl                                                  ;/*  vic管理软中断入口          */
    IMPORT  FIQ_Exception                                               ;/*  快速中断异常处理程序       */
    IMPORT  TargetResetInit                                             ;/*  目标板基本初始化           */    
    IMPORT  SoftwareInterrupt                                           ;/*  uC/OSII软中断处理入口      */
    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, UndefinedAddrA
        LDR    	 	PC, SWI_Addr
        LDR     	PC, PrefetchAddrA
        LDR     	PC, DataAbortAddrA
        DCD     	0xB8A06F58
        LDR     	PC, IRQ_Addr
        LDR     	PC, FIQ_Addr

ResetAddr           DCD     ResetInit
UndefinedAddrA      DCD     Undefined
SWI_Addr            DCD     SoftwareInterruptAdd
PrefetchAddrA       DCD     PrefetchAbort
DataAbortAddrA      DCD     DataAbort
Nouse               DCD     0
IRQ_Addr            DCD     IRQ_Handler
FIQ_Addr            DCD     FIQ_Handler

Undefined
        B       .
PrefetchAbort
        B       .
DataAbort
        B       . 
;/*********************************************************************************************************
;** Function name:           IRQ_Handler
;** Descriptions:            中断处理for uC/OSII
;** input parameters:		 none
;** output parameters:       none
;** Returned value:			 none
;**-------------------------------------------------------------------------------------------------------
;** Modified by:
;** Modified date:
;**-------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
    MACRO   
    ISR
        LDR     R2, =VICVectAddr
        LDR     R3, [R2]        
        ADD     LR, PC, #1
        BX      R3
    CODE16
        BX      PC
        NOP
    CODE32
    
    MEND
    INCLUDE		irq.inc			
IRQ_Handler  HANDLER

;/*********************************************************************************************************
;** Function name:           SoftwareInterruptAdd
;** Descriptions:            软中断处理
;** input parameters:		 none
;** output parameters:       none
;** Returned value:			 none
;**-------------------------------------------------------------------------------------------------------
;** Modified by:
;** Modified date:
;**-------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
SoftwareInterruptAdd 
        CMP     R0, #0x100
        BLO     SoftwareInterrupt
        B       vicControl    

;/*********************************************************************************************************
;** Function name:           FIQ_Handler
;** Descriptions:            FIQ中断处理
;** input parameters:		 none
;** output parameters:       none
;** Returned value:			 none
;**-------------------------------------------------------------------------------------------------------
;** Modified by:
;** Modified date:
;**-------------------------------------------------------------------------------------------------------
*********************************************************************************************************/

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
        
;/********************************************************************************************************

⌨️ 快捷键说明

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