STM32::startup_stm32f4xx.s(芯片启动流程)

本文详细解释了STM32单片机上电后的启动过程,包括硬件初始化、复位、SystemInit函数、中断向量表设置,以及最终跳转到main()函数执行C程序的过程。

STM32从Flash的启动流程

.s文件:硬件初始化-->复位(Reset_Handler)-->系统初始化SystemInit()-->进入__mainC库函数--> 跳转到main()开始进入C程序。

在这里插入图片描述

1,上电之后先去0x0000 0000地址加载SP指针从地址0x0000 0004加载PC指针,如果是BOOT0引脚为低电平,则指向Flash处执行程序
2,从Flash处也就是0x0800 0000加载栈顶指针SP,从0x0800 0004处加载中断向量表的起始地址PC,也就是复位程序的地址
3,执行复位程序,先执行SystemInit()函数初始化系统时钟,然后执行main()函数

在这里插入图片描述

 

 

 

【32单片机学习】(11)STM32启动过程详解_Godox_user的博客-优快云博客

启动文件详解

STM32之启动文件的详解_stm32启动文件_非常规自我实现的博客-优快云博客

*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'sbxxq' assembling startup_stm32f446xx.s... compiling pid.c... ../Core/Inc/pid.h(33): warning: #1-D: last line of file ends without a newline #endif // PID_H ..\Core\Src\pid.c(33): warning: #1-D: last line of file ends without a newline } ..\Core\Src\pid.c: 2 warnings, 0 errors compiling gpio.c... compiling stm32f4xx_it.c... compiling stm32f4xx_hal_timebase_tim.c... compiling tim.c... compiling motor_control.c... compiling stm32f4xx_hal_msp.c... compiling adc.c... compiling system_stm32f4xx.c... compiling mpu6500.c... compiling main.c... compiling stm32f4xx_ll_adc.c... compiling stm32f4xx_hal_tim.c... compiling stm32f4xx_hal_tim_ex.c... compiling stm32f4xx_hal_adc.c... compiling stm32f4xx_hal_flash.c... compiling stm32f4xx_hal_dma.c... compiling stm32f4xx_hal_flash_ramfunc.c... compiling stm32f4xx_hal_pwr.c... compiling stm32f4xx_hal_gpio.c... compiling stm32f4xx_hal_flash_ex.c... compiling stm32f4xx_hal_adc_ex.c... compiling stm32f4xx_hal_dma_ex.c... compiling stm32f4xx_hal_rcc.c... compiling stm32f4xx_hal_rcc_ex.c... compiling stm32f4xx_hal_pwr_ex.c... compiling stm32f4xx_hal_cortex.c... compiling system_stm32f4xx.c... compiling stm32f4xx_hal_exti.c... compiling stm32f4xx_hal.c... linking... sbxxq\sbxxq.axf: Error: L6200E: Symbol SystemInit multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). sbxxq\sbxxq.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____REV16 multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). sbxxq\sbxxq.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____REVSH multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). sbxxq\sbxxq.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____RRX multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). sbxxq\sbxxq.axf: Error: L6200E: Symbol AHBPrescTable multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). sbxxq\sbxxq.axf: Error: L6200E: S 编译后代码出现以上报错
最新发布
07-02
Rebuild started: Project: AD9959 *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'F:\stc\ARM\ARMCC\Bin' Rebuild target '2024C' Note: source file '..\Core\Src\gpio.c' - object file renamed from 'AD9959\gpio.o' to 'AD9959\gpio_1.o'. Note: source file '..\Core\Src\main.c' - object file renamed from 'AD9959\main.o' to 'AD9959\main_1.o'. Note: source file '..\Core\Src\stm32f4xx_hal_msp.c' - object file renamed from 'AD9959\stm32f4xx_hal_msp.o' to 'AD9959\stm32f4xx_hal_msp_1.o'. Note: source file '..\Core\Src\stm32f4xx_it.c' - object file renamed from 'AD9959\stm32f4xx_it.o' to 'AD9959\stm32f4xx_it_1.o'. Note: source file '..\Core\Src\system_stm32f4xx.c' - object file renamed from 'AD9959\system_stm32f4xx.o' to 'AD9959\system_stm32f4xx_1.o'. assembling startup_stm32f407xx.s... compiling stm32f4xx_hal_flash_ramfunc.c... compiling gpio.c... compiling stm32f4xx_hal_dma_ex.c... compiling system_stm32f4xx.c... compiling stm32f4xx_hal_cortex.c... compiling stm32f4xx_hal_pwr.c... compiling stm32f4xx_hal_pwr_ex.c... compiling stm32f4xx_hal_tim_ex.c... compiling Delay.c... compiling stm32f4xx_hal_exti.c... compiling screen.c... compiling stm32f4xx_hal_msp.c... compiling stm32f4xx_hal_gpio.c... compiling stm32f4xx_hal.c... compiling ad9959.c... compiling stm32f4xx_hal_flash.c... compiling stm32f4xx_hal_rcc_ex.c... compiling stm32f4xx_it.c... compiling stm32f4xx_hal_flash_ex.c... compiling key.c... ..\Hardware\key.c(59): warning: #1-D: last line of file ends without a newline ..\Hardware\key.c: 1 warning, 0 errors compiling main.c... compiling stm32f4xx_hal_dma.c... compiling stm32f4xx_hal_rcc.c... compiling stm32f4xx_hal_tim.c... compiling sys.c... compiling uart.c... compiling gpio.c... compiling main.c... compiling stm32f4xx_hal_msp.c... compiling system_stm32f4xx.c... compiling stm32f4xx_it.c... linking... AD9959\AD9959.axf: Error: L6200E: Symbol SystemInit multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol NMI_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol HardFault_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol MemManage_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol BusFault_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol UsageFault_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol SVC_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol DebugMon_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol PendSV_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol SysTick_Handler multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_main_c_66f8bec5____REV16 multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_main_c_66f8bec5____REVSH multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_main_c_66f8bec5____RRX multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol __ARM_use_no_argv multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol main multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol screen_Init multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol signal_setting multiply defined (by main_1.o and main.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_gpio_c_62724882____REV16 multiply defined (by gpio_1.o and gpio.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_gpio_c_62724882____REVSH multiply defined (by gpio_1.o and gpio.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___6_gpio_c_62724882____RRX multiply defined (by gpio_1.o and gpio.o). AD9959\AD9959.axf: Error: L6200E: Symbol MX_GPIO_Init multiply defined (by gpio_1.o and gpio.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___14_stm32f4xx_it_c_bb8ca80c____REV16 multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___14_stm32f4xx_it_c_bb8ca80c____REVSH multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___14_stm32f4xx_it_c_bb8ca80c____RRX multiply defined (by stm32f4xx_it_1.o and stm32f4xx_it.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___19_stm32f4xx_hal_msp_c_d46e2bee____REV16 multiply defined (by stm32f4xx_hal_msp_1.o and stm32f4xx_hal_msp.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___19_stm32f4xx_hal_msp_c_d46e2bee____REVSH multiply defined (by stm32f4xx_hal_msp_1.o and stm32f4xx_hal_msp.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___19_stm32f4xx_hal_msp_c_d46e2bee____RRX multiply defined (by stm32f4xx_hal_msp_1.o and stm32f4xx_hal_msp.o). AD9959\AD9959.axf: Error: L6200E: Symbol HAL_MspInit multiply defined (by stm32f4xx_hal_msp_1.o and stm32f4xx_hal_msp.o). AD9959\AD9959.axf: Error: L6200E: Symbol SystemCoreClock multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____REV16 multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____REVSH multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol __asm___18_system_stm32f4xx_c_5d646a67____RRX multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol AHBPrescTable multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol APBPrescTable multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). AD9959\AD9959.axf: Error: L6200E: Symbol SystemCoreClockUpdate multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 35 error messages. "AD9959\AD9959.axf" - 35 Error(s), 1 Warning(s). Target not created. Build Time Elapsed: 00:00:07
06-03
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值