STM32之启动文件详细解析(V3.5.0)课案.doc
文本预览下载声明
STM32 之 启动文件详细解析(V3.5.0)在STM32不完全手册里面,用的是STM32F103RBT6,所有的例程都采用了一个叫STM32F10x.s的启动文件,里面定义了STM32的堆栈大小以及各种中断的名字及入口函数名称,还有启动相关的汇编代码。STM32F10x.s是MDK提供的启动代码,从其里面的内容看来,它只定义了3个串口,4个定时器。实际上STM32的系列产品有5个串口的型号,也只有有2个串口的型号,定时器也是,做多的有8个定时器。比如,如果你用的STM32F103ZET6,而启动文件用的是STM32F10x.s的话,你可以正常使用串口1~3的中断,而串口4和5的中断,则无**常使用。又比如,你TIM1~4的中断可以正常使用,而5~8的,则无法使用。? ?而在固件库里出现3个文件startup_stm32f10x_ld.sstartup_stm32f10x_md.sstartup_stm32f10x_hd.s其中,ld.s适用于小容量 产品;md.s适用于中等容量产品;hd适用于大容量产品;这里的容量是指FLASH的大小.判断方法如下:小容量:FLASH≤32K中容量:64K≤FLASH≤128K
大容量:256K≤FLASH
;******************** (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.;* 说明:? ?? ?? ?? ?? ?此文件为STM32F10x高密度设备的MDK工具链的启动文件;*? ?? ?? ?? ?? ?? ?? ?该模块执行以下操作:;*? ?? ?? ?? ?? ?? ?? ?-设置初始堆栈指针(SP);*? ?? ?? ?? ?? ?? ?? ?-设置初始程序计数器(PC)为复位向量,并在执行main函数前初始化系统时钟;*? ?? ?? ?? ?? ?? ?? ?-设置向量表入口为异常事件的入口地址;*? ?? ?? ?? ?? ?? ?? ?-复位之后处理器为线程模式,优先级为特权级,堆栈设置为MSP主堆栈;* Use Configuration Wizard in Context Menu ??; 首先对栈和堆的大小进行定义,并在代
显示全部