0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

基于IAR的Cortex-M/R内核程序启动流程

技术让梦想更伟大 来源:CSDN 2023-02-14 16:57 次阅读

无论是 ARMCC 还是 IAR 都需要遵循内核的规定。区别主要在于初始化的个函数接口不同!

启动流程

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

初始化阶段

执行阶段

退出阶段

初始化阶段

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

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

14c3d074-ac42-11ed-bfe3-dac502259ad0.jpg

当 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++ 符号都会收到其正确的初始化值。

14d368ae-ac42-11ed-bfe3-dac502259ad0.jpg

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:编译器为每种类型的变量初始化生成特定类型的节:

14e230c8-ac42-11ed-bfe3-dac502259ad0.png

Static C++ objects are constructed 构造静态 C++ 对象

The main function is called, which starts the application. 调用主函数,启动应用程序。

应用程序初始化觉就是用户自己的程序部分。这完全取决于用户的应用程序。 它可以包括设置 RTOS 内核并启动 RTOS 驱动的应用程序的初始任务。 对于裸机应用程序,它可以包括设置各种中断,初始化通信,初始化设备等。

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

以下序列说明简要概述了初始化的不同阶段。

当应用程序启动时,系统启动代码首先执行硬件初始化,例如初始化栈顶指针以指向预定义堆栈区域的末尾:

14f36d16-ac42-11ed-bfe3-dac502259ad0.jpg

然后,清除应该零初始化的存储器,换句话说,用零填充:

1513b0da-ac42-11ed-bfe3-dac502259ad0.jpg

通常,这些数据指的是那些初始化为零的数据; 例如,变量声明为int i = 0;

对于已经初始化的数据,例如,声明的数据int i = 6;,初始化器从ROM复制到RAM:

1524b696-ac42-11ed-bfe3-dac502259ad0.jpg

最终,main()函数被调用:

1534c6bc-ac42-11ed-bfe3-dac502259ad0.jpg

执行阶段

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 ++)并关闭所有打开的文件。

当然,如果程序逻辑不正确,应用程序可能会以不受控制的异常方式终止 - 系统崩溃。

154bed06-ac42-11ed-bfe3-dac502259ad0.jpg

应用程序可以通过两种不同方式正常终止:

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.s,cmain.s,cexit.s中,这些文件位于armsrclibarm 或 armsrclib humb目录中(针对 Cortex-M的 thumb 指令)和位于armsrclib untime目录中的low_level_init.c。其中,armsrclibarm下面的文件如下图所示:

155f7df8-ac42-11ed-bfe3-dac502259ad0.png

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

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

启动示例分析

下面我们以STM32F373CB片子为例,看看其在 IAR 中调试时的汇编代码。

直接进调试模式,注意:需要将 设置 -> 调试器 -> Run to main 去掉,如下图:

15759a70-ac42-11ed-bfe3-dac502259ad0.png

然后 直接进入调试模式,首先看看终端向量表部分:

158b5e3c-ac42-11ed-bfe3-dac502259ad0.png

符合前面文章介绍的 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 CSTACKNOROOT(3)

    SECTION .intvecNOROOT(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 .textREORDER(2)
Reset_Handler

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

    PUBWEAK NMI_Handler
    SECTION .textREORDER(1)
NMI_Handler
    B NMI_Handler

    PUBWEAK HardFault_Handler
    SECTION .textREORDER(1)
HardFault_Handler
    B HardFault_Handler

    PUBWEAK MemManage_Handler
    SECTION .textREORDER(1)
MemManage_Handler
    B MemManage_Handler

    PUBWEAK BusFault_Handler
    SECTION .textREORDER(1)
BusFault_Handler
    B BusFault_Handler

    PUBWEAK UsageFault_Handler
    SECTION .textREORDER(1)
UsageFault_Handler
    B UsageFault_Handler

    PUBWEAK SVC_Handler
    SECTION .textREORDER(1)
SVC_Handler
    B SVC_Handler

    PUBWEAK DebugMon_Handler
    SECTION .textREORDER(1)
DebugMon_Handler
    B DebugMon_Handler

    PUBWEAK PendSV_Handler
    SECTION .textREORDER(1)
PendSV_Handler
    B PendSV_Handler

    PUBWEAK SysTick_Handler
    SECTION .textREORDER(1)
SysTick_Handler
    B SysTick_Handler

    PUBWEAK WWDG_IRQHandler
    SECTION .textREORDER(1)
WWDG_IRQHandler 
    B WWDG_IRQHandler

    PUBWEAK PVD_IRQHandler
    SECTION .textREORDER(1)
PVD_IRQHandler 
    B PVD_IRQHandler

    PUBWEAK TAMPER_STAMP_IRQHandler
    SECTION .textREORDER(1)  
TAMPER_STAMP_IRQHandler 
    B TAMPER_STAMP_IRQHandler

    PUBWEAK RTC_WKUP_IRQHandler
    SECTION .textREORDER(1) 
RTC_WKUP_IRQHandler 
    B RTC_WKUP_IRQHandler

    PUBWEAK FLASH_IRQHandler
    SECTION .textREORDER(1)
FLASH_IRQHandler 
    B FLASH_IRQHandler

    PUBWEAK RCC_IRQHandler
    SECTION .textREORDER(1)
RCC_IRQHandler 
    B RCC_IRQHandler

    PUBWEAK EXTI0_IRQHandler
    SECTION .textREORDER(1)
EXTI0_IRQHandler 
    B EXTI0_IRQHandler

    PUBWEAK EXTI1_IRQHandler
    SECTION .textREORDER(1)
EXTI1_IRQHandler 
    B EXTI1_IRQHandler

    PUBWEAK EXTI2_TS_IRQHandler
    SECTION .textREORDER(1)
EXTI2_TS_IRQHandler 
    B EXTI2_TS_IRQHandler

    PUBWEAK EXTI3_IRQHandler
    SECTION .textREORDER(1)
EXTI3_IRQHandler
    B EXTI3_IRQHandler

    PUBWEAK EXTI4_IRQHandler
    SECTION .textREORDER(1)  
EXTI4_IRQHandler 
    B EXTI4_IRQHandler

    PUBWEAK DMA1_Channel1_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel1_IRQHandler 
    B DMA1_Channel1_IRQHandler

    PUBWEAK DMA1_Channel2_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel2_IRQHandler 
    B DMA1_Channel2_IRQHandler

    PUBWEAK DMA1_Channel3_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel3_IRQHandler 
    B DMA1_Channel3_IRQHandler

    PUBWEAK DMA1_Channel4_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel4_IRQHandler 
    B DMA1_Channel4_IRQHandler

    PUBWEAK DMA1_Channel5_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel5_IRQHandler 
    B DMA1_Channel5_IRQHandler

    PUBWEAK DMA1_Channel6_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel6_IRQHandler 
    B DMA1_Channel6_IRQHandler

    PUBWEAK DMA1_Channel7_IRQHandler
    SECTION .textREORDER(1)  
DMA1_Channel7_IRQHandler 
    B DMA1_Channel7_IRQHandler

    PUBWEAK ADC1_IRQHandler
    SECTION .textREORDER(1)
ADC1_IRQHandler 
    B ADC1_IRQHandler

    PUBWEAK CAN1_TX_IRQHandler
    SECTION .textREORDER(1) 
CAN1_TX_IRQHandler 
    B CAN1_TX_IRQHandler

    PUBWEAK CAN1_RX0_IRQHandler
    SECTION .textREORDER(1) 
CAN1_RX0_IRQHandler 
    B CAN1_RX0_IRQHandler

    PUBWEAK CAN1_RX1_IRQHandler
    SECTION .textREORDER(1) 
CAN1_RX1_IRQHandler 
    B CAN1_RX1_IRQHandler

    PUBWEAK CAN1_SCE_IRQHandler
    SECTION .textREORDER(1) 
CAN1_SCE_IRQHandler 
    B CAN1_SCE_IRQHandler

    PUBWEAK EXTI9_5_IRQHandler
    SECTION .textREORDER(1) 
EXTI9_5_IRQHandler 
    B EXTI9_5_IRQHandler

    PUBWEAK TIM15_IRQHandler
    SECTION .textREORDER(1)  
TIM15_IRQHandler 
    B TIM15_IRQHandler

    PUBWEAK TIM16_IRQHandler
    SECTION .textREORDER(1)  
TIM16_IRQHandler 
    B TIM16_IRQHandler

    PUBWEAK TIM17_IRQHandler
    SECTION .textREORDER(1)  
TIM17_IRQHandler 
    B TIM17_IRQHandler
    
    PUBWEAK TIM18_DAC2_IRQHandler
    SECTION .textREORDER(1)  
TIM18_DAC2_IRQHandler 
    B TIM18_DAC2_IRQHandler

    PUBWEAK TIM2_IRQHandler
    SECTION .textREORDER(1)
TIM2_IRQHandler 
    B TIM2_IRQHandler

    PUBWEAK TIM3_IRQHandler
    SECTION .textREORDER(1)
TIM3_IRQHandler 
    B TIM3_IRQHandler

    PUBWEAK TIM4_IRQHandler
    SECTION .textREORDER(1)
TIM4_IRQHandler 
    B TIM4_IRQHandler

    PUBWEAK I2C1_EV_IRQHandler
    SECTION .textREORDER(1) 
I2C1_EV_IRQHandler 
    B I2C1_EV_IRQHandler

    PUBWEAK I2C1_ER_IRQHandler
    SECTION .textREORDER(1) 
I2C1_ER_IRQHandler 
    B I2C1_ER_IRQHandler

    PUBWEAK I2C2_EV_IRQHandler
    SECTION .textREORDER(1) 
I2C2_EV_IRQHandler 
    B I2C2_EV_IRQHandler

    PUBWEAK I2C2_ER_IRQHandler
    SECTION .textREORDER(1) 
I2C2_ER_IRQHandler 
    B I2C2_ER_IRQHandler

    PUBWEAK SPI1_IRQHandler
    SECTION .textREORDER(1)
SPI1_IRQHandler 
    B SPI1_IRQHandler

    PUBWEAK SPI2_IRQHandler
    SECTION .textREORDER(1)
SPI2_IRQHandler 
    B SPI2_IRQHandler

    PUBWEAK USART1_IRQHandler
    SECTION .textREORDER(1)
USART1_IRQHandler 
    B USART1_IRQHandler

    PUBWEAK USART2_IRQHandler
    SECTION .textREORDER(1)
USART2_IRQHandler 
    B USART2_IRQHandler

    PUBWEAK USART3_IRQHandler
    SECTION .textREORDER(1)
USART3_IRQHandler 
    B USART3_IRQHandler

    PUBWEAK EXTI15_10_IRQHandler
    SECTION .textREORDER(1)  
EXTI15_10_IRQHandler 
    B EXTI15_10_IRQHandler

    PUBWEAK RTC_Alarm_IRQHandler
    SECTION .textREORDER(1)  
RTC_Alarm_IRQHandler 
    B RTC_Alarm_IRQHandler

    PUBWEAK CEC_IRQHandler
    SECTION .textREORDER(1)  
CEC_IRQHandler 
    B CEC_IRQHandler
   
    PUBWEAK TIM12_IRQHandler
    SECTION .textREORDER(1)  
TIM12_IRQHandler 
    B TIM12_IRQHandler

    PUBWEAK TIM13_IRQHandler
    SECTION .textREORDER(1)  
TIM13_IRQHandler 
    B TIM13_IRQHandler

    PUBWEAK TIM14_IRQHandler
    SECTION .textREORDER(1)  
TIM14_IRQHandler 
    B TIM14_IRQHandler

    PUBWEAK TIM5_IRQHandler
    SECTION .textREORDER(1) 
TIM5_IRQHandler 
    B TIM5_IRQHandler

    PUBWEAK SPI3_IRQHandler
    SECTION .textREORDER(1)
SPI3_IRQHandler 
    B SPI3_IRQHandler

    PUBWEAK TIM6_DAC1_IRQHandler
    SECTION .textREORDER(1)  
TIM6_DAC1_IRQHandler 
    B TIM6_DAC1_IRQHandler

    PUBWEAK TIM7_IRQHandler
    SECTION .textREORDER(1)  
TIM7_IRQHandler 
    B TIM7_IRQHandler

    PUBWEAK DMA2_Channel1_IRQHandler
    SECTION .textREORDER(1)  
DMA2_Channel1_IRQHandler 
    B DMA2_Channel1_IRQHandler

    PUBWEAK DMA2_Channel2_IRQHandler
    SECTION .textREORDER(1)  
DMA2_Channel2_IRQHandler 
    B DMA2_Channel2_IRQHandler

    PUBWEAK DMA2_Channel3_IRQHandler
    SECTION .textREORDER(1)  
DMA2_Channel3_IRQHandler 
    B DMA2_Channel3_IRQHandler

    PUBWEAK DMA2_Channel4_IRQHandler
    SECTION .textREORDER(1)  
DMA2_Channel4_IRQHandler 
    B DMA2_Channel4_IRQHandler

    PUBWEAK DMA2_Channel5_IRQHandler
    SECTION .textREORDER(1)  
DMA2_Channel5_IRQHandler 
    B DMA2_Channel5_IRQHandler

    PUBWEAK SDADC1_IRQHandler
    SECTION .textREORDER(1)
SDADC1_IRQHandler 
    B SDADC1_IRQHandler

    PUBWEAK SDADC2_IRQHandler
    SECTION .textREORDER(1) 
SDADC2_IRQHandler 
    B SDADC2_IRQHandler

    PUBWEAK SDADC3_IRQHandler
    SECTION .textREORDER(1) 
SDADC3_IRQHandler 
    B SDADC3_IRQHandler

    PUBWEAK COMP_IRQHandler
    SECTION .textREORDER(1) 
COMP_IRQHandler 
    B COMP_IRQHandler

    PUBWEAK USB_HP_IRQHandler
    SECTION .textREORDER(1)
USB_HP_IRQHandler 
    B USB_HP_IRQHandler

    PUBWEAK USB_LP_IRQHandler
    SECTION .textREORDER(1)
USB_LP_IRQHandler 
    B USB_LP_IRQHandler

    PUBWEAK USBWakeUp_IRQHandler
    SECTION .textREORDER(1)
USBWakeUp_IRQHandler 
    B USBWakeUp_IRQHandler

    PUBWEAK TIM19_IRQHandler
    SECTION .textREORDER(1) 
TIM19_IRQHandler 
    B TIM19_IRQHandler

    PUBWEAK FPU_IRQHandler
    SECTION .textREORDER(1) 
FPU_IRQHandler 
    B FPU_IRQHandler
    
    END
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****





审核编辑:刘清

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 存储器
    +关注

    关注

    38

    文章

    7447

    浏览量

    163581
  • RAM
    RAM
    +关注

    关注

    8

    文章

    1367

    浏览量

    114517
  • IAR
    IAR
    +关注

    关注

    5

    文章

    344

    浏览量

    36616
  • Cortex-M
    +关注

    关注

    2

    文章

    227

    浏览量

    29722
  • Cortex-R
    +关注

    关注

    0

    文章

    5

    浏览量

    5974

原文标题:Cortex-M/R 内核启动过程 / 程序启动流程(基于IAR)

文章出处:【微信号:技术让梦想更伟大,微信公众号:技术让梦想更伟大】欢迎添加关注!文章转载请注明出处。

收藏 人收藏

    评论

    相关推荐

    Cortex-M内核使用FreeRTOS特别注意事项

    本文来自CSDN博客FreeRTOS基础篇,本篇主要分享Cortex-M内核使用FreeRTOS特别注意事项。
    发表于 09-19 15:01 706次阅读
    <b class='flag-5'>Cortex-M</b><b class='flag-5'>内核</b>使用FreeRTOS特别注意事项

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

    表部分:符合前面文章介绍的 Cortex-M/R内核的规定!接着我们看到的就是复位中断的服务函数 0x8003558: 0x04000401DC320x4000401 (67109889
    发表于 05-17 19:31

    IAR系统启动流程及修改方法

    版本的_low_level_init程序。 对于Cortex M内核,系统启动代码是保存在arm\src\lib文件夹下的cstartup_
    发表于 08-06 13:57

    Cortex-M内核的GCC编译器

    下载ARM官方对应Cortex-M内核的GCC编译器
    发表于 08-24 06:44

    请问cortex-M4与cortex-A7内核启动流程是怎样的?

    请问cortex-M4与cortex-A7内核启动流程是怎样的?
    发表于 11-30 07:22

    ARM Cortex-M内核的相关资料推荐

      大家好,我是痞子衡,是正经搞技术的痞子。今天痞子衡给大家介绍的是ARM Cortex-M功能模块,不过侧重点是三款安全特性处理器。  ARM Cortex-M处理器家族发展至今(2020),已有
    发表于 12-27 07:21

    如何使用Ozone分析Cortex-M故障?

    的软件错误。本文将介绍如何使用Ozone的调试功能,深入了解这些类型的错误。分析故障工作流程我们首先在一个示例的基础上演示Ozone 的分析故障工作流程。示例应用程序可以生成不同类型的 Cor
    发表于 09-23 11:26

    关于STM32和Cortex-M内核系列介绍(1)

    Cortex-M内核系列和STM32-讲座
    的头像 发表于 07-05 01:07 8001次阅读

    关于STM32与Cortex-M内核系列的介绍(2)

    Cortex-M内核系列和STM32-讲座3
    的头像 发表于 07-05 00:45 4499次阅读

    Cortex-M内核的MPU内存保护单元

    讲讲Cortex-M内核的MPU内存保护单元
    的头像 发表于 03-04 11:17 3608次阅读
    <b class='flag-5'>Cortex-M</b><b class='flag-5'>内核</b>的MPU内存保护单元

    cortex-M4与cortex-A7内核启动流程分析

    本文简要介绍了ARM的cortex-M4以及A7内核的bootloader启动流程,大同小异。
    发表于 12-01 11:51 15次下载
    <b class='flag-5'>cortex-M</b>4与<b class='flag-5'>cortex</b>-A7<b class='flag-5'>内核</b><b class='flag-5'>启动</b><b class='flag-5'>流程</b>分析

    分析ARM Cortex-M内核复位启动过程

    ARM Cortex-M内核的复位启动过程也被称为复位序列(Reset sequence),下面就来简要总结分析下这一过程。
    的头像 发表于 03-20 09:58 2256次阅读

    基于32位Arm Cortex-M内核N32系列MCU应用

    国民技术N32系列MCU产品基于32位Arm Cortex-M内核,内置嵌入式高速闪存、低功耗电源管理,集成数模混合电路,并内置硬件密码算法加速引擎以及安全单元。
    发表于 03-28 11:35 840次阅读

    Cortex-M 内核中断/异常系统、中断优先级/嵌套 详解

    Cortex-M 内核中断/异常系统、中断优先级/嵌套 详解
    的头像 发表于 09-27 15:29 1995次阅读
    <b class='flag-5'>Cortex-M</b> <b class='flag-5'>内核</b>中断/异常系统、中断优先级/嵌套 详解

    瑞萨Cortex-M内核RA MCU的RT-Thread BSP制作教程发布

    瑞萨Cortex-M内核RA MCU的RT-Thread BSP制作教程发布
    的头像 发表于 09-18 10:58 682次阅读
    瑞萨<b class='flag-5'>Cortex-M</b><b class='flag-5'>内核</b>RA MCU的RT-Thread BSP制作教程发布