分析三个文件--启动文件、链接文件、map文件

目录

启动文件

链接文件

部分map文件内容

FLASH物理地址(0x08000000开始)的映射关系

0x08000000 之前地址空间


启动文件

;******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
;* File Name          : startup_stm32f40_41xxx.s
;* Author             : MCD Application Team
;* @version           : V1.8.1
;* @date              : 27-January-2022
;* Description        : STM32F40xxx/41xxx 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 system clock and the external SRAM mounted on 
;*                        STM324xG-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 CortexM4 processor is in Thread mode,
;*                      priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>>   
;******************************************************************************
;* @attention
;*
;* Copyright (c) 2016 STMicroelectronics.
;* All rights reserved.
;*
;* This software is licensed under terms that can be found in the LICENSE file
;* in the root directory of this software component.
;* If no LICENSE file comes with this software, it is provided AS-IS.
;*
;******************************************************************************

; 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     0x00000400

                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp


; <h> Heap Configuration
;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Heap_Size       EQU     0x00000200

                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem        SPACE   Heap_Size
__heap_limit

                PRESERVE8
                THUMB


; Vector Table Mapped to Address 0 at Reset
                AREA    RESET, DATA, READONLY
                EXPORT  __Vectors
                EXPORT  __Vectors_End
                EXPORT  __Vectors_Size

__Vectors       DCD     __initial_sp               ; Top of Stack
                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     TAMP_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_IRQHandler                  ; EXTI Line2                                             
                DCD     EXTI3_IRQHandler                  ; EXTI Line3                                             
                DCD     EXTI4_IRQHandler                  ; EXTI Line4                                             
                DCD     DMA1_Stream0_IRQHandler           ; DMA1 Stream 0                                   
                DCD     DMA1_Stream1_IRQHandler           ; DMA1 Stream 1                                   
                DCD     DMA1_Stream2_IRQHandler           ; DMA1 Stream 2                                   
                DCD     DMA1_Stream3_IRQHandler           ; DMA1 Stream 3                                   
                DCD     DMA1_Stream4_IRQHandler           ; DMA1 Stream 4                                   
                DCD     DMA1_Stream5_IRQHandler           ; DMA1 Stream 5                                   
                DCD     DMA1_Stream6_IRQHandler           ; DMA1 Stream 6                                   
                DCD     ADC_IRQHandler                    ; ADC1, ADC2 and ADC3s                            
                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     TIM1_BRK_TIM9_IRQHandler          ; TIM1 Break and TIM9                   
                DCD     TIM1_UP_TIM10_IRQHandler          ; TIM1 Update and TIM10                 
                DCD     TIM1_TRG_COM_TIM11_IRQHandler     ; TIM1 Trigger and Commutation and TIM11
                DCD     TIM1_CC_IRQHandler                ; TIM1 Capture Compare                                   
                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     OTG_FS_WKUP_IRQHandler            ; USB OTG FS Wakeup through EXTI line                        
                DCD     TIM8_BRK_TIM12_IRQHandler         ; TIM8 Break and TIM12                  
                DCD     TIM8_UP_TIM13_IRQHandler          ; TIM8 Update and TIM13                 
                DCD     TIM8_TRG_COM_TIM14_IRQHandler     ; TIM8 Trigger and Commutation and TIM14
                DCD     TIM8_CC_IRQHandler                ; TIM8 Capture Compare                                   
                DCD     DMA1_Stream7_IRQHandler           ; DMA1 Stream7                                           
                DCD     FSMC_IRQHandler                   ; FSMC                                            
                DCD     SDIO_IRQHandler                   ; SDIO                                            
                DCD     TIM5_IRQHandler                   ; TIM5                                            
                DCD     SPI3_IRQHandler                   ; SPI3                                            
                DCD     UART4_IRQHandler                  ; UART4                                           
                DCD     UART5_IRQHandler                  ; UART5                                           
                DCD     TIM6_DAC_IRQHandler               ; TIM6 and DAC1&2 underrun errors                   
                DCD     TIM7_IRQHandler                   ; TIM7                   
                DCD     DMA2_Stream0_IRQHandler           ; DMA2 Stream 0                                   
                DCD     DMA2_Stream1_IRQHandler           ; DMA2 Stream 1                                   
                DCD     DMA2_Stream2_IRQHandler           ; DMA2 Stream 2                                   
                DCD     DMA2_Stream3_IRQHandler           ; DMA2 Stream 3                                   
                DCD     DMA2_Stream4_IRQHandler           ; DMA2 Stream 4                                   
                DCD     ETH_IRQHandler                    ; Ethernet                                        
                DCD     ETH_WKUP_IRQHandler               ; Ethernet Wakeup through EXTI line                      
                DCD     CAN2_TX_IRQHandler                ; CAN2 TX                                                
                DCD     CAN2_RX0_IRQHandler               ; CAN2 RX0                                               
                DCD     CAN2_RX1_IRQHandler               ; CAN2 RX1                                               
                DCD     CAN2_SCE_IRQHandler               ; CAN2 SCE                                               
                DCD     OTG_FS_IRQHandler                 ; USB OTG FS                                      
                DCD     DMA2_Stream5_IRQHandler           ; DMA2 Stream 5                                   
                DCD     DMA2_Stream6_IRQHandler           ; DMA2 Stream 6                                   
                DCD     DMA2_Stream7_IRQHandler           ; DMA2 Stream 7                                   
                DCD     USART6_IRQHandler                 ; USART6                                           
                DCD     I2C3_EV_IRQHandler                ; I2C3 event                                             
                DCD     I2C3_ER_IRQHandler                ; I2C3 error                                             
                DCD     OTG_HS_EP1_OUT_IRQHandler         ; USB OTG HS End Point 1 Out                      
                DCD     OTG_HS_EP1_IN_IRQHandler          ; USB OTG HS End Point 1 In                       
                DCD     OTG_HS_WKUP_IRQHandler            ; USB OTG HS Wakeup through EXTI                         
                DCD     OTG_HS_IRQHandler                 ; USB OTG HS                                      
                DCD     DCMI_IRQHandler                   ; DCMI                                            
                DCD     CRYP_IRQHandler                   ; CRYP crypto                                     
                DCD     HASH_RNG_IRQHandler               ; Hash and Rng
                DCD     FPU_IRQHandler                    ; FPU
                                         
__Vectors_End

__Vectors_Size  EQU  __Vectors_End - __Vectors

                AREA    |.text|, CODE, READONLY

; Reset handler
Reset_Handler    PROC
                 EXPORT  Reset_Handler             [WEAK]
        IMPORT  SystemInit
        IMPORT  __main

                 LDR     R0, =SystemInit
                 BLX     R0
                 LDR     R0, =__main
                 BX      R0
                 ENDP

; Dummy Exception Handlers (infinite loops which can be modified)

NMI_Handler     PROC
                EXPORT  NMI_Handler                [WEAK]
                B       .
                ENDP
HardFault_Handler\
                PROC
                EXPORT  HardFault_Handler          [WEAK]
                B       .
                ENDP
MemManage_Handler\
                PROC
                EXPORT  MemManage_Handler          [WEAK]
                B       .
                ENDP
BusFault_Handler\
                PROC
                EXPORT  BusFault_Handler           [WEAK]
                B       .
                ENDP
UsageFault_Handler\
                PROC
                EXPORT  UsageFault_Handler         [WEAK]
                B       .
                ENDP
SVC_Handler     PROC
                EXPORT  SVC_Handler                [WEAK]
                B       .
                ENDP
DebugMon_Handler\
                PROC
                EXPORT  DebugMon_Handler           [WEAK]
                B       .
                ENDP
PendSV_Handler  PROC
                EXPORT  PendSV_Handler             [WEAK]
                B       .
                ENDP
SysTick_Handler PROC
                EXPORT  SysTick_Handler            [WEAK]
                B       .
                ENDP

Default_Handler PROC

                EXPORT  WWDG_IRQHandler                   [WEAK]                                        
                EXPORT  PVD_IRQHandler                    [WEAK]                      
                EXPORT  TAMP_STAMP_IRQHandler             [WEAK]         
                EXPORT  RTC_WKUP_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_Stream0_IRQHandler           [WEAK]                                
                EXPORT  DMA1_Stream1_IRQHandler           [WEAK]                                   
                EXPORT  DMA1_Stream2_IRQHandler           [WEAK]                                   
                EXPORT  DMA1_Stream3_IRQHandler           [WEAK]                                   
                EXPORT  DMA1_Stream4_IRQHandler           [WEAK]                                   
                EXPORT  DMA1_Stream5_IRQHandler           [WEAK]                                   
                EXPORT  DMA1_Stream6_IRQHandler           [WEAK]                                   
                EXPORT  ADC_IRQHandler                    [WEAK]                         
                EXPORT  CAN1_TX_IRQHandler                [WEAK]                                                
                EXPORT  CAN1_RX0_IRQHandler               [WEAK]                                               
                EXPORT  CAN1_RX1_IRQHandler               [WEAK]                                                
                EXPORT  CAN1_SCE_IRQHandler               [WEAK]                                                
                EXPORT  EXTI9_5_IRQHandler                [WEAK]                                    
                EXPORT  TIM1_BRK_TIM9_IRQHandler          [WEAK]                  
                EXPORT  TIM1_UP_TIM10_IRQHandler          [WEAK]                
                EXPORT  TIM1_TRG_COM_TIM11_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  OTG_FS_WKUP_IRQHandler            [WEAK]                        
                EXPORT  TIM8_BRK_TIM12_IRQHandler         [WEAK]                 
                EXPORT  TIM8_UP_TIM13_IRQHandler          [WEAK]                 
                EXPORT  TIM8_TRG_COM_TIM14_IRQHandler     [WEAK] 
                EXPORT  TIM8_CC_IRQHandler                [WEAK]                                   
                EXPORT  DMA1_Stream7_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_DAC_IRQHandler               [WEAK]                   
                EXPORT  TIM7_IRQHandler                   [WEAK]                    
                EXPORT  DMA2_Stream0_IRQHandler           [WEAK]                                  
                EXPORT  DMA2_Stream1_IRQHandler           [WEAK]                                   
                EXPORT  DMA2_Stream2_IRQHandler           [WEAK]                                    
                EXPORT  DMA2_Stream3_IRQHandler           [WEAK]                                    
                EXPORT  DMA2_Stream4_IRQHandler           [WEAK]                                 
                EXPORT  ETH_IRQHandler                    [WEAK]                                         
                EXPORT  ETH_WKUP_IRQHandler               [WEAK]                     
                EXPORT  CAN2_TX_IRQHandler                [WEAK]                                               
                EXPORT  CAN2_RX0_IRQHandler               [WEAK]                                               
                EXPORT  CAN2_RX1_IRQHandler               [WEAK]                                               
                EXPORT  CAN2_SCE_IRQHandler               [WEAK]                                               
                EXPORT  OTG_FS_IRQHandler                 [WEAK]                                       
                EXPORT  DMA2_Stream5_IRQHandler           [WEAK]                                   
                EXPORT  DMA2_Stream6_IRQHandler           [WEAK]                                   
                EXPORT  DMA2_Stream7_IRQHandler           [WEAK]                                   
                EXPORT  USART6_IRQHandler                 [WEAK]                                           
                EXPORT  I2C3_EV_IRQHandler                [WEAK]                                              
                EXPORT  I2C3_ER_IRQHandler                [WEAK]                                              
                EXPORT  OTG_HS_EP1_OUT_IRQHandler         [WEAK]                      
                EXPORT  OTG_HS_EP1_IN_IRQHandler          [WEAK]                      
                EXPORT  OTG_HS_WKUP_IRQHandler            [WEAK]                        
                EXPORT  OTG_HS_IRQHandler                 [WEAK]                                      
                EXPORT  DCMI_IRQHandler                   [WEAK]                                             
                EXPORT  CRYP_IRQHandler                   [WEAK]                                     
                EXPORT  HASH_RNG_IRQHandler               [WEAK]
                EXPORT  FPU_IRQHandler                    [WEAK]

WWDG_IRQHandler                                                       
PVD_IRQHandler                                      
TAMP_STAMP_IRQHandler                  
RTC_WKUP_IRQHandler                                
FLASH_IRQHandler                                                       
RCC_IRQHandler                                                            
EXTI0_IRQHandler                                                          
EXTI1_IRQHandler                                                           
EXTI2_IRQHandler                                                          
EXTI3_IRQHandler                                                         
EXTI4_IRQHandler                                                          
DMA1_Stream0_IRQHandler                                       
DMA1_Stream1_IRQHandler                                          
DMA1_Stream2_IRQHandler                                          
DMA1_Stream3_IRQHandler                                          
DMA1_Stream4_IRQHandler                                          
DMA1_Stream5_IRQHandler                                          
DMA1_Stream6_IRQHandler                                          
ADC_IRQHandler                                         
CAN1_TX_IRQHandler                                                            
CAN1_RX0_IRQHandler                                                          
CAN1_RX1_IRQHandler                                                           
CAN1_SCE_IRQHandler                                                           
EXTI9_5_IRQHandler                                                
TIM1_BRK_TIM9_IRQHandler                        
TIM1_UP_TIM10_IRQHandler                      
TIM1_TRG_COM_TIM11_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                            
OTG_FS_WKUP_IRQHandler                                
TIM8_BRK_TIM12_IRQHandler                      
TIM8_UP_TIM13_IRQHandler                       
TIM8_TRG_COM_TIM14_IRQHandler  
TIM8_CC_IRQHandler                                               
DMA1_Stream7_IRQHandler                                                 
FSMC_IRQHandler                                                            
SDIO_IRQHandler                                                            
TIM5_IRQHandler                                                            
SPI3_IRQHandler                                                            
UART4_IRQHandler                                                          
UART5_IRQHandler                                                          
TIM6_DAC_IRQHandler                            
TIM7_IRQHandler                              
DMA2_Stream0_IRQHandler                                         
DMA2_Stream1_IRQHandler                                          
DMA2_Stream2_IRQHandler                                           
DMA2_Stream3_IRQHandler                                           
DMA2_Stream4_IRQHandler                                        
ETH_IRQHandler                                                         
ETH_WKUP_IRQHandler                                
CAN2_TX_IRQHandler                                                           
CAN2_RX0_IRQHandler                                                          
CAN2_RX1_IRQHandler                                                          
CAN2_SCE_IRQHandler                                                          
OTG_FS_IRQHandler                                                    
DMA2_Stream5_IRQHandler                                          
DMA2_Stream6_IRQHandler                                          
DMA2_Stream7_IRQHandler                                          
USART6_IRQHandler                                                        
I2C3_EV_IRQHandler                                                          
I2C3_ER_IRQHandler                                                          
OTG_HS_EP1_OUT_IRQHandler                           
OTG_HS_EP1_IN_IRQHandler                            
OTG_HS_WKUP_IRQHandler                                
OTG_HS_IRQHandler                                                   
DCMI_IRQHandler                                                            
CRYP_IRQHandler                                                    
HASH_RNG_IRQHandler
FPU_IRQHandler
   
                B       .

                ENDP

                ALIGN

;*******************************************************************************
; User Stack and Heap initialization
;*******************************************************************************
                 IF      :DEF:__MICROLIB
                
                 EXPORT  __initial_sp
                 EXPORT  __heap_base
                 EXPORT  __heap_limit
                
                 ELSE
                
                 IMPORT  __use_two_region_memory
                 EXPORT  __user_initial_stackheap
                 
__user_initial_stackheap

                 LDR     R0, =  Heap_Mem
                 LDR     R1, =(Stack_Mem + Stack_Size)
                 LDR     R2, = (Heap_Mem +  Heap_Size)
                 LDR     R3, = Stack_Mem
                 BX      LR

                 ALIGN

                 ENDIF

                 END

链接文件

/*
 * STM32F407ZET6 链接脚本
 * 硬件配置: 512KB FLASH, 128KB SRAM, 64KB CCMRAM
 * 支持标准库、CCMRAM使用、调试信息
 */

/* 入口点定义 */
ENTRY(Reset_Handler)

/* 栈顶地址定义 */
_estack = ORIGIN(RAM) + LENGTH(RAM);

/* 堆和栈大小配置 */
_Min_Heap_Size  = 0x800;   /* 2KB堆 */
_Min_Stack_Size = 0x1000;  /* 4KB栈 */

/* 内存布局定义 */
MEMORY
{
  FLASH  (rx)  : ORIGIN = 0x08000000, LENGTH = 512K  /* 主FLASH */
  RAM    (xrw) : ORIGIN = 0x20000000, LENGTH = 128K  /* 主SRAM */
  CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K   /* CCMRAM */
}

/* 段配置 */
SECTIONS
{
  /* 1. 中断向量表 */
  .isr_vector :
  {
    KEEP(*(.isr_vector))                 /* 中断向量表必须保留 */
  } > FLASH                              /* 放置在FLASH起始位置 */

  /* 2. 代码段和只读数据 */
  .text :
  {
    . = ALIGN(4);
    *(.text)                             /* 程序代码 */
    *(.text*)                            /* 所有.text子段 */
    *(.rodata)                           /* 只读数据 */
    *(.rodata*)                          /* 所有.rodata子段 */
    *(.glue_7)                           /* ARM与Thumb指令交互 */
    *(.glue_7t)                          /* ARM与Thumb指令交互 */
    *(.gnu.linkonce.t*)

    /* 函数构造与析构 */
    KEEP(*(.init))
    KEEP(*(.fini))

    . = ALIGN(4);
    _etext = .;                          /* 代码段结束标记 */
  } > FLASH

  /* 3. 初始化数组 */
  .init_array :
  {
    PROVIDE_HIDDEN(__init_array_start = .);
    KEEP(*(SORT(.init_array.*)))
    KEEP(*(.init_array*))
    PROVIDE_HIDDEN(__init_array_end = .);
  } > FLASH

  /* 4. 反初始化数组 */
  .fini_array :
  {
    PROVIDE_HIDDEN(__fini_array_start = .);
    KEEP(*(SORT(.fini_array.*)))
    KEEP(*(.fini_array*))
    PROVIDE_HIDDEN(__fini_array_end = .);
  } > FLASH

  /* 5. 已初始化数据段 (RAM中,从FLASH加载) */
  _sidata = LOADADDR(.data);
  .data :
  {
    . = ALIGN(4);
    _sdata = .;                          /* 数据段起始地址 */
    *(.data)                             /* 数据段 */
    *(.data*)                            /* 所有.data子段 */
    *(.gnu.linkonce.d*)
    . = ALIGN(4);
    _edata = .;                          /* 数据段结束地址 */
  } > RAM AT > FLASH

  /* 6. CCMRAM已初始化数据 (高速RAM) */
  _siccmram = LOADADDR(.ccmdata);
  .ccmdata :
  {
    . = ALIGN(4);
    _sccmdata = .;                       /* CCM数据起始 */
    *(.ccmdata)
    *(.ccmdata*)
    . = ALIGN(4);
    _eccmdata = .;                       /* CCM数据结束 */
  } > CCMRAM AT > FLASH

  /* 7. 未初始化数据段 (BSS) */
  .bss :
  {
    . = ALIGN(4);
    __bss_start__ = .;                   /* BSS起始 */
    _sbss = .;
    *(.bss)
    *(.bss*)
    *(COMMON)                            /* 公共未初始化数据 */
    . = ALIGN(4);
    _ebss = .;
    __bss_end__ = .;                     /* BSS结束 */
  } > RAM

  /* 8. CCMRAM未初始化数据 */
  .ccmbss (NOLOAD) :
  {
    . = ALIGN(4);
    _sccmbss = .;                        /* CCM BSS起始 */
    *(.ccmbss)
    *(.ccmbss*)
    . = ALIGN(4);
    _eccmbss = .;                        /* CCM BSS结束 */
  } > CCMRAM

  /* 9. 堆和栈 */
  ._user_heap_stack (NOLOAD) :
  {
    . = ALIGN(8);
    PROVIDE(end = .);
    PROVIDE(_end = .);
    . = . + _Min_Heap_Size;              /* 堆区域 */
    . = . + _Min_Stack_Size;             /* 栈区域 */
    . = ALIGN(8);
  } > RAM

  /* 10. 特殊段定义 */
  .ARM.attributes 0 : { *(.ARM.attributes) }  /* 架构属性 */
  .debug_info     0 : { *(.debug_info) }      /* 调试信息 */
  .debug_line     0 : { *(.debug_line) }      /* 调试行号 */
  .debug_frame    0 : { *(.debug_frame) }     /* 调试帧信息 */

  /* 11. 丢弃不需要的段 */
  /DISCARD/ :
  {
    *(.ARM.exidx*)                       /* 不需要的异常索引 */
    *(.gnu.debuglink*)                   /* 调试链接信息 */
    *(.gnu.lto_*)                        /* LTO相关段 */
  }
}

/* 提供给启动文件的堆/栈符号 */
PROVIDE(__heap_size = _Min_Heap_Size);
PROVIDE(__stack_size = _Min_Stack_Size);
PROVIDE(__heap_base = _ebss);
PROVIDE(__heap_limit = _ebss + _Min_Heap_Size);

部分map文件内容

d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-init.o)
                0x0800062c                __libc_init_array
 *(.rodata)
 *(.rodata*)
 *(.glue_7)
 .glue_7        0x08000674        0x0 linker stubs
 *(.glue_7t)
 .glue_7t       0x08000674        0x0 linker stubs
 *(.gnu.linkonce.t*)
 *(.init)
 .init          0x08000674        0x4 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crti.o
                0x08000674                _init
 .init          0x08000678        0x8 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtn.o
 *(.fini)
 .fini          0x08000680        0x4 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crti.o
                0x08000680                _fini
 .fini          0x08000684        0x8 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtn.o
                0x0800068c                . = ALIGN (0x4)
                0x0800068c                _etext = .

.vfp11_veneer   0x0800068c        0x0
 .vfp11_veneer  0x0800068c        0x0 linker stubs

.v4_bx          0x0800068c        0x0
 .v4_bx         0x0800068c        0x0 linker stubs

.iplt           0x0800068c        0x0
 .iplt          0x0800068c        0x0 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o

.rel.dyn        0x0800068c        0x0
 .rel.iplt      0x0800068c        0x0 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o

.init_array     0x0800068c        0x4
                0x0800068c                PROVIDE (__init_array_start = .)
 *(SORT_BY_NAME(.init_array.*))
 *(.init_array*)
 .init_array    0x0800068c        0x4 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o
                0x08000690                PROVIDE (__init_array_end = .)

.fini_array     0x08000690        0x4
                [!provide]                PROVIDE (__fini_array_start = .)
 *(SORT_BY_NAME(.fini_array.*))
 *(.fini_array*)
 .fini_array    0x08000690        0x4 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o
                [!provide]                PROVIDE (__fini_array_end = .)
                0x08000694                _sidata = LOADADDR (.data)

.data           0x20000000        0x0 load address 0x08000694
                0x20000000                . = ALIGN (0x4)
                0x20000000                _sdata = .
 *(.data)
 *(.data*)
 *(.gnu.linkonce.d*)
                0x20000000                . = ALIGN (0x4)
                0x20000000                _edata = .
                0x08000694                _siccmram = LOADADDR (.ccmdata)

.igot.plt       0x20000000        0x0 load address 0x08000694
 .igot.plt      0x20000000        0x0 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o

.ccmdata        0x10000000        0x0 load address 0x08000694
                0x10000000                . = ALIGN (0x4)
                0x10000000                _sccmdata = .
 *(.ccmdata)
 *(.ccmdata*)
                0x10000000                . = ALIGN (0x4)
                0x10000000                _eccmdata = .

.bss            0x20000000       0x24
                0x20000000                . = ALIGN (0x4)
                0x20000000                __bss_start__ = .
                0x20000000                _sbss = .
 *(.bss)
 .bss           0x20000000       0x1c d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o
 *(.bss*)
 .bss.num.9140  0x2000001c        0x4 build/timer.o
 *(COMMON)
 COMMON         0x20000020        0x4 build/main.o
                0x20000020                TimingDelay
                0x20000024                . = ALIGN (0x4)
                0x20000024                _ebss = .
                0x20000024                __bss_end__ = .

.ccmbss         0x10000000        0x0
                0x10000000                . = ALIGN (0x4)
                0x10000000                _sccmbss = .
 *(.ccmbss)
 *(.ccmbss*)
                0x10000000                . = ALIGN (0x4)
                0x10000000                _eccmbss = .

._user_heap_stack
                0x20000024     0x1804
                0x20000028                . = ALIGN (0x8)
 *fill*         0x20000024        0x4 
                [!provide]                PROVIDE (end = .)
                [!provide]                PROVIDE (_end = .)
                0x20000828                . = (. + _Min_Heap_Size)
 *fill*         0x20000028      0x800 
                0x20001828                . = (. + _Min_Stack_Size)
 *fill*         0x20000828     0x1000 
                0x20001828                . = ALIGN (0x8)

.ARM.attributes
                0x00000000       0x30
 *(.ARM.attributes)
 .ARM.attributes
                0x00000000       0x1e d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crti.o
 .ARM.attributes
                0x0000001e       0x34 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtbegin.o
 .ARM.attributes
                0x00000052       0x34 build/stm32f4xx_exti.o
 .ARM.attributes
                0x00000086       0x34 build/stm32f4xx_gpio.o
 .ARM.attributes
                0x000000ba       0x34 build/stm32f4xx_tim.o
 .ARM.attributes
                0x000000ee       0x34 build/stm32f4xx_it.o
 .ARM.attributes
                0x00000122       0x34 build/system_stm32f4xx.o
 .ARM.attributes
                0x00000156       0x34 build/UserRegister.o
 .ARM.attributes
                0x0000018a       0x34 build/main.o
 .ARM.attributes
                0x000001be       0x34 build/timer.o
 .ARM.attributes
                0x000001f2       0x21 build/startup_stm32f407xx.o
 .ARM.attributes
                0x00000213       0x34 d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-init.o)
 .ARM.attributes
                0x00000247       0x1e d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m+fp/hard/crtn.o

.debug_info     0x00000000     0x61cc
 *(.debug_info)
 .debug_info    0x00000000      0x3d4 build/stm32f4xx_exti.o
 .debug_info    0x000003d4      0x942 build/stm32f4xx_gpio.o
 .debug_info    0x00000d16     0x2699 build/stm32f4xx_tim.o
 .debug_info    0x000033af      0x1a5 build/stm32f4xx_it.o
 .debug_info    0x00003554      0x728 build/system_stm32f4xx.o
 .debug_info    0x00003c7c      0x1ec build/UserRegister.o
 .debug_info    0x00003e68     0x1023 build/main.o
 .debug_info    0x00004e8b     0x131f build/timer.o
 .debug_info    0x000061aa       0x22 build/startup_stm32f407xx.o

.debug_line     0x00000000     0x34f0
 *(.debug_line)
 .debug_line    0x00000000      0x34a build/stm32f4xx_exti.o
 .debug_line    0x0000034a      0x546 build/stm32f4xx_gpio.o
 .debug_line    0x00000890     0x18e7 build/stm32f4xx_tim.o
 .debug_line    0x00002177      0x220 build/stm32f4xx_it.o
 .debug_line    0x00002397      0x396 build/system_stm32f4xx.o
 .debug_line    0x0000272d      0x343 build/UserRegister.o
 .debug_line    0x00002a70      0x3e5 build/main.o
 .debug_line    0x00002e55      0x61d build/timer.o
 .debug_line    0x00003472       0x7e build/startup_stm32f407xx.o

.debug_frame    0x00000000      0xcbc
 *(.debug_frame)
 .debug_frame   0x00000000       0xa4 build/stm32f4xx_exti.o
 .debug_frame   0x000000a4      0x130 build/stm32f4xx_gpio.o
 .debug_frame   0x000001d4      0x728 build/stm32f4xx_tim.o
 .debug_frame   0x000008fc       0xac build/stm32f4xx_it.o
 .debug_frame   0x000009a8       0x58 build/system_stm32f4xx.o
 .debug_frame   0x00000a00       0x7c build/UserRegister.o
 .debug_frame   0x00000a7c       0xd4 build/main.o
 .debug_frame   0x00000b50      0x140 build/timer.o
 .debug_frame   0x00000c90       0x2c d:/software/environment/gnu_tool_arm_embedded/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-init.o)

/DISCARD/
 *(.ARM.exidx*)
 *(.gnu.debuglink*)
 *(.gnu.lto_*)
                [!provide]                PROVIDE (__heap_size = _Min_Heap_Size)
                [!provide]                PROVIDE (__stack_size = _Min_Stack_Size)
                [!provide]                PROVIDE (__heap_base = _ebss)
                [!provide]                PROVIDE (__heap_limit = (_ebss + _Min_Heap_Size))
OUTPUT(build/template.elf elf32-littlearm)

.debug_abbrev   0x00000000      0xfa7
 .debug_abbrev  0x00000000      0x239 build/stm32f4xx_exti.o
 .debug_abbrev  0x00000239      0x26f build/stm32f4xx_gpio.o
 .debug_abbrev  0x000004a8      0x226 build/stm32f4xx_tim.o
 .debug_abbrev  0x000006ce       0xbd build/stm32f4xx_it.o
 .debug_abbrev  0x0000078b      0x19c build/system_stm32f4xx.o
 .debug_abbrev  0x00000927      0x12c build/UserRegister.o
 .debug_abbrev  0x00000a53      0x327 build/main.o
 .debug_abbrev  0x00000d7a      0x21b build/timer.o
 .debug_abbrev  0x00000f95       0x12 build/startup_stm32f407xx.o

.debug_loc      0x00000000     0x27c5
 .debug_loc     0x00000000      0x181 build/stm32f4xx_exti.o
 .debug_loc     0x00000181      0x518 build/stm32f4xx_gpio.o
 .debug_loc     0x00000699     0x1c86 build/stm32f4xx_tim.o
 .debug_loc     0x0000231f       0x20 build/stm32f4xx_it.o
 .debug_loc     0x0000233f      0x1c4 build/system_stm32f4xx.o
 .debug_loc     0x00002503       0x67 build/UserRegister.o
 .debug_loc     0x0000256a      0x113 build/main.o
 .debug_loc     0x0000267d      0x148 build/timer.o

.debug_aranges  0x00000000      0x598
 .debug_aranges
                0x00000000       0x58 build/stm32f4xx_exti.o
 .debug_aranges
                0x00000058       0x88 build/stm32f4xx_gpio.o
 .debug_aranges
                0x000000e0      0x2f8 build/stm32f4xx_tim.o
 .debug_aranges
                0x000003d8       0x60 build/stm32f4xx_it.o
 .debug_aranges
                0x00000438       0x30 build/system_stm32f4xx.o
 .debug_aranges
                0x00000468       0x48 build/UserRegister.o
 .debug_aranges
                0x000004b0       0x58 build/main.o
 .debug_aranges
                0x00000508       0x68 build/timer.o
 .debug_aranges
                0x00000570       0x28 build/startup_stm32f407xx.o

.debug_ranges   0x00000000      0x510
 .debug_ranges  0x00000000       0x48 build/stm32f4xx_exti.o
 .debug_ranges  0x00000048       0x78 build/stm32f4xx_gpio.o
 .debug_ranges  0x000000c0      0x2e8 build/stm32f4xx_tim.o
 .debug_ranges  0x000003a8       0x50 build/stm32f4xx_it.o
 .debug_ranges  0x000003f8       0x20 build/system_stm32f4xx.o
 .debug_ranges  0x00000418       0x38 build/UserRegister.o
 .debug_ranges  0x00000450       0x48 build/main.o
 .debug_ranges  0x00000498       0x58 build/timer.o
 .debug_ranges  0x000004f0       0x20 build/startup_stm32f407xx.o

.debug_str      0x00000000     0x212b
 .debug_str     0x00000000      0x332 build/stm32f4xx_exti.o
                                0x391 (size before relaxing)
 .debug_str     0x00000332      0x31f build/stm32f4xx_gpio.o
                                0x4f5 (size before relaxing)
 .debug_str     0x00000651      0xbdb build/stm32f4xx_tim.o
                                0xe43 (size before relaxing)
 .debug_str     0x0000122c       0xbd build/stm32f4xx_it.o
                                0x269 (size before relaxing)
 .debug_str     0x000012e9      0x1e3 build/system_stm32f4xx.o
                                0x40b (size before relaxing)
 .debug_str     0x000014cc       0xaa build/UserRegister.o
                                0x256 (size before relaxing)
 .debug_str     0x00001576      0x4b0 build/main.o
                                0x7a6 (size before relaxing)
 .debug_str     0x00001a26      0x6d9 build/timer.o
                                0xdf9 (size before relaxing)
 .debug_str     0x000020ff       0x2c build/startup_stm32f407xx.o
                                 0x4a (size before relaxing)

.comment        0x00000000       0x79
 .comment       0x00000000       0x79 build/stm32f4xx_exti.o
                                 0x7a (size before relaxing)
 .comment       0x00000079       0x7a build/stm32f4xx_gpio.o
 .comment       0x00000079       0x7a build/stm32f4xx_tim.o
 .comment       0x00000079       0x7a build/stm32f4xx_it.o
 .comment       0x00000079       0x7a build/system_stm32f4xx.o
 .comment       0x00000079       0x7a build/UserRegister.o
 .comment       0x00000079       0x7a build/main.o
 .comment       0x00000079       0x7a build/timer.o

Cross Reference Table

FLASH物理地址(0x08000000开始)的映射关系

0x08000000 之前地址空间

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值