keil MDK启动文件分析基于LPC2100系列其实都是相通的Word格式.docx
《keil MDK启动文件分析基于LPC2100系列其实都是相通的Word格式.docx》由会员分享,可在线阅读,更多相关《keil MDK启动文件分析基于LPC2100系列其实都是相通的Word格式.docx(20页珍藏版)》请在冰点文库上搜索。
![keil MDK启动文件分析基于LPC2100系列其实都是相通的Word格式.docx](https://file1.bingdoc.com/fileroot1/2023-5/8/9a787bf0-744a-45d2-a7ef-f028c66334ce/9a787bf0-744a-45d2-a7ef-f028c66334ce1.gif)
;
/*****************************************************************************/
/*STARTUP.S:
StartupfileforPhilipsLPC2000
*/
/*<
<
UseConfigurationWizardinContextMenu>
>
*/
/*ThisfileispartoftheuVision/ARMdevelopmenttools.
/*Copyright(c)2005-2007KeilSoftware.Allrightsreserved.
/*Thissoftwaremayonlybeusedunderthetermsofavalid,current,
/*enduserlicencefromKEILforacompatibleversionofKEILsoftware
/*developmenttools.Nothingelsegivesyoutherighttousethissoftware.*/
这段是一些说明,无非说些版权,时间信息等,注意红色标注出的语句必须在前100行文本中声明如下语句,这样编辑器将以配置向导视图的形式打开配置文件。
StandarddefinitionsofModebitsandInterrupt(I&
F)flagsinPSRs
Mode_USR
EQU
0x10
Mode_FIQ
0x11
Mode_IRQ
0x12
Mode_SVC
0x13
Mode_ABT
0x17
Mode_UND
0x1B
Mode_SYS
0x1F
I_Bit
0x80
;
whenIbitisset,IRQisdisabled
F_Bit
0x40
whenFbitisset,FIQisdisabled
这段代码用于定义一些模式,以及定义中断屏蔽位。
//<
h>
StackConfiguration(StackSizesinBytes)
//
<
o0>
UndefinedMode
0x0-0xFFFFFFFF:
8>
o1>
SupervisorMode
o2>
AbortMode
o3>
FastInterruptMode<
o4>
InterruptMode
o5>
User/SystemMode
/h>
UND_Stack_Size
0x00000000
SVC_Stack_Size
0x00000008
ABT_Stack_Size
FIQ_Stack_Size
IRQ_Stack_Size
0x00000080
USR_Stack_Size
0x00000400
ISR_Stack_Size
(UND_Stack_Size+SVC_Stack_Size+ABT_Stack_Size+/
FIQ_Stack_Size+IRQ_Stack_Size)
AREA
STACK,NOINIT,READWRITE,ALIGN=3
Stack_Mem
SPACE
USR_Stack_Size
__initial_sp
ISR_Stack_Size
Stack_Top
这一段配置堆栈空间,注意红色部分可以生成图形化的界面,
--Heading标题:
表示以下选项在一个组中,直到遇到<
,表示Heading标题标题结束。
ox>
(x=1,2,3...)--表示可以指定一个值的范围
User/SystemMode<
--表示用户模式下堆栈范围为0~0xFFFFFFFF之间,数字“8”表示每次递增或递减的步长为8.
上面代码生成的图形化配置界面如下图:
若将上图的interrupt
Mode的值该为0x00000100,则启动代码的“IRQ_Stack_Size
0x00000080”自动变为“IRQ_Stack_Size
0x00000100”
HeapConfiguration
o>
HeapSize(inBytes)<
0x0-0xFFFFFFFF>
Heap_Size
HEAP,NOINIT,READWRITE,ALIGN=3
__heap_base
Heap_Mem
Heap_Size
__heap_limit
配置堆的大小,情况与配置堆栈十分相识。
e>
VPBDIVSetup
i>
PeripheralBusClockRate
o1.0..1>
VPBDIV:
VPBClock
0=>
VPBClock=CPUClock/4
1=>
VPBClock=CPUClock
2=>
VPBClock=CPUClock/2
o1.4..5>
XCLKDIV:
XCLKPin
XCLKPin=CPUClock/4
XCLKPin=CPUClock
XCLKPin=CPUClock/2
/e>
VPBDIV_SETUP
1
VPBDIV_Val
PhaseLockedLoop(PLL)definitions
PLL_BASE
0xE01FC080
PLLBaseAddress
PLLCON_OFS
0x00
PLLControlOffset
PLLCFG_OFS
0x04
PLLConfigurationOffset
PLLSTAT_OFS
0x08
PLLStatusOffset
PLLFEED_OFS
0x0C
PLLFeedOffset
PLLCON_PLLE
(1<
0)
PLLEnable
PLLCON_PLLC
1)
PLLConnect
PLLCFG_MSEL
(0x1F<
PLLMultiplier
PLLCFG_PSEL
(0x03<
5)
PLLDivider
PLLSTAT_PLOCK
10)
PLLLockStatus
配置VPBDIV
--Heading且Enable标题:
表示以下选项在一个组中,选项可通过Checkbox使能
---修改数值的指定位
PLLSetup
o1.0..4>
MSEL:
PLLMultiplierSelection
1-32>
#-1>
MValue
o1.5..6>
PSEL:
PLLDividerSelection
1
2
4
3=>
8
PValue
PLL_SETUP
PLLCFG_Val
0x00000023
配置PLL。
情况与配置VPBDIV十分相似。
MemoryAcceleratorModule(MAM)definitions
MAM_BASE
0xE01FC000
MAMBaseAddress
MAMCR_OFS
MAMControlOffset
MAMTIM_OFS
MAMTimingOffset
MAMSetup
MAMControl
Disabled
PartiallyEnabled
FullyEnabled
Mode
o2.0..2>
MAMTiming
Reserved
3
4=>
5=>
5
6=>
6
7=>
7
FetchCycles
MAM_SETUP
MAMCR_Val
0x00000002
MAMTIM_Val
0x00000004
配置存储器加速模块,情况与配置VPBDIV十分相似。
ExternalMemoryController(EMC)definitions
EMC_BASE
0xFFE00000
EMCBaseAddress
BCFG0_OFS
BCFG0Offset
BCFG1_OFS
BCFG1Offset
BCFG2_OFS
BCFG2Offset
BCFG3_OFS
BCFG3Offset
ExternalMemoryController(EMC)
EMC_SETUP
0
BankConfiguration0(BCFG0)
o1.0..3>
IDCY:
IdleCycles<
0-15>
o1.5..9>
WST1:
WaitStates1<
0-31>
o1.11..15>
WST2:
WaitStates2<
o1.10>
RBLE:
ReadByteLaneEnable
o1.26>
WP:
WriteProtect
o1.27>
BM:
BurstROM
o1.28..29>
MW:
MemoryWidth
8-bit
16-bit
32-bit
Reserved
BCFG0_SETUPEQU
BCFG0_Val
0x0000FBEF
BankConfiguration1(BCFG1)
BCFG1_SETUPEQU
BCFG1_Val
BankConfiguration2(BCFG2)
BCFG2_SETUPEQU
BCFG2_Val
BankConfiguration3(BCFG3)
BCFG3_SETUPEQU
BCFG3_Val
EndofEMC
配置外部存储器,情况和配置VPBDIV类似。
ExternalMemoryPinsdefinitions
PINSEL2
0xE002C014
PINSEL2Address
PINSEL2_Val
0x0E6149E4
CS0..3,OE,WE,BLS0..3,
D0..31,A2..23,JTAGPins
定义外部存储器引脚。
PRESERVE8
AreaDefinitionandEntryPoint
StartupCodemustbelinkedfirstatAddressatwhichitexpectstorun.
RESET,CODE,READONLY
ARM
声明使用ARM模式
默认连接下,启动代码必须放在RESET段内
ExceptionVectors
MappedtoAddress0.
Absoluteaddressingmodemustbeused.
DummyHandlersareimplementedasinfiniteloopswhichcanbemodified.
Vectors
LDR
PC,Reset_Addr
定义异常向量-复位
PC,Undef_Addr
未定义指令
PC,SWI_Addr
软件中中断
PC,PAbt_Addr
预取指中止
PC,DAbt_Addr
数据中止
NOP
ReservedVector保留
PC,IRQ_Addr
IRQ中断,用下面的语句代替本句,这样能更快的进入中断
PC,[PC,#-0x0FF0]
从VicVectAddr寄存器读取中断向量地址.
当CPU执行这条指令还没有跳转时,