您的位置:首页 > 科技 > 能源 > 网站优化公司哪家效果好_b2b建设网站公司_营销推广计划怎么写_中国国家培训网是真的吗

网站优化公司哪家效果好_b2b建设网站公司_营销推广计划怎么写_中国国家培训网是真的吗

2024/12/24 2:20:48 来源:https://blog.csdn.net/weixin_45791458/article/details/142907328  浏览:    关键词:网站优化公司哪家效果好_b2b建设网站公司_营销推广计划怎么写_中国国家培训网是真的吗
网站优化公司哪家效果好_b2b建设网站公司_营销推广计划怎么写_中国国家培训网是真的吗

相关阅读

嵌入式icon-default.png?t=O83Ahttps://blog.csdn.net/weixin_45791458/category_12768532.html?spm=1001.2014.3001.5482


        启动文件(Startup File)是嵌入式系统开发中的核心组件之一,它用于初始化系统并为主程序的运行做好准备。在大多数情况下,启动文件是用汇编语言编写的,并且与具体的处理器架构和工具链紧密相关。本文将以startup_stm32f103xe.s文件为例,说明启动文件中做了什么。

1、文件说明

;******************** (C) COPYRIGHT 2017 STMicroelectronics ********************
;* File Name          : startup_stm32f103xe.s
;* Author             : MCD Application Team
;* Description        : STM32F103xE 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
;*                      - Branches to __main in the C library (which eventually
;*                        calls main()).
;*                      After Reset the Cortex-M3 processor is in Thread mode,
;*                      priority is Privileged, and the Stack is set to Main.
;******************************************************************************
;* @attention
;*
;* Copyright (c) 2017 STMicroelectronics.
;* All rights reserved.
;*
;* This software component is licensed by ST under BSD 3-Clause license,
;* the "License"; You may not use this file except in compliance with the
;* License. You may obtain a copy of the License at:
;*                        opensource.org/licenses/BSD-3-Clause
;*
;******************************************************************************

        根据注释说明,该启动文件用于MDK-ARM工具链,完成以下任务:

  • 设置初始堆栈指针(SP)。
  • 设置初始程序计数器(PC),指向Reset_Handler。
  • 初始化向量表,指定中断和异常处理函数的入口地址。
  • 配置系统时钟。
  • 跳转到 C 库的__main,最终调用用户定义的main()。

        在复位后,Cortex-M3处理器处于线程模式(Thread Mode)、特权级(Privileged),使用主堆栈(Main Stack)。

2、栈开辟

; 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     0x00000400AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp

        首先定义了一个名为Stack_Size的常量1024,它表示栈的大小,根据上方的Configuration提示,栈大小按照8字节对齐。

        随后定义了一块名为STACK的内存区域,该区域不需要初始化,可读可写且起始地址按照2^3=8字节对齐。

        接着定义了一个名为Stack_Mem的内存块,其大小为Stack_Size,即1024。

        最后定义标号__initial_sp,代表栈的顶部(栈是从高地址向低地址生长的),该标号表示的地址也是堆栈寄存器(SP)的初始值。

3、堆开辟

; <h> Heap Configuration
;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>Heap_Size       EQU     0x00000200AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem        SPACE   Heap_Size
__heap_limit

        首先定义了一个名为Heap_Size的常量512,它表示堆的大小,根据上方的Configuration提示,堆大小按照8字节对齐。 

        随后定义了一块名为HEAP的内存区域,该区域不需要初始化,可读可写且起始地址按照2^3=8字节对齐。

        接着定义标号__heap_base,表示堆的起始地址。

        然后定义了一个名为Heap_Mem的内存块,其大小为Heap_Size,即512。

        最后定义标号__heap_limit,表示堆的结束地址。

4、指针对齐和指令集说明

                PRESERVE8THUMB

        PRESERVE8设置了PRES8构建属性,表示栈指针(SP)保持8字节对齐。THUMB表示接下来的指令是THUMB指令。

5、向量表定义

; Vector Table Mapped to Address 0 at ResetAREA    RESET, DATA, READONLYEXPORT  __VectorsEXPORT  __Vectors_EndEXPORT  __Vectors_Size__Vectors       DCD     __initial_sp               ; Top of StackDCD     Reset_Handler              ; Reset HandlerDCD     NMI_Handler                ; NMI HandlerDCD     HardFault_Handler          ; Hard Fault HandlerDCD     MemManage_Handler          ; MPU Fault HandlerDCD     BusFault_Handler           ; Bus Fault HandlerDCD     UsageFault_Handler         ; Usage Fault HandlerDCD     0                          ; ReservedDCD     0                          ; ReservedDCD     0                          ; ReservedDCD     0                          ; ReservedDCD     SVC_Handler                ; SVCall HandlerDCD     DebugMon_Handler           ; Debug Monitor HandlerDCD     0                          ; ReservedDCD     PendSV_Handler             ; PendSV HandlerDCD     SysTick_Handler            ; SysTick Handler; External InterruptsDCD     WWDG_IRQHandler            ; Window WatchdogDCD     PVD_IRQHandler             ; PVD through EXTI Line detectDCD     TAMPER_IRQHandler          ; TamperDCD     RTC_IRQHandler             ; RTCDCD     FLASH_IRQHandler           ; FlashDCD     RCC_IRQHandler             ; RCCDCD     EXTI0_IRQHandler           ; EXTI Line 0DCD     EXTI1_IRQHandler           ; EXTI Line 1DCD     EXTI2_IRQHandler           ; EXTI Line 2DCD     EXTI3_IRQHandler           ; EXTI Line 3DCD     EXTI4_IRQHandler           ; EXTI Line 4DCD     DMA1_Channel1_IRQHandler   ; DMA1 Channel 1DCD     DMA1_Channel2_IRQHandler   ; DMA1 Channel 2DCD     DMA1_Channel3_IRQHandler   ; DMA1 Channel 3DCD     DMA1_Channel4_IRQHandler   ; DMA1 Channel 4DCD     DMA1_Channel5_IRQHandler   ; DMA1 Channel 5DCD     DMA1_Channel6_IRQHandler   ; DMA1 Channel 6DCD     DMA1_Channel7_IRQHandler   ; DMA1 Channel 7DCD     ADC1_2_IRQHandler          ; ADC1 & ADC2DCD     USB_HP_CAN1_TX_IRQHandler  ; USB High Priority or CAN1 TXDCD     USB_LP_CAN1_RX0_IRQHandler ; USB Low  Priority or CAN1 RX0DCD     CAN1_RX1_IRQHandler        ; CAN1 RX1DCD     CAN1_SCE_IRQHandler        ; CAN1 SCEDCD     EXTI9_5_IRQHandler         ; EXTI Line 9..5DCD     TIM1_BRK_IRQHandler        ; TIM1 BreakDCD     TIM1_UP_IRQHandler         ; TIM1 UpdateDCD     TIM1_TRG_COM_IRQHandler    ; TIM1 Trigger and CommutationDCD     TIM1_CC_IRQHandler         ; TIM1 Capture CompareDCD     TIM2_IRQHandler            ; TIM2DCD     TIM3_IRQHandler            ; TIM3DCD     TIM4_IRQHandler            ; TIM4DCD     I2C1_EV_IRQHandler         ; I2C1 EventDCD     I2C1_ER_IRQHandler         ; I2C1 ErrorDCD     I2C2_EV_IRQHandler         ; I2C2 EventDCD     I2C2_ER_IRQHandler         ; I2C2 ErrorDCD     SPI1_IRQHandler            ; SPI1DCD     SPI2_IRQHandler            ; SPI2DCD     USART1_IRQHandler          ; USART1DCD     USART2_IRQHandler          ; USART2DCD     USART3_IRQHandler          ; USART3DCD     EXTI15_10_IRQHandler       ; EXTI Line 15..10DCD     RTC_Alarm_IRQHandler        ; RTC Alarm through EXTI LineDCD     USBWakeUp_IRQHandler       ; USB Wakeup from suspendDCD     TIM8_BRK_IRQHandler        ; TIM8 BreakDCD     TIM8_UP_IRQHandler         ; TIM8 UpdateDCD     TIM8_TRG_COM_IRQHandler    ; TIM8 Trigger and CommutationDCD     TIM8_CC_IRQHandler         ; TIM8 Capture CompareDCD     ADC3_IRQHandler            ; ADC3DCD     FSMC_IRQHandler            ; FSMCDCD     SDIO_IRQHandler            ; SDIODCD     TIM5_IRQHandler            ; TIM5DCD     SPI3_IRQHandler            ; SPI3DCD     UART4_IRQHandler           ; UART4DCD     UART5_IRQHandler           ; UART5DCD     TIM6_IRQHandler            ; TIM6DCD     TIM7_IRQHandler            ; TIM7DCD     DMA2_Channel1_IRQHandler   ; DMA2 Channel1DCD     DMA2_Channel2_IRQHandler   ; DMA2 Channel2DCD     DMA2_Channel3_IRQHandler   ; DMA2 Channel3DCD     DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
__Vectors_End__Vectors_Size  EQU  __Vectors_End - __Vectors

        首先定义了一块名为RESET的内存区域,该区域存储数据且是只读的。 

        随后导出了三个标号__Vectors、__Vectors_End和__Vectors_Size,以便其他文件中引用它们。

         从标号__Vectors开始,使用DCD指令定义了多个中断函数的地址(包括系统内核中断和外部中断两类),可以看出最低地址存放着栈顶的初始化地址即__initial_sp。最后用__Vectors_End标号表示向量表的结束并计算出标号__Vectors_Size的值。

6、定义默认中断函数

                AREA    |.text|, CODE, READONLY; Reset handler
Reset_Handler   PROCEXPORT  Reset_Handler             [WEAK]IMPORT  __mainIMPORT  SystemInitLDR     R0, =SystemInitBLX     R0               LDR     R0, =__mainBX      R0ENDP; Dummy Exception Handlers (infinite loops which can be modified)NMI_Handler     PROCEXPORT  NMI_Handler                [WEAK]B       .ENDP
HardFault_Handler\PROCEXPORT  HardFault_Handler          [WEAK]B       .ENDP
MemManage_Handler\PROCEXPORT  MemManage_Handler          [WEAK]B       .ENDP
BusFault_Handler\PROCEXPORT  BusFault_Handler           [WEAK]B       .ENDP
UsageFault_Handler\PROCEXPORT  UsageFault_Handler         [WEAK]B       .ENDP
SVC_Handler     PROCEXPORT  SVC_Handler                [WEAK]B       .ENDP
DebugMon_Handler\PROCEXPORT  DebugMon_Handler           [WEAK]B       .ENDP
PendSV_Handler  PROCEXPORT  PendSV_Handler             [WEAK]B       .ENDP
SysTick_Handler PROCEXPORT  SysTick_Handler            [WEAK]B       .ENDPDefault_Handler PROCEXPORT  WWDG_IRQHandler            [WEAK]EXPORT  PVD_IRQHandler             [WEAK]EXPORT  TAMPER_IRQHandler          [WEAK]EXPORT  RTC_IRQHandler             [WEAK]EXPORT  FLASH_IRQHandler           [WEAK]EXPORT  RCC_IRQHandler             [WEAK]EXPORT  EXTI0_IRQHandler           [WEAK]EXPORT  EXTI1_IRQHandler           [WEAK]EXPORT  EXTI2_IRQHandler           [WEAK]EXPORT  EXTI3_IRQHandler           [WEAK]EXPORT  EXTI4_IRQHandler           [WEAK]EXPORT  DMA1_Channel1_IRQHandler   [WEAK]EXPORT  DMA1_Channel2_IRQHandler   [WEAK]EXPORT  DMA1_Channel3_IRQHandler   [WEAK]EXPORT  DMA1_Channel4_IRQHandler   [WEAK]EXPORT  DMA1_Channel5_IRQHandler   [WEAK]EXPORT  DMA1_Channel6_IRQHandler   [WEAK]EXPORT  DMA1_Channel7_IRQHandler   [WEAK]EXPORT  ADC1_2_IRQHandler          [WEAK]EXPORT  USB_HP_CAN1_TX_IRQHandler  [WEAK]EXPORT  USB_LP_CAN1_RX0_IRQHandler [WEAK]EXPORT  CAN1_RX1_IRQHandler        [WEAK]EXPORT  CAN1_SCE_IRQHandler        [WEAK]EXPORT  EXTI9_5_IRQHandler         [WEAK]EXPORT  TIM1_BRK_IRQHandler        [WEAK]EXPORT  TIM1_UP_IRQHandler         [WEAK]EXPORT  TIM1_TRG_COM_IRQHandler    [WEAK]EXPORT  TIM1_CC_IRQHandler         [WEAK]EXPORT  TIM2_IRQHandler            [WEAK]EXPORT  TIM3_IRQHandler            [WEAK]EXPORT  TIM4_IRQHandler            [WEAK]EXPORT  I2C1_EV_IRQHandler         [WEAK]EXPORT  I2C1_ER_IRQHandler         [WEAK]EXPORT  I2C2_EV_IRQHandler         [WEAK]EXPORT  I2C2_ER_IRQHandler         [WEAK]EXPORT  SPI1_IRQHandler            [WEAK]EXPORT  SPI2_IRQHandler            [WEAK]EXPORT  USART1_IRQHandler          [WEAK]EXPORT  USART2_IRQHandler          [WEAK]EXPORT  USART3_IRQHandler          [WEAK]EXPORT  EXTI15_10_IRQHandler       [WEAK]EXPORT  RTC_Alarm_IRQHandler        [WEAK]EXPORT  USBWakeUp_IRQHandler       [WEAK]EXPORT  TIM8_BRK_IRQHandler        [WEAK]EXPORT  TIM8_UP_IRQHandler         [WEAK]EXPORT  TIM8_TRG_COM_IRQHandler    [WEAK]EXPORT  TIM8_CC_IRQHandler         [WEAK]EXPORT  ADC3_IRQHandler            [WEAK]EXPORT  FSMC_IRQHandler            [WEAK]EXPORT  SDIO_IRQHandler            [WEAK]EXPORT  TIM5_IRQHandler            [WEAK]EXPORT  SPI3_IRQHandler            [WEAK]EXPORT  UART4_IRQHandler           [WEAK]EXPORT  UART5_IRQHandler           [WEAK]EXPORT  TIM6_IRQHandler            [WEAK]EXPORT  TIM7_IRQHandler            [WEAK]EXPORT  DMA2_Channel1_IRQHandler   [WEAK]EXPORT  DMA2_Channel2_IRQHandler   [WEAK]EXPORT  DMA2_Channel3_IRQHandler   [WEAK]EXPORT  DMA2_Channel4_5_IRQHandler [WEAK]WWDG_IRQHandler
PVD_IRQHandler
TAMPER_IRQHandler
RTC_IRQHandler
FLASH_IRQHandler
RCC_IRQHandler
EXTI0_IRQHandler
EXTI1_IRQHandler
EXTI2_IRQHandler
EXTI3_IRQHandler
EXTI4_IRQHandler
DMA1_Channel1_IRQHandler
DMA1_Channel2_IRQHandler
DMA1_Channel3_IRQHandler
DMA1_Channel4_IRQHandler
DMA1_Channel5_IRQHandler
DMA1_Channel6_IRQHandler
DMA1_Channel7_IRQHandler
ADC1_2_IRQHandler
USB_HP_CAN1_TX_IRQHandler
USB_LP_CAN1_RX0_IRQHandler
CAN1_RX1_IRQHandler
CAN1_SCE_IRQHandler
EXTI9_5_IRQHandler
TIM1_BRK_IRQHandler
TIM1_UP_IRQHandler
TIM1_TRG_COM_IRQHandler
TIM1_CC_IRQHandler
TIM2_IRQHandler
TIM3_IRQHandler
TIM4_IRQHandler
I2C1_EV_IRQHandler
I2C1_ER_IRQHandler
I2C2_EV_IRQHandler
I2C2_ER_IRQHandler
SPI1_IRQHandler
SPI2_IRQHandler
USART1_IRQHandler
USART2_IRQHandler
USART3_IRQHandler
EXTI15_10_IRQHandler
RTC_Alarm_IRQHandler
USBWakeUp_IRQHandler
TIM8_BRK_IRQHandler
TIM8_UP_IRQHandler
TIM8_TRG_COM_IRQHandler
TIM8_CC_IRQHandler
ADC3_IRQHandler
FSMC_IRQHandler
SDIO_IRQHandler
TIM5_IRQHandler
SPI3_IRQHandler
UART4_IRQHandler
UART5_IRQHandler
TIM6_IRQHandler
TIM7_IRQHandler
DMA2_Channel1_IRQHandler
DMA2_Channel2_IRQHandler
DMA2_Channel3_IRQHandler
DMA2_Channel4_5_IRQHandlerB       .ENDPALIGN

        首先定义了一块名为.text的内存区域,该区域存储代码且是只读的。 

6.1、复位中断函数

; Reset handler
Reset_Handler   PROCEXPORT  Reset_Handler             [WEAK]IMPORT  __mainIMPORT  SystemInitLDR     R0, =SystemInitBLX     R0               LDR     R0, =__mainBX      R0ENDP

        定义了一个名为Reset_Handler的标号,PROC表示这是一个过程(即函数),随后Reset_Handler标号被导出并被标记为弱标号,即如果没有在其他地方提供Reset_Handler,则会使用这里定义的弱定义。两个IMPORT语句表示__main和SystemInit标号来自于其他文件,随后使用LDR和BLX指令配合,跳转执行SystemInit函数,它是一个系统初始化函数,在system_stm32f1xx.c中定义,用于配置硬件(如时钟、外设等)。最后跳转执行__main函数,它是一个C库函数,它用于初始化程序的各个段和寄存器,并最终执行用户定义的main函数。其中BX指令不会保存当前PC,即__main函数不会返回。

6.2、其他系统内核中断函数

; Dummy Exception Handlers (infinite loops which can be modified)NMI_Handler     PROCEXPORT  NMI_Handler                [WEAK]B       .ENDP
HardFault_Handler\PROCEXPORT  HardFault_Handler          [WEAK]B       .ENDP
MemManage_Handler\PROCEXPORT  MemManage_Handler          [WEAK]B       .ENDP
BusFault_Handler\PROCEXPORT  BusFault_Handler           [WEAK]B       .ENDP
UsageFault_Handler\PROCEXPORT  UsageFault_Handler         [WEAK]B       .ENDP
SVC_Handler     PROCEXPORT  SVC_Handler                [WEAK]B       .ENDP
DebugMon_Handler\PROCEXPORT  DebugMon_Handler           [WEAK]B       .ENDP
PendSV_Handler  PROCEXPORT  PendSV_Handler             [WEAK]B       .ENDP
SysTick_Handler PROCEXPORT  SysTick_Handler            [WEAK]B       .ENDP

        其他的系统内核中断函数的函数定义都是一个无限循环B .,开发者需要在其他地方为这些函数提供实际的实现。

6.3、外部中断函数

Default_Handler PROCEXPORT  WWDG_IRQHandler            [WEAK]EXPORT  PVD_IRQHandler             [WEAK]EXPORT  TAMPER_IRQHandler          [WEAK]EXPORT  RTC_IRQHandler             [WEAK]EXPORT  FLASH_IRQHandler           [WEAK]EXPORT  RCC_IRQHandler             [WEAK]EXPORT  EXTI0_IRQHandler           [WEAK]EXPORT  EXTI1_IRQHandler           [WEAK]EXPORT  EXTI2_IRQHandler           [WEAK]EXPORT  EXTI3_IRQHandler           [WEAK]EXPORT  EXTI4_IRQHandler           [WEAK]EXPORT  DMA1_Channel1_IRQHandler   [WEAK]EXPORT  DMA1_Channel2_IRQHandler   [WEAK]EXPORT  DMA1_Channel3_IRQHandler   [WEAK]EXPORT  DMA1_Channel4_IRQHandler   [WEAK]EXPORT  DMA1_Channel5_IRQHandler   [WEAK]EXPORT  DMA1_Channel6_IRQHandler   [WEAK]EXPORT  DMA1_Channel7_IRQHandler   [WEAK]EXPORT  ADC1_2_IRQHandler          [WEAK]EXPORT  USB_HP_CAN1_TX_IRQHandler  [WEAK]EXPORT  USB_LP_CAN1_RX0_IRQHandler [WEAK]EXPORT  CAN1_RX1_IRQHandler        [WEAK]EXPORT  CAN1_SCE_IRQHandler        [WEAK]EXPORT  EXTI9_5_IRQHandler         [WEAK]EXPORT  TIM1_BRK_IRQHandler        [WEAK]EXPORT  TIM1_UP_IRQHandler         [WEAK]EXPORT  TIM1_TRG_COM_IRQHandler    [WEAK]EXPORT  TIM1_CC_IRQHandler         [WEAK]EXPORT  TIM2_IRQHandler            [WEAK]EXPORT  TIM3_IRQHandler            [WEAK]EXPORT  TIM4_IRQHandler            [WEAK]EXPORT  I2C1_EV_IRQHandler         [WEAK]EXPORT  I2C1_ER_IRQHandler         [WEAK]EXPORT  I2C2_EV_IRQHandler         [WEAK]EXPORT  I2C2_ER_IRQHandler         [WEAK]EXPORT  SPI1_IRQHandler            [WEAK]EXPORT  SPI2_IRQHandler            [WEAK]EXPORT  USART1_IRQHandler          [WEAK]EXPORT  USART2_IRQHandler          [WEAK]EXPORT  USART3_IRQHandler          [WEAK]EXPORT  EXTI15_10_IRQHandler       [WEAK]EXPORT  RTC_Alarm_IRQHandler        [WEAK]EXPORT  USBWakeUp_IRQHandler       [WEAK]EXPORT  TIM8_BRK_IRQHandler        [WEAK]EXPORT  TIM8_UP_IRQHandler         [WEAK]EXPORT  TIM8_TRG_COM_IRQHandler    [WEAK]EXPORT  TIM8_CC_IRQHandler         [WEAK]EXPORT  ADC3_IRQHandler            [WEAK]EXPORT  FSMC_IRQHandler            [WEAK]EXPORT  SDIO_IRQHandler            [WEAK]EXPORT  TIM5_IRQHandler            [WEAK]EXPORT  SPI3_IRQHandler            [WEAK]EXPORT  UART4_IRQHandler           [WEAK]EXPORT  UART5_IRQHandler           [WEAK]EXPORT  TIM6_IRQHandler            [WEAK]EXPORT  TIM7_IRQHandler            [WEAK]EXPORT  DMA2_Channel1_IRQHandler   [WEAK]EXPORT  DMA2_Channel2_IRQHandler   [WEAK]EXPORT  DMA2_Channel3_IRQHandler   [WEAK]EXPORT  DMA2_Channel4_5_IRQHandler [WEAK]WWDG_IRQHandler
PVD_IRQHandler
TAMPER_IRQHandler
RTC_IRQHandler
FLASH_IRQHandler
RCC_IRQHandler
EXTI0_IRQHandler
EXTI1_IRQHandler
EXTI2_IRQHandler
EXTI3_IRQHandler
EXTI4_IRQHandler
DMA1_Channel1_IRQHandler
DMA1_Channel2_IRQHandler
DMA1_Channel3_IRQHandler
DMA1_Channel4_IRQHandler
DMA1_Channel5_IRQHandler
DMA1_Channel6_IRQHandler
DMA1_Channel7_IRQHandler
ADC1_2_IRQHandler
USB_HP_CAN1_TX_IRQHandler
USB_LP_CAN1_RX0_IRQHandler
CAN1_RX1_IRQHandler
CAN1_SCE_IRQHandler
EXTI9_5_IRQHandler
TIM1_BRK_IRQHandler
TIM1_UP_IRQHandler
TIM1_TRG_COM_IRQHandler
TIM1_CC_IRQHandler
TIM2_IRQHandler
TIM3_IRQHandler
TIM4_IRQHandler
I2C1_EV_IRQHandler
I2C1_ER_IRQHandler
I2C2_EV_IRQHandler
I2C2_ER_IRQHandler
SPI1_IRQHandler
SPI2_IRQHandler
USART1_IRQHandler
USART2_IRQHandler
USART3_IRQHandler
EXTI15_10_IRQHandler
RTC_Alarm_IRQHandler
USBWakeUp_IRQHandler
TIM8_BRK_IRQHandler
TIM8_UP_IRQHandler
TIM8_TRG_COM_IRQHandler
TIM8_CC_IRQHandler
ADC3_IRQHandler
FSMC_IRQHandler
SDIO_IRQHandler
TIM5_IRQHandler
SPI3_IRQHandler
UART4_IRQHandler
UART5_IRQHandler
TIM6_IRQHandler
TIM7_IRQHandler
DMA2_Channel1_IRQHandler
DMA2_Channel2_IRQHandler
DMA2_Channel3_IRQHandler
DMA2_Channel4_5_IRQHandlerB       .ENDP

        定义了一个名为Default_Handler的标号,PROC表示这是一个过程(即函数),外部中断函数的标号被导出并被标记为弱标号,它们表示的地址实际上就是Default_Handler函数的地址,如果没有在其他地方对这些外部中断函数进行实现,依旧是会进入无限循环B .。

7、堆栈初始化函数

                ALIGN;*******************************************************************************
; User Stack and Heap initialization
;*******************************************************************************IF      :DEF:__MICROLIBEXPORT  __initial_spEXPORT  __heap_baseEXPORT  __heap_limitELSEIMPORT  __use_two_region_memoryEXPORT  __user_initial_stackheap__user_initial_stackheapLDR     R0, =  Heap_MemLDR     R1, = (Stack_Mem + Stack_Size)LDR     R2, = (Heap_Mem +  Heap_Size)LDR     R3, = Stack_MemBX      LRALIGNENDIFEND

        ALIGN表示将当前位置对齐到4字节。随后是一段条件编译的代码,如果定义了__MICROLIB宏,则将标号__initial_sp、__heap_base和__heap_limit导出;否则导入__use_two_region_memory标号并导出__user_initial_stackheap标号,其中在R0寄存器保存了堆起始地址,R1寄存器保存了栈顶地址,R2保存了堆结束地址,R3保存了栈的地址。最后跳转到标号LR处继续执行且不返回。

        定义__MICROLIB可以通过Option选项卡进行,如图1所示。

图1 使用微库选项

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com