STM32启动文件之二 启动文件小解

这篇博客主要解析了STM32启动文件的内容,包括堆栈初始化、中断向量表定义、代码段和异常处理程序。同时提到了启动代码的简化方法,如去除外部中断和SystemInit,以及如何手动添加中断服务程序。文章还介绍了如何在main函数中进行系统初始化,并且讲解了堆和栈的配置。
摘要由CSDN通过智能技术生成
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name          : startup_stm32f10x_hd.s
;* Author             : MCD Application Team
;* Version            : V3.5.0
;* Date               : 11-March-2011
;* Description        : STM32F10x High Density 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 STM3210E-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
; <h> Stack Configuration
;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

;定义堆栈大小
Stack_Size      EQU     0x00000400


                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp
                                                  
; <h> Heap Configuration
;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

;定义堆空间大小
Heap_Size       EQU     0x00000200


                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem        SPACE   Heap_Size
__heap_limit


                PRESERVE8          ;8位对齐
                THUMB                   ;使用THUMB指令集




; Vector Table Mapped to Address 0 at Reset
                AREA    RESET, DATA, READONLY  ;定义只读数据段
                EXPORT  __Vectors                            ;全局变量
                EXPORT  __Vectors_End
                EXPORT  __Vectors_Size


__Vectors       DCD     __initial_sp               ; Top of Stack     ;建立中断向量表,向量表起始地址, 注意编程中中断函数取名一致的问题,否可中断不起作用
                DCD     Reset_Handler              ; Reset Handler     ;DCD为为伪指令,存储一个连续的存储空间,并用伪指令中的表达式初始化
                DCD     NMI_Handler                ; NMI Handler
                DCD     HardFault_Handler          ; Hard Fault Handler
                DCD     MemManage_Handler          ; MPU Fault Handler
                DCD     BusFault_Handler           ; Bus Fault Handler
                DCD     UsageFault_Handler         ; Usage Fault Handler
                DCD     0                          ; Reserved
                DCD     0                          ; Reserved
                DCD     0                          ; Reserved
                DCD     0                          ; Reserved
           
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
/******************** (C) COPYRIGHT 2009 STMicroelectronics ******************** * File Name : version.txt * Author : MCD Application Team * Version : V2.0.0 * Date : 07/03/2009 * Description : Version file for Flash Loader Demonstrator ******************************************************************************** * THE PRESENT SOFTWARE 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 SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ * V2.0.0 - 03/07/2009 ===================== New Features ************ + Adding STM32 connectivity line and STM8 devices + Adding CAN communication for connectivity line devices over COMBox bridge + Adding Access to DfuSe Demo (the DfuSe Demo should be installed on your machine) * V1.3.0 - 03/05/2009 ===================== Enhancements ************ + Allow device selection in the flash loader GUI for non programmed flash size devices + Add Visual studio 2005 workspace template under INSTALLDIR\src directory * V1.2.0 - 10/23/2008 ===================== New Features ************ + Support of Low density and STM32 USB Access line devices Enhancements ************ + Fix a minor issue of COM ports with greater than 9 numbers + Fix a minor issue of the GUI pages transition after enabling or disabling protection + RAM size information in the Device information page is removed * V1.1.1 - 06/16/2008 ===================== + Remove the Software License Agreement file + Update the source files's header to remove reference to the License * V1.1.0 - 06/02/2008 =================== New Features ************ + Add SOFTWARE License Agreement file + Save the last used configuration for the serial communication + Save the last used file names for upload and download operations + Add Enable/Diable the Read/Write protection commands + Add Option bytes Window for flexible usage + Add Option bytes upgrade thru files option to the download operation + Add of a Command line version of the flash loader demonstrator + Add of Source Files of the command line version + Add headers and and library files of common run-time DLLs + Support all STM32 family products,STR75x products, and all STMicroelectronics products implementing the bootloader protocol Enhancements ************ + Fix a minor issue of format with the Upload operation in a binary file + Fix a minor issue with erase command status update + Fix an issue of Download, Upload and erase operations with an image size (>32k) * V1.0.0 - 10/25/2007 ==================== Created. ******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE******
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值