一、STM32啟動文件詳細解析
STM32啟動文件詳細解析(V3.5.0) 以:startup_stm32f10x_hd.s為例
;********************(C)COPYRIGHT2011STMicroelectronics********************
;*FileName:startup_stm32f10x_hd.s
;*Author:MCDApplicationTeam
;*Version:V3.5.0
;*Date:11-March-2011
;*Description:STM32F10xHighDensityDevicesvectortableforMDK-ARM
;*toolchain.
;*Thismoduleperforms:
;*-SettheinitialSP
;*-SettheinitialPC==Reset_Handler
;*-SetthevectortableentrieswiththeexceptionsISRaddress
;*-Configuretheclocksystemandalsoconfiguretheexternal
;*SRAMmountedonSTM3210E-EVALboardtobeusedasdata
;*memory(optional,tobeenabledbyuser)
;*-Branchesto__mainintheClibrary(whicheventually
;*callsmain())。
;*AfterResettheCortexM3processorisinThreadmode,
;*priorityisPrivileged,andtheStackissettoMain.
;*《《》》
;*******************************************************************************
;THEPRESENTFIRMWAREWHICHISFORGUIDANCEONLYAIMSATPROVIDINGCUSTOMERS
;WITHCODINGINFORMATIONREGARDINGTHEIRPRODUCTSINORDERFORTHEMTOSAVETIME.
;ASARESULT,STMICROELECTRONICSSHALLNOTBEHELDLIABLEFORANYDIRECT,
;INDIRECTORCONSEQUENTIALDAMAGESWITHRESPECTTOANYCLAIMSARISINGFROMTHE
;CONTENTOFSUCHFIRMWAREAND/ORTHEUSEMADEBYCUSTOMERSOFTHECODING
;INFORMATIONCONTAINEDHEREININCONNECTIONWITHTHEIRPRODUCTS.
;*******************************************************************************
;Amountofmemory(inbytes)allocatedforStack
;Tailorthisvaluetoyourapplicationneeds
;StackConfiguration;棧定義
;StackSize(inBytes)《0x0-0xFFFFFFFF:8》
;
Stack_SizeEQU0x00000400;EQU偽指令,作用是左邊的符號名代表右邊的表達式
AREASTACK,NOINIT,READWRITE,ALIGN=3;定義棧段:名稱為STACK,未初始化,可讀寫,ELF的棧段按2^3=8對齊
Stack_MemSPACEStack_Size;分配一片連續的存儲區域并初始化為0,棧空間:0x400個字節
__initial_sp;棧空間頂地址
;HeapConfiguration;堆定義
;HeapSize(inBytes)《0x0-0xFFFFFFFF:8》
;
Heap_SizeEQU0x00000200
AREAHEAP,NOINIT,READWRITE,ALIGN=3
__heap_base;堆空間起始地址
Heap_MemSPACEHeap_Size;堆空間:0x200個字節
__heap_limit;堆空間結束地址
PRESERVE8;PRESERVE8指令指定當前文件保持堆棧八字節對齊
THUMB;告訴匯編器下面是32位的Thumb指令,如果需要匯編器將插入位以保證對齊
;VectorTableMappedtoAddress0atReset;中斷向量表定義
;實際上是在CODE區(假設STM32從FLASH啟動,則此中斷向量表起始地址即為0x8000000)
AREARESET,DATA,READONLY;定義一塊數據段,只可讀,段名字是RESET
EXPORT__Vectors;EXPORT:在程序中聲明一個全局的標號__Vectors,該標號可在其他的文件中引用
評論
查看更多