STM32啟動(dòng)過程詳解
一、STM32啟動(dòng)文件詳細(xì)解析
STM32啟動(dòng)文件詳細(xì)解析(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
;
;
;
Stack_SizeEQU0x00000400;EQU偽指令,作用是左邊的符號(hào)名代表右邊的表達(dá)式
AREASTACK,NOINIT,READWRITE,ALIGN=3;定義棧段:名稱為STACK,未初始化,可讀寫,ELF的棧段按2^3=8對(duì)齊
Stack_MemSPACEStack_Size;分配一片連續(xù)的存儲(chǔ)區(qū)域并初始化為0,??臻g:0x400個(gè)字節(jié)
__initial_sp;??臻g頂?shù)刂?/p>
;
;
;
Heap_SizeEQU0x00000200
AREAHEAP,NOINIT,READWRITE,ALIGN=3
__heap_base;堆空間起始地址
Heap_MemSPACEHeap_Size;堆空間:0x200個(gè)字節(jié)
__heap_limit;堆空間結(jié)束地址
PRESERVE8;PRESERVE8指令指定當(dāng)前文件保持堆棧八字節(jié)對(duì)齊
THUMB;告訴匯編器下面是32位的Thumb指令,如果需要匯編器將插入位以保證對(duì)齊
;VectorTableMappedtoAddress0atReset;中斷向量表定義
;實(shí)際上是在CODE區(qū)(假設(shè)STM32從FLASH啟動(dòng),則此中斷向量表起始地址即為0x8000000)
AREARESET,DATA,READONLY;定義一塊數(shù)據(jù)段,只可讀
EXPORT__Vectors;EXPORT:在程序中聲明一個(gè)全局的標(biāo)號(hào)__Vectors,該標(biāo)號(hào)可在其他的文件中引用