ARM 之八 Cortex-M/R 内核启动过程 / 程序启动流程(基于IAR)

  在前面的文章《ARM 之 Cortex-M/R 内核启动过程 / 程序启动流程(基于ARMCC)》中已经介绍过了 Cortex-M/R 内核相关内容。这里基于 IAR 的启动流程与之前的并没有太大区别,因为这是 Cortex-M/R 内核规定好的。无论是 ARMCC 还是 IAR 都需要遵循内核的规定。区别主要在于初始化的个函数接口不同!
  相比于 《ARM 之 Cortex-M/R 内核启动过程 / 程序启动流程(基于ARMCC)》 IAR 关于这方面的介绍就少多了,不像 ARM 提供了各种文档来详细介绍各个方面!如果想要更深入了解这一部分,建议去 ARM 官网看看其文档。
  本位主要的内容,来自于 IAR 的官方文档《IAR C/C++ Development Guide Compiling and Linking》,在翻译了部分功能的基础上添加了一些自己的理解!

启动流程

嵌入式应用程序的执行,分为三个阶段:

  • 初始化阶段
  • 执行阶段
  • 退出阶段

初始化阶段

  在系统启动期间,进入 main() 函数之前执行初始化序列。 初始化序列处理目标硬件和 C/C++ 运行环境所需的初始化。初始化是在应用程序(CPU 复位)启动但是进入用户的 main() 函数之前来执行的。初始化阶段可以简单地分为:

  • 硬件初始化,通常至少初始化堆栈指针。
      硬件初始化通常在系统启动代码 cstartup.s 中执行,如果需要,还可以通过用户提供的额外的低级接口(__low_level_init)来执行用户自己的代码。 它可能包括重置/启动其余硬件,设置 CPU 等,以准备软件 C/C++ 系统初始化。
    在这里插入图片描述

    • 当 CPU 复位时,程序将从系统启动代码中的程序入口标签__iar_program_start处开始执行。
    • 堆栈指针初始化为 CSTACK 块的末尾
    • For Arm7/9/11, Cortex-A, and Cortex-R devices, exception stack pointers are initialized to the end of each corresponding section. 对于 Arm7/9/11、Cortex-A 和Cortex-R 器件,异常堆栈指针初始化为每个相应部分的末尾
    • The function __low_level_init is called if you defined it, giving the application a chance to perform early initializations.如果用户定义了函数__low_level_init,则为应用程序提供执行早期初始化的机会。
  • C/C++ 软件系统初始化
      通常,此步操作确保在调用 main 函数之前,每个全局(静态链接)的 C/C++ 符号都会收到其正确的初始化值。
    在这里插入图片描述

    • Static and global variables are initialized. That is, zero-initialized variables are cleared and the values of other initialized variables are copied from ROM to RAM memory. This step is skipped if __low_level_init returns zero. 静态和全局变量初始化。 也就是说,清零初始化为零的变量,并将其他初始化变量的值从 ROM 复制到 RAM 存储器。 如果 __low_level_init 返回零,则跳过此步骤。
        In Standard C, all static variables—variables that are allocated at a fixed memory address—must be initialized by the runtime system to a known value at application startup. This value is either an explicit value assigned to the variable, or if no value is given, it is cleared to zero. In the compiler, there are exceptions to this rule, for example variables declared __no_init, which are not initialized at all.在标准 C 中,所有静态变量 - 在固定内存地址分配的变量 - 必须由运行时系统初始化为应用程序启动时的已知值。 此值是分配给变量的显式值,或者如果没有给出值,则将其清零。 在编译器中,此规则有例外,例如声明为 __no_init 的变量,它们根本没有初始化。
      The compiler generates a specific type of section for each type of variable initialization:编译器为每种类型的变量初始化生成特定类型的节:
      在这里插入图片描述
    • Static C++ objects are constructed 构造静态 C++ 对象
    • The main function is called, which starts the application. 调用主函数,启动应用程序。
  • 应用程序初始化
    觉就是用户自己的程序部分。这完全取决于用户的应用程序。 它可以包括设置 RTOS 内核并启动 RTOS 驱动的应用程序的初始任务。 对于裸机应用程序,它可以包括设置各种中断,初始化通信,初始化设备等。

  对于基于 ROM/flash 的系统,常量和函数已经放在 ROM 中。 放置在 RAM 中的所有符号必须在调用 main 函数之前初始化。 链接器已将可用RAM划分为变量,堆栈,堆等的不同区域。
  以下序列说明简要概述了初始化的不同阶段。

  1. 当应用程序启动时,系统启动代码首先执行硬件初始化,例如初始化栈顶指针以指向预定义堆栈区域的末尾:
    在这里插入图片描述
  2. 然后,清除应该零初始化的存储器,换句话说,用零填充:
    在这里插入图片描述
    通常,这些数据指的是那些初始化为零的数据; 例如,变量声明为int i = 0;
  3. 对于已经初始化的数据,例如,声明的数据int i = 6;,初始化器从ROM复制到RAM:
    在这里插入图片描述
  4. 最终,main()函数被调用:
    在这里插入图片描述

执行阶段

  The software of an embedded application is typically implemented as a loop which is either interrupt-driven or uses polling for controlling external interaction or internal events. For an interrupt-driven system, the interrupts are typically initialized at the beginning of the main function.嵌入式应用程序的软件通常实现为循环,该循环可以是中断驱动的,也可以使用轮询来控制外部交互或内部事件。 对于中断驱动的系统,中断通常在主函数的开头初始化。
  In a system with real-time behavior and where responsiveness is critical, a multi-task system might be required. This means that your application software should be complemented with a real-time operating system. In this case, the RTOS and the different tasks must also be initialized at the beginning of the main function. 在具有实时行为且响应性至关重要的系统中,可能需要多任务系统。 这意味着您的应用程序软件应该配备实时操作系统。 在这种情况下,还必须在main函数的开头初始化RTOS和不同的任务。

退出阶段

  通常,嵌入式应用程序的执行永远不会结束。 如果推出了,则必须定义正确的结束行为。
  要以受控方式终止应用程序,请调用标准C库函数之一 exit,_Exit,quick_exit 或 abort,或从main 返回。 如果从main 返回,则自动执行 exit 函数,这意味着调用静态和全局变量的 C++ 析构函数(仅限C ++)并关闭所有打开的文件。
  当然,如果程序逻辑不正确,应用程序可能会以不受控制的异常方式终止 - 系统崩溃。
在这里插入图片描述
应用程序可以通过两种不同方式正常终止:

  • Return from the main function
  • Call the exit function.

  因为 C 标准声明这两个方法应该是等价的,所以如果main()函数返回,系统启动代码会调用exit() 函数。传递给exit()函数的参数是main()的返回值。
默认退出函数用C语言编写。它调用一个小的汇编程序函数_exit,它将:

  • Call functions registered to be executed when the application ends. This includes C++ destructors for static and global variables, and functions registered with the standard function atexit. See also Setting up the atexit limit, page 110.
  • Close all open files
  • Call __exit
  • When __exit is reached, stop the system.

  应用程序也可以通过调用 abort,_Exit 或 quick_exit 函数退出。中止函数只是调用__exit来暂停系统,并且不执行任何类型的清理。The _Exit function is equivalent to the abort function, except for the fact that _Exit takes an argument for passing exit status information._Exit函数等同于 abort 函数,事实上,_Exit接受一个参数来传递退出状态信息。The quick_exit function is equivalent to the _Exit function, except that it calls each function passed to at_quick_exit before calling __exit. quick_exit函数等同于__Exit函数,只是它在调用__exit之前会刁艳红每个传递给_quick_exit的函数。
  如果您希望应用程序在退出时执行任何额外操作,例如重置系统(如果使用atexit是不够的),您可以编写自己的__exit(int)函数实现。

启动相关函数

  在基于 ARM 的启动流程中,我们介绍了各启动相关的函数全部位于 ARM 编译套件的库文件中。IAR 则直接提供了相关函数的源代码,源码使用汇编语言编写!
  处理启动和终止的代码位于源文件cstartup.scmain.scexit.s中,这些文件位于arm\src\lib\armarm\src\lib\thumb目录中(针对 Cortex-M的 thumb 指令)和位于arm\src\lib\runtime目录中的low_level_init.c。其中,arm\src\lib\arm下面的文件如下图所示:
在这里插入图片描述

关于 Thumb 指令的这里我们暂不说明

前面我们已经分析过,第一个需要调用的函数是__iar_program_start,该函数就位于cstartup.s这个文件中!

启动示例分析

下面我们以STM32F373CB片子为例,看看其在 IAR 中调试时的汇编代码。直接进调试模式,注意:需要将 设置 -> 调试器 -> Run to main 去掉,如下图:
在这里插入图片描述
然后 直接进入调试模式,首先看看终端向量表部分:
在这里插入图片描述
符合前面文章介绍的 Cortex-M/R内核的规定!接着我们看到的就是复位中断的服务函数

    0x8003558: 0x04000401     DC32      0x4000401 (67109889)
    0x800355c: 0x08000c77     DC32      USER_DLT645ReqAddr
    0x8003560: 0x00000000     DC32      0x0 (0)
    0x8003564: 0x04a01101     DC32      0x4a01101 (77598977)
    0x8003568: 0x08000ca1     DC32      USER_DLT645ReqUpGrade
    0x800356c: 0x00000000     DC32      0x0 (0)
        LDR     R0, =SystemInit
Reset_Handler:
    0x8003570: 0x4801         LDR.N     R0, [PC, #0x4]          ; SystemInit
        BLX     R0
    0x8003572: 0x4780         BLX       R0		; 这里跳转到 SystemInit 这是ST提供的
        LDR     R0, =__iar_program_start
    0x8003574: 0x4801         LDR.N     R0, [PC, #0x4]          ; __iar_program_start
        BX      R0
    0x8003576: 0x4700         BX        R0		; 这里跳转到 __iar_program_start
        SECTION .text:CODE:REORDER(1)
    0x8003578: 0x08003195     DC32      SystemInit
        SECTION .text:CODE:REORDER(1)
    0x800357c: 0x08003581     DC32      __iar_program_start
__iar_program_start:
    0x8003580: 0xf3af 0x8000  NOP.W
    0x8003584: 0xf3af 0x8000  NOP.W
    0x8003588: 0xf7ff 0xffc2  BL        ?main                   ; 0x8003510 重点就在这个函数,
    0x800358c: 0x11111111     DC32      0x11111111 (286331153)
    0x8003590: 0x00001111     DC32      0x1111 (4369)
    0x8003594: 0x90           DC8       144                     ; '.'
    0x8003595: 0x00           DC8       0                       ; '.'
    0x8003596: 0x00           DC8       0                       ; '.'
    0x8003597: 0x00           DC8       0                       ; '.'
        B NMI_Handler
    0x8003598: 0xf7ff 0xbf6a  B.W       NMI_Handler             ; 0x8003470
    ; 后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!

从上面的汇编代码可以看出,__iar_program_start 跳转到了一个叫做?main的符号处,代码如下:

    0x80034c8: 0xb510         PUSH      {R4, LR}
    0x80034ca: 0x4907         LDR.N     R1, [PC, #0x1c]         ; 0x8 (8)
    0x80034cc: 0x4479         ADD       R1, R1, PC
    0x80034ce: 0x3118         ADDS      R1, R1, #24             ; 0x18
    0x80034d0: 0x4c06         LDR.N     R4, [PC, #0x18]         ; 0x24 (36)
    0x80034d2: 0x447c         ADD       R4, R4, PC
    0x80034d4: 0x3416         ADDS      R4, R4, #22             ; 0x16
    0x80034d6: 0xe004         B.N       0x80034e2
    0x80034d8: 0x680a         LDR       R2, [R1]
    0x80034da: 0x1d08         ADDS      R0, R1, #4
    0x80034dc: 0x4411         ADD       R1, R1, R2
    0x80034de: 0x4788         BLX       R1
    0x80034e0: 0x4601         MOV       R1, R0
    0x80034e2: 0x42a1         CMP       R1, R4
    0x80034e4: 0xd1f8         BNE.N     0x80034d8
    0x80034e6: 0xbd10         POP       {R4, PC}
    0x80034e8: 0x00000008     DC32      0x8 (8)
    0x80034ec: 0x00000024     DC32      0x24 (36)
Region$$Table$$Base:
    0x80034f0: 0xffffdc57     DC32      0xffffdc57 (-9129)
    0x80034f4: 0x0000085c     DC32      0x85c (2140)
    0x80034f8: 0x20000588     DC32      Uart1Info
    0x80034fc: 0x00000000     DC32      0x0 (0)
    0x8003500: 0xffffdadf     DC32      0xffffdadf (-9505)
    0x8003504: 0x000001b8     DC32      0x1b8 (440)
    0x8003508: 0x0000010c     DC32      0x10c (268)
    0x800350c: 0x20000000     DC32      UpGradeCtrl
?main:
Region$$Table$$Limit:
__cmain:
    0x8003510: 0xf000 0xf80d  BL        __low_level_init        ; 0x800352e
    0x8003514: 0x2800         CMP       R0, #0
    0x8003516: 0xd001         BEQ.N     _call_main              ; 0x800351c
    0x8003518: 0xf7ff 0xffd6  BL        __iar_data_init3        ; 0x80034c8
_call_main:
    0x800351c: 0xf3af 0x8000  NOP.W
    0x8003520: 0x2000         MOVS      R0, #0
    0x8003522: 0xf3af 0x8000  NOP.W
    0x8003526: 0xf7ff 0xff2b  BL        main                    ; 0x8003380
_main:
    0x800352a: 0xf000 0xf802  BL        exit                    ; 0x8003532
__low_level_init:
    0x800352e: 0x2001         MOVS      R0, #1
    0x8003530: 0x4770         BX        LR
exit:
    0x8003532: 0xf000 0xb801  B.W       _exit                   ; 0x8003538
    0x8003536: 0x0000         MOVS      R0, R0
_exit:
    0x8003538: 0x4607         MOV       R7, R0
    0x800353a: 0x4638         MOV       R0, R7
    0x800353c: 0xf000 0xf802  BL        __exit                  ; 0x8003544
    0x8003540: 0xe7fb         B.N       0x800353a
    0x8003542: 0x0000         MOVS      R0, R0
__exit:
    0x8003544: 0xb580         PUSH      {R7, LR}
    0x8003546: 0xf3af 0x8000  NOP.W
    0x800354a: 0x4a02         LDR.N     R2, [PC, #0x8]          ; 0x20026 (131110)
    0x800354c: 0x0011         MOVS      R1, R2
    0x800354e: 0x2018         MOVS      R0, #24                 ; 0x18
    0x8003550: 0xbeab         BKPT      #0xab
    0x8003552: 0xe7fb         B.N       0x800354c
    0x8003554: 0x00020026     DC32      0x20026 (131110)
; 后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!后面的省略!

里面有详细的函数调用关系!

启动文件

目前,多数 MCU 厂商都提供一个启动文件。当然,编程者也可以自己编写启动文件,具体编写要求ARM的网站上都有相关文档进行说明。下面分析一下 STM32 启动文件startup_stm32f37x.s,具体看里面的注释。

;/******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
;* File Name          : startup_stm32f37x.s
;* Author             : MCD Application Team
;* Version            : V1.0.0
;* Date               : 20-September-2012
;* Description        : STM32F37x Devices vector table for EWARM toolchain.
;*                      This module performs:
;*                      - Set the initial SP
;*                      - Set the initial PC == iar_program_start,
;*                      - Set the vector table entries with the exceptions ISR 
;*                        address.
;*                      After Reset the Cortex-M4 processor is in Thread mode,
;*                      priority is Privileged, and the Stack is set to Main.
;*******************************************************************************
;  @attention
; 
;  Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
;  You may not use this file except in compliance with the License.
;  You may obtain a copy of the License at:
; 
;         http://www.st.com/software_license_agreement_liberty_v2
; 
;  Unless required by applicable law or agreed to in writing, software 
;  distributed under the License is distributed on an "AS IS" BASIS, 
;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;  See the License for the specific language governing permissions and
;  limitations under the License.
; 
;*******************************************************************************
;
;
; The modules in this file are included in the libraries, and may be replaced
; by any user-defined modules that define the PUBLIC symbol _program_start or
; a user defined start symbol.
; To override the cstartup defined in the library, simply add your modified
; version to the workbench project.
;
; The vector table is normally located at address 0.
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
; The name "__vector_table" has special meaning for C-SPY:
; it is where the SP start value is found, and the NVIC vector
; table register (VTOR) is initialized to this address if != 0.
;
; Cortex-M version
;

        MODULE  ?cstartup

        ;; Forward declaration of sections.
        SECTION CSTACK:DATA:NOROOT(3)

        SECTION .intvec:CODE:NOROOT(2)

        EXTERN  __iar_program_start
        EXTERN  SystemInit
        PUBLIC  __vector_table

        DATA
__vector_table
        DCD     sfe(CSTACK)
        DCD     Reset_Handler             ; Reset Handler

        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
        DCD     SVC_Handler               ; SVCall Handler
        DCD     DebugMon_Handler          ; Debug Monitor Handler
        DCD     0                         ; Reserved
        DCD     PendSV_Handler            ; PendSV Handler
        DCD     SysTick_Handler           ; SysTick Handler

       ; External Interrupts
        DCD     WWDG_IRQHandler                   ; Window WatchDog                                        
        DCD     PVD_IRQHandler                    ; PVD through EXTI Line detection                        
        DCD     TAMPER_STAMP_IRQHandler           ; Tamper and TimeStamps through the EXTI line            
        DCD     RTC_WKUP_IRQHandler               ; RTC Wakeup through the EXTI line                       
        DCD     FLASH_IRQHandler                  ; FLASH                                           
        DCD     RCC_IRQHandler                    ; RCC                                             
        DCD     EXTI0_IRQHandler                  ; EXTI Line0                                             
        DCD     EXTI1_IRQHandler                  ; EXTI Line1                                             
        DCD     EXTI2_TS_IRQHandler               ; EXTI Line2 and Touch Sense controller                                             
        DCD     EXTI3_IRQHandler                  ; EXTI Line3                                             
        DCD     EXTI4_IRQHandler                  ; EXTI Line4                                             
        DCD     DMA1_Channel1_IRQHandler          ; DMA1 Channel 1                                   
        DCD     DMA1_Channel2_IRQHandler          ; DMA1 Channel 2                                  
        DCD     DMA1_Channel3_IRQHandler          ; DMA1 Channel 3                                   
        DCD     DMA1_Channel4_IRQHandler          ; DMA1 Channel 4                                   
        DCD     DMA1_Channel5_IRQHandler          ; DMA1 Channel 5                                   
        DCD     DMA1_Channel6_IRQHandler          ; DMA1 Channel 6                                   
        DCD     DMA1_Channel7_IRQHandler          ; DMA1 Channel 7                                   
        DCD     ADC1_IRQHandler                   ; ADC1                            
        DCD     CAN1_TX_IRQHandler                ; CAN1 TX                                                
        DCD     CAN1_RX0_IRQHandler               ; CAN1 RX0                                               
        DCD     CAN1_RX1_IRQHandler               ; CAN1 RX1                                               
        DCD     CAN1_SCE_IRQHandler               ; CAN1 SCE                                               
        DCD     EXTI9_5_IRQHandler                ; External Line[9:5]s                                    
        DCD     TIM15_IRQHandler                  ; TIM15                   
        DCD     TIM16_IRQHandler                  ; TIM16                 
        DCD     TIM17_IRQHandler                  ; TIM17
        DCD     TIM18_DAC2_IRQHandler             ; TIM18 and DAC2                                   
        DCD     TIM2_IRQHandler                   ; TIM2                                            
        DCD     TIM3_IRQHandler                   ; TIM3                                            
        DCD     TIM4_IRQHandler                   ; TIM4                                            
        DCD     I2C1_EV_IRQHandler                ; I2C1 Event                                             
        DCD     I2C1_ER_IRQHandler                ; I2C1 Error                                             
        DCD     I2C2_EV_IRQHandler                ; I2C2 Event                                             
        DCD     I2C2_ER_IRQHandler                ; I2C2 Error                                               
        DCD     SPI1_IRQHandler                   ; SPI1                                            
        DCD     SPI2_IRQHandler                   ; SPI2                                            
        DCD     USART1_IRQHandler                 ; USART1                                          
        DCD     USART2_IRQHandler                 ; USART2                                          
        DCD     USART3_IRQHandler                 ; USART3                                          
        DCD     EXTI15_10_IRQHandler              ; External Line[15:10]s                                  
        DCD     RTC_Alarm_IRQHandler              ; RTC Alarm (A and B) through EXTI Line                  
        DCD     CEC_IRQHandler                    ; CEC                       
        DCD     TIM12_IRQHandler                  ; TIM12                  
        DCD     TIM13_IRQHandler                  ; TIM13                 
        DCD     TIM14_IRQHandler                  ; TIM14
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     TIM5_IRQHandler                   ; TIM5                                    
        DCD     SPI3_IRQHandler                   ; SPI3    
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved                                       
        DCD     TIM6_DAC1_IRQHandler              ; TIM6 and DAC1 Channel1 & channel2                                           
        DCD     TIM7_IRQHandler                   ; TIM7                                              
        DCD     DMA2_Channel1_IRQHandler          ; DMA2 Channel 1                                           
        DCD     DMA2_Channel2_IRQHandler          ; DMA2 Channel 2  
        DCD     DMA2_Channel3_IRQHandler          ; DMA2 Channel 3  
        DCD     DMA2_Channel4_IRQHandler          ; DMA2 Channel 4  
        DCD     DMA2_Channel5_IRQHandler          ; DMA2 Channel 5  
        DCD     SDADC1_IRQHandler                 ; SDADC1                                            
        DCD     SDADC2_IRQHandler                 ; SDADC2                                           
        DCD     SDADC3_IRQHandler                 ; SDADC3                                          
        DCD     COMP_IRQHandler                   ; COMP   
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved
        DCD     0                                 ; Reserved                
        DCD     USB_HP_IRQHandler                 ; USB High Priority                    
        DCD     USB_LP_IRQHandler                 ; USB Low Priority                                    
        DCD     USBWakeUp_IRQHandler               ; USB Wakeup   
        DCD     0                                 ; Reserved                                
        DCD     TIM19_IRQHandler                  ; TIM19
        DCD     0                                 ; Reserved     
        DCD     0                                 ; Reserved
        DCD     FPU_IRQHandler                    ; FPU     

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Default interrupt handlers.
;;
        THUMB
        PUBWEAK Reset_Handler
        SECTION .text:CODE:REORDER(2)
Reset_Handler

        LDR     R0, =SystemInit
        BLX     R0
        LDR     R0, =__iar_program_start
        BX      R0

        PUBWEAK NMI_Handler
        SECTION .text:CODE:REORDER(1)
NMI_Handler
        B NMI_Handler

        PUBWEAK HardFault_Handler
        SECTION .text:CODE:REORDER(1)
HardFault_Handler
        B HardFault_Handler

        PUBWEAK MemManage_Handler
        SECTION .text:CODE:REORDER(1)
MemManage_Handler
        B MemManage_Handler

        PUBWEAK BusFault_Handler
        SECTION .text:CODE:REORDER(1)
BusFault_Handler
        B BusFault_Handler

        PUBWEAK UsageFault_Handler
        SECTION .text:CODE:REORDER(1)
UsageFault_Handler
        B UsageFault_Handler

        PUBWEAK SVC_Handler
        SECTION .text:CODE:REORDER(1)
SVC_Handler
        B SVC_Handler

        PUBWEAK DebugMon_Handler
        SECTION .text:CODE:REORDER(1)
DebugMon_Handler
        B DebugMon_Handler

        PUBWEAK PendSV_Handler
        SECTION .text:CODE:REORDER(1)
PendSV_Handler
        B PendSV_Handler

        PUBWEAK SysTick_Handler
        SECTION .text:CODE:REORDER(1)
SysTick_Handler
        B SysTick_Handler

        PUBWEAK WWDG_IRQHandler
        SECTION .text:CODE:REORDER(1)
WWDG_IRQHandler  
        B WWDG_IRQHandler

        PUBWEAK PVD_IRQHandler
        SECTION .text:CODE:REORDER(1)
PVD_IRQHandler  
        B PVD_IRQHandler

        PUBWEAK TAMPER_STAMP_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TAMPER_STAMP_IRQHandler  
        B TAMPER_STAMP_IRQHandler

        PUBWEAK RTC_WKUP_IRQHandler
        SECTION .text:CODE:REORDER(1)  
RTC_WKUP_IRQHandler  
        B RTC_WKUP_IRQHandler

        PUBWEAK FLASH_IRQHandler
        SECTION .text:CODE:REORDER(1)
FLASH_IRQHandler  
        B FLASH_IRQHandler

        PUBWEAK RCC_IRQHandler
        SECTION .text:CODE:REORDER(1)
RCC_IRQHandler  
        B RCC_IRQHandler

        PUBWEAK EXTI0_IRQHandler
        SECTION .text:CODE:REORDER(1)
EXTI0_IRQHandler  
        B EXTI0_IRQHandler

        PUBWEAK EXTI1_IRQHandler
        SECTION .text:CODE:REORDER(1)
EXTI1_IRQHandler  
        B EXTI1_IRQHandler

        PUBWEAK EXTI2_TS_IRQHandler
        SECTION .text:CODE:REORDER(1)
EXTI2_TS_IRQHandler  
        B EXTI2_TS_IRQHandler

        PUBWEAK EXTI3_IRQHandler
        SECTION .text:CODE:REORDER(1)
EXTI3_IRQHandler
        B EXTI3_IRQHandler

        PUBWEAK EXTI4_IRQHandler
        SECTION .text:CODE:REORDER(1)    
EXTI4_IRQHandler  
        B EXTI4_IRQHandler

        PUBWEAK DMA1_Channel1_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel1_IRQHandler  
        B DMA1_Channel1_IRQHandler

        PUBWEAK DMA1_Channel2_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel2_IRQHandler  
        B DMA1_Channel2_IRQHandler

        PUBWEAK DMA1_Channel3_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel3_IRQHandler  
        B DMA1_Channel3_IRQHandler

        PUBWEAK DMA1_Channel4_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel4_IRQHandler  
        B DMA1_Channel4_IRQHandler

        PUBWEAK DMA1_Channel5_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel5_IRQHandler  
        B DMA1_Channel5_IRQHandler

        PUBWEAK DMA1_Channel6_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel6_IRQHandler  
        B DMA1_Channel6_IRQHandler

        PUBWEAK DMA1_Channel7_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA1_Channel7_IRQHandler  
        B DMA1_Channel7_IRQHandler

        PUBWEAK ADC1_IRQHandler
        SECTION .text:CODE:REORDER(1)
ADC1_IRQHandler  
        B ADC1_IRQHandler

        PUBWEAK CAN1_TX_IRQHandler
        SECTION .text:CODE:REORDER(1) 
CAN1_TX_IRQHandler  
        B CAN1_TX_IRQHandler

        PUBWEAK CAN1_RX0_IRQHandler
        SECTION .text:CODE:REORDER(1)  
CAN1_RX0_IRQHandler  
        B CAN1_RX0_IRQHandler

        PUBWEAK CAN1_RX1_IRQHandler
        SECTION .text:CODE:REORDER(1)  
CAN1_RX1_IRQHandler  
        B CAN1_RX1_IRQHandler

        PUBWEAK CAN1_SCE_IRQHandler
        SECTION .text:CODE:REORDER(1)  
CAN1_SCE_IRQHandler  
        B CAN1_SCE_IRQHandler

        PUBWEAK EXTI9_5_IRQHandler
        SECTION .text:CODE:REORDER(1) 
EXTI9_5_IRQHandler  
        B EXTI9_5_IRQHandler

        PUBWEAK TIM15_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM15_IRQHandler  
        B TIM15_IRQHandler

        PUBWEAK TIM16_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM16_IRQHandler  
        B TIM16_IRQHandler

        PUBWEAK TIM17_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM17_IRQHandler  
        B TIM17_IRQHandler
        
        PUBWEAK TIM18_DAC2_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM18_DAC2_IRQHandler  
        B TIM18_DAC2_IRQHandler

        PUBWEAK TIM2_IRQHandler
        SECTION .text:CODE:REORDER(1)
TIM2_IRQHandler  
        B TIM2_IRQHandler

        PUBWEAK TIM3_IRQHandler
        SECTION .text:CODE:REORDER(1)
TIM3_IRQHandler  
        B TIM3_IRQHandler

        PUBWEAK TIM4_IRQHandler
        SECTION .text:CODE:REORDER(1)
TIM4_IRQHandler  
        B TIM4_IRQHandler

        PUBWEAK I2C1_EV_IRQHandler
        SECTION .text:CODE:REORDER(1) 
I2C1_EV_IRQHandler  
        B I2C1_EV_IRQHandler

        PUBWEAK I2C1_ER_IRQHandler
        SECTION .text:CODE:REORDER(1) 
I2C1_ER_IRQHandler  
        B I2C1_ER_IRQHandler

        PUBWEAK I2C2_EV_IRQHandler
        SECTION .text:CODE:REORDER(1) 
I2C2_EV_IRQHandler  
        B I2C2_EV_IRQHandler

        PUBWEAK I2C2_ER_IRQHandler
        SECTION .text:CODE:REORDER(1) 
I2C2_ER_IRQHandler  
        B I2C2_ER_IRQHandler

        PUBWEAK SPI1_IRQHandler
        SECTION .text:CODE:REORDER(1)
SPI1_IRQHandler  
        B SPI1_IRQHandler

        PUBWEAK SPI2_IRQHandler
        SECTION .text:CODE:REORDER(1)
SPI2_IRQHandler  
        B SPI2_IRQHandler

        PUBWEAK USART1_IRQHandler
        SECTION .text:CODE:REORDER(1)
USART1_IRQHandler  
        B USART1_IRQHandler

        PUBWEAK USART2_IRQHandler
        SECTION .text:CODE:REORDER(1)
USART2_IRQHandler  
        B USART2_IRQHandler

        PUBWEAK USART3_IRQHandler
        SECTION .text:CODE:REORDER(1)
USART3_IRQHandler  
        B USART3_IRQHandler

        PUBWEAK EXTI15_10_IRQHandler
        SECTION .text:CODE:REORDER(1)   
EXTI15_10_IRQHandler  
        B EXTI15_10_IRQHandler

        PUBWEAK RTC_Alarm_IRQHandler
        SECTION .text:CODE:REORDER(1)   
RTC_Alarm_IRQHandler  
        B RTC_Alarm_IRQHandler

        PUBWEAK CEC_IRQHandler
        SECTION .text:CODE:REORDER(1)    
CEC_IRQHandler  
        B CEC_IRQHandler
      
        PUBWEAK TIM12_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM12_IRQHandler  
        B TIM12_IRQHandler

        PUBWEAK TIM13_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM13_IRQHandler  
        B TIM13_IRQHandler

        PUBWEAK TIM14_IRQHandler
        SECTION .text:CODE:REORDER(1)    
TIM14_IRQHandler  
        B TIM14_IRQHandler

        PUBWEAK TIM5_IRQHandler
        SECTION .text:CODE:REORDER(1) 
TIM5_IRQHandler  
        B TIM5_IRQHandler

        PUBWEAK SPI3_IRQHandler
        SECTION .text:CODE:REORDER(1)
SPI3_IRQHandler  
        B SPI3_IRQHandler

        PUBWEAK TIM6_DAC1_IRQHandler
        SECTION .text:CODE:REORDER(1)   
TIM6_DAC1_IRQHandler  
        B TIM6_DAC1_IRQHandler

        PUBWEAK TIM7_IRQHandler
        SECTION .text:CODE:REORDER(1)   
TIM7_IRQHandler  
        B TIM7_IRQHandler

        PUBWEAK DMA2_Channel1_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA2_Channel1_IRQHandler  
        B DMA2_Channel1_IRQHandler

        PUBWEAK DMA2_Channel2_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA2_Channel2_IRQHandler  
        B DMA2_Channel2_IRQHandler

        PUBWEAK DMA2_Channel3_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA2_Channel3_IRQHandler  
        B DMA2_Channel3_IRQHandler

        PUBWEAK DMA2_Channel4_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA2_Channel4_IRQHandler  
        B DMA2_Channel4_IRQHandler

        PUBWEAK DMA2_Channel5_IRQHandler
        SECTION .text:CODE:REORDER(1)    
DMA2_Channel5_IRQHandler  
        B DMA2_Channel5_IRQHandler

        PUBWEAK SDADC1_IRQHandler
        SECTION .text:CODE:REORDER(1)
SDADC1_IRQHandler  
        B SDADC1_IRQHandler

        PUBWEAK SDADC2_IRQHandler
        SECTION .text:CODE:REORDER(1)  
SDADC2_IRQHandler  
        B SDADC2_IRQHandler

        PUBWEAK SDADC3_IRQHandler
        SECTION .text:CODE:REORDER(1) 
SDADC3_IRQHandler  
        B SDADC3_IRQHandler

        PUBWEAK COMP_IRQHandler
        SECTION .text:CODE:REORDER(1)  
COMP_IRQHandler  
        B COMP_IRQHandler

        PUBWEAK USB_HP_IRQHandler
        SECTION .text:CODE:REORDER(1)
USB_HP_IRQHandler  
        B USB_HP_IRQHandler

        PUBWEAK USB_LP_IRQHandler
        SECTION .text:CODE:REORDER(1)
USB_LP_IRQHandler  
        B USB_LP_IRQHandler

        PUBWEAK USBWakeUp_IRQHandler
        SECTION .text:CODE:REORDER(1)
USBWakeUp_IRQHandler  
        B USBWakeUp_IRQHandler

        PUBWEAK TIM19_IRQHandler
        SECTION .text:CODE:REORDER(1)  
TIM19_IRQHandler  
        B TIM19_IRQHandler

        PUBWEAK FPU_IRQHandler
        SECTION .text:CODE:REORDER(1)  
FPU_IRQHandler  
        B FPU_IRQHandler
        
        END
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ZCShouEXP CSDN认证博客专家 砖家 码字员 没了
进步始于交流,收获源于分享!进步始于交流,收获源于分享!进步始于交流,收获源于分享!进步始于交流,收获源于分享!进步始于交流,收获源于分享!
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页