📄 startup.s
字号:
;/****************************************Copyright (c)**************************************************
;** Guangzhou ZHIYUAN electronics Co.,LTD.
;** http://www.zyinside.com
;**
;**--------------File Info-------------------------------------------------------------------------------
;** File name: Startup.s
;** Last modified Date: 2006-02-22
;** Last Version: 1.0
;** Descriptions: The start up codes for LPC2200, 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: 2005-11-22
;** Version: 1.0
;** Descriptions: The original version
;**
;**------------------------------------------------------------------------------------------------------
;** Modified by:
;** Modified date:
;** Version:
;** Descriptions:
;**
;********************************************************************************************************/
preserve8
IRQ_STACK_LEGTH EQU (8 * 3) ;/* 允许3层嵌套 */
StackIRQ EQU (IrqStackSpace + IRQ_STACK_LEGTH * 4 - 4)
INCLUDE LPC2294.INC ; Include the head file 引入头文件
NoInt EQU 0x80
NoFIQ EQU 0x40
UND32Mode EQU 0x1b
USR32Mode EQU 0x10
SVC32Mode EQU 0x13
SYS32Mode EQU 0x1f
IRQ32Mode EQU 0x12
FIQ32Mode EQU 0x11
TMode EQU 0x20
;The exported labels
;给外部使用的标号在这声明
EXPORT Reset
CODE32
AREA vectors,CODE,READONLY
ENTRY
;interrupt vectors
;中断向量表
Reset
LDR PC, Reset_1
Reset_1 DCD ResetInit
B .
B .
B .
DCD -(0xe51ff004 + 0xe321f0d2 + 0xeafffffe + 0xeafffffe +0xeafffffe + 0xe51ffff0 + 0xe25ef004)
LDR PC, [PC, #-0xff0]
SUBS PC, LR, #4
;/*********************************************************************************************************
;** unction name 函数名称: ResetInit
;** Descriptions 功能描述: reset code
;** input parameters 输 入: None 无
;** Returned value 输 出 : None 无
;** Used global variables 全局变量: None 无
;** Calling modules 调用模块: None 无
;**
;** Created by 作 者: Chenmingji 陈明计
;** Created Date 日 期: 2004/03/27 2004年3月27日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 修 改:
;** Modified date 日 期:
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
ResetInit
MSR CPSR_c, #(IRQ32Mode | NoInt | NoFIQ)
LDR SP, =StackIRQ
MSR CPSR_c, #(SYS32Mode | NoInt | NoFIQ)
LDR SP, =StackUsr
LDR R0, =VICVectAddr
MOV R1, #0x00
STR R1, [R0]
LDR R1, =Main
BX R1
LTORG
;********************************************************************************************************/
;函数名称:Main
;函数功能:测试内部SRAM的回写缓冲区。第一次上电复位后,蜂鸣器不会鸣叫,手动复位后,蜂鸣器会鸣叫。
;说明:跳线JP9短接。
;********************************************************************************************************/
TEST_RAM EQU 0x40000100 ;测试RAM的地址
BEEP_CON EQU 1<<7
CODE32
Main
;add usr code
LDR R0,=PINSEL0 ;P0.7引脚为GPIO
MOV R1,#0x00
STR R1,[R0]
LDR R0,=IO0DIR
LDR R1,=BEEP_CON ;P0.7为输出模式
STR R1,[R0]
LDR R0,=IO0SET ;蜂鸣器停止鸣叫
STR R1,[R0]
LDR R0,=TEST_RAM ;比较0x40001000处的数据是否为0x44444444
LDR R2,[R0]
LDR R3,=0x33333333
CMP R2,R3
LDR R4,=IO0CLR
LDR R1,=BEEP_CON
STREQ R1,[R4] ;如果0x40001000处的数据为0x33333333,则蜂鸣器鸣叫
LDR R1,=0x11111111 ;第一次向0x40001000处写入0x11111111
STR R1,[R0]
LDR R1,=0x22222222 ;第二次向0x40001000处写入0x22222222
STR R1,[R0]
LDR R1,=0x33333333 ;第三次向0x40001000处写入0x33333333
STR R1,[R0]
LDR R1,=0x44444444 ;第四次向0x40001000处写入0x44444444
STR R1,[R0]
; LDR R0,=0x40000000 ;如果再执行一次对RAM的写操作,便会确保0x44444444写入到0x40001000处。
; STR R0,[R0]
LOOP
B LOOP
;/*********************************************************************************************************
;** unction name 函数名称: CrpData
;** Descriptions 功能描述: encrypt the chip
;** input parameters 输 入: None 无
;** Returned value 输 出 : None 无
;** Used global variables 全局变量: None 无
;** Calling modules 调用模块: None 无
;**
;** Created by 作 者: Chenmingji 陈明计
;** Created Date 日 期: 2004/03/27 2004年3月27日
;**-------------------------------------------------------------------------------------------------------
;** Modified by 修 改:
;** Modified date 日 期:
;**-------------------------------------------------------------------------------------------------------
;********************************************************************************************************/
IF :DEF: EN_CRP
IF . >= 0x1fc
INFO 1,"\nThe data at 0x000001fc must be 0x87654321.\nPlease delete some source before this line."
ENDIF
CrpData
WHILE . < 0x1fc
NOP
WEND
CrpData1
DCD 0x87654321 ;/*When the Data is 为0x87654321,user code be protected. 当此数为0x87654321时,用户程序被保护 */
ENDIF
AREA MyStacks, DATA, NOINIT, ALIGN=2
IrqStackSpace SPACE IRQ_STACK_LEGTH * 4 ;Stack spaces for Interrupt ReQuest Mode 中断模式堆栈空间
AREA Stacks, DATA, NOINIT
StackUsr
END
;/*********************************************************************************************************
;** End Of File
;********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -