STM32F10x 启动代码分析
扫描二维码
随时随地手机看文章
;******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
;* File Name: startup_stm32f10x_hd_vl.s
;* Author: MCD Application Team
;* Version: V3.4.0
;* Date: 10/15/2010
;* Description: STM32F10x High Density Value Line Devices vector table
;*for MDK-ARM toolchain.
;*This module performs:
;*- Set the initial SP
;*- Set the initial PC == Reset_Handler
;*- Set the vector table entries with the exceptions ISR address
;*- Configure the clock system and also configure the external
;*SRAM mounted on STM32100E-EVAL board to be used as data
;*memory (optional, to be enabled by user)
;*- Branches to __main in the C library (which eventually
;*calls main()).
;*After Reset the CortexM3 processor is in Thread mode,
;*priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>>
;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
;
Stack_SizeEQU0x00000400;栈大小
AREASTACK, NOINIT, READWRITE, ALIGN=3
;用AREA 标记 STACK段的开始,未初始化,可读写,8字节对齐
Stack_MemSPACEStack_Size;为Stack_Mem 分配Stack_Size个字大小的连续空间,初始化为0
__initial_sp;STACK 地址分配结束标记(结束地址)
;
Heap_SizeEQU0x00000200;堆大小
AREAHEAP, NOINIT, READWRITE, ALIGN=3
;用AREA 标记 HEAP段的开始,未初始化,可读写,8字节对齐
__heap_base;堆的基地址标识(开始地址),(汇编过程中实际分配具体地址)
Heap_MemSPACEHeap_Size;为Heap_Mem 分配Heap_Size个字大小的连续空间,初始化为0
__heap_limit;堆的末地址标记(结束地址)
PRESERVE8;要求堆栈保持8字节对齐
THUMB;说明下面的代码是Thumb 汇编
; Vector Table Mapped to Address 0 at Reset;
AREARESET, DATA, READONLY;标记 RESET 段的开始,数据段,只读
EXPORT__Vectors;声明一个全局可引用的标号“__Vectors”
EXPORT__Vectors_End;声明一个全局可引用的标号“__Vectors_End”
EXPORT__Vectors_Size;声明一个全局可引用的标号“__Vectors_Size”
__VectorsDCD__initial_sp;Top of Stack
;该处物理地址值即为 __Vetors 标号所表示的值,
;该地址中存储__initial_sp所表示的地址值,
;大小为一个字(32bit)
DCDReset_Handler;Reset Handler;这个地址填充 Reset_Handler 入口地址
DCDNMI_Handler; NMI Handler
DCDHardFault_Handler; Hard Fault Handler
DCDMemManage_Handler; MPU Fault Handler
DCDBusFault_Handler; Bus Fault Handler
DCDUsageFault_Handler; Usage Fault Handler
DCD0; Reserved;保留一个字大小的空间(32bit)
DCD0; Reserved
DCD0; Reserved
DCD0; Reserved
DCDSVC_Handler; SVCall Handler
DCDDebugMon_Handler; Debug Monitor Handler
DCD0; Reserved
DCDPendSV_Handler; PendSV Handler
DCDSysTick_Handler; SysTick Handler