STM32 分析启动代码

折月煮酒 提交于 2020-02-03 11:02:25
0x08000000 0408      DCW      0x0408
0x08000002 2000      DCW      0x2000
0x08000004 0059      DCW      0x0059
0x08000006 0800      DCW      0x0800
0x08000008 00AF      DCW      0x00AF
0x0800000A 0800      DCW      0x0800
0x0800000C 00A7      DCW      0x00A7
0x0800000E 0800      DCW      0x0800
0x08000010 00AB      DCW      0x00AB
0x08000012 0800      DCW      0x0800
0x08000014 00A1      DCW      0x00A1
0x08000016 0800      DCW      0x0800
0x08000018 00C9      DCW      0x00C9
0x0800001A 0800      DCW      0x0800
0x0800001C 0000      DCW      0x0000
0x0800001E 0000      DCW      0x0000
0x08000020 0000      DCW      0x0000
0x08000022 0000      DCW      0x0000
0x08000024 0000      DCW      0x0000
0x08000026 0000      DCW      0x0000
0x08000028 0000      DCW      0x0000
0x0800002A 0000      DCW      0x0000
0x0800002C 00B3      DCW      0x00B3
0x0800002E 0800      DCW      0x0800
0x08000030 00A5      DCW      0x00A5
0x08000032 0800      DCW      0x0800
0x08000034 0000      DCW      0x0000
0x08000036 0000      DCW      0x0000
0x08000038 00B1      DCW      0x00B1
0x0800003A 0800      DCW      0x0800
0x0800003C 0071      DCW      0x0071
0x0800003E 0800      DCW      0x0800
0x08000040 0073      DCW      0x0073
0x08000042 0800      DCW      0x0800
                 __main:
0x08000044 F8DFD00C  LDR.W    sp,[pc,#12]  ; @0x08000054
                 _main_scatterload:
0x08000048 F000F818  BL.W     __scatterload (0x0800007C)
                 __main_after_scatterload:
0x0800004C 4800      LDR      r0,[pc,#0]  ; @0x08000050
0x0800004E 4700      BX       r0
0x08000050 00ED      DCW      0x00ED
0x08000052 0800      DCW      0x0800
                 __rt_final_cpp:
0x08000054 0408      DCW      0x0408
0x08000056 2000      DCW      0x2000
                 Reset_Handler:
0x08000058 4806      LDR      r0,[pc,#24]  ; @0x08000074
0x0800005A 4780      BLX      r0
0x0800005C 4806      LDR      r0,[pc,#24]  ; @0x08000078
0x0800005E 4700      BX       r0
                 NMI_Handler:
0x08000060 E7FE      B        NMI_Handler (0x08000060)
                 HardFault_Handler:
0x08000062 E7FE      B        HardFault_Handler (0x08000062)
                 MemManage_Handler:
0x08000064 E7FE      B        MemManage_Handler (0x08000064)
                 BusFault_Handler:
0x08000066 E7FE      B        BusFault_Handler (0x08000066)
                 UsageFault_Handler:
0x08000068 E7FE      B        UsageFault_Handler (0x08000068)
                 SVC_Handler:
0x0800006A E7FE      B        SVC_Handler (0x0800006A)
                 DebugMon_Handler:
0x0800006C E7FE      B        DebugMon_Handler (0x0800006C)
                 PendSV_Handler:
0x0800006E E7FE      B        PendSV_Handler (0x0800006E)
                 SysTick_Handler:
0x08000070 E7FE      B        SysTick_Handler (0x08000070)
                 Default_Handler:
0x08000072 E7FE      B        Default_Handler (0x08000072)
0x08000074 00B5      DCW      0x00B5
0x08000076 0800      DCW      0x0800
0x08000078 0045      DCW      0x0045
0x0800007A 0800      DCW      0x0800
                 __scatterload:
0x0800007C 4C06      LDR      r4,[pc,#24]  ; @0x08000098
0x0800007E 4D07      LDR      r5,[pc,#28]  ; @0x0800009C
0x08000080 E006      B        0x08000090
0x08000082 68E0      LDR      r0,[r4,#0x0C]
0x08000084 F0400301  ORR      r3,r0,#0x01
0x08000088 E8940007  LDM      r4,{r0-r2}
0x0800008C 4798      BLX      r3
0x0800008E 3410      ADDS     r4,r4,#0x10
0x08000090 42AC      CMP      r4,r5
0x08000092 D3F6      BCC      0x08000082
0x08000094 F7FFFFDA  BL.W     __main_after_scatterload (0x0800004C)
0x08000098 0108      DCW      0x0108
0x0800009A 0800      DCW      0x0800
0x0800009C 0128      DCW      0x0128
0x0800009E 0800      DCW      0x0800
                 BusFault_Handler:
0x080000A0 BF00      NOP      
0x080000A2 E7FE      B        0x080000A2
                 DebugMon_Handler:
0x080000A4 4770      BX       lr
                 HardFault_Handler:
0x080000A6 BF00      NOP      
0x080000A8 E7FE      B        0x080000A8
                 MemManage_Handler:
0x080000AA BF00      NOP      
0x080000AC E7FE      B        0x080000AC
                 NMI_Handler:
0x080000AE 4770      BX       lr
                 PendSV_Handler:
0x080000B0 4770      BX       lr
                 SVC_Handler:
0x080000B2 4770      BX       lr
                 SystemInit:
0x080000B4 4803      LDR      r0,[pc,#12]  ; @0x080000C4
0x080000B6 6800      LDR      r0,[r0,#0x00]
0x080000B8 F0400001  ORR      r0,r0,#0x01
0x080000BC 4901      LDR      r1,[pc,#4]  ; @0x080000C4
0x080000BE 6008      STR      r0,[r1,#0x00]
0x080000C0 4770      BX       lr
0x080000C2 0000      DCW      0x0000
0x080000C4 1000      DCW      0x1000
0x080000C6 4002      DCW      0x4002
                 UsageFault_Handler:
0x080000C8 BF00      NOP      
0x080000CA E7FE      B        0x080000CA
                 __scatterload_copy:
0x080000CC E002      B        0x080000D4
0x080000CE C808      LDM      r0!,{r3}
0x080000D0 1F12      SUBS     r2,r2,#4
0x080000D2 C108      STM      r1!,{r3}
0x080000D4 2A00      CMP      r2,#0x00
0x080000D6 D1FA      BNE      0x080000CE
0x080000D8 4770      BX       lr
                 __scatterload_null:
0x080000DA 4770      BX       lr
                 __scatterload_zeroinit:
0x080000DC 2000      MOVS     r0,#0x00
0x080000DE E001      B        0x080000E4
0x080000E0 C101      STM      r1!,{r0}
0x080000E2 1F12      SUBS     r2,r2,#4
0x080000E4 2A00      CMP      r2,#0x00
0x080000E6 D1FB      BNE      0x080000E0
0x080000E8 4770      BX       lr
0x080000EA 0000      MOVS     r0,r0
                 main:
0x080000EC 4805      LDR      r0,[pc,#20]  ; @0x08000104
0x080000EE 6800      LDR      r0,[r0,#0x00]
0x080000F0 1C40      ADDS     r0,r0,#1
0x080000F2 4904      LDR      r1,[pc,#16]  ; @0x08000104
0x080000F4 6008      STR      r0,[r1,#0x00]
0x080000F6 E004      B        0x08000102
0x080000F8 4802      LDR      r0,[pc,#8]  ; @0x08000104
0x080000FA 6800      LDR      r0,[r0,#0x00]
0x080000FC 1C40      ADDS     r0,r0,#1
0x080000FE 4901      LDR      r1,[pc,#4]  ; @0x08000104
0x08000100 6008      STR      r0,[r1,#0x00]
0x08000102 E7F9      B        0x080000F8
0x08000104 0000      DCW      0x0000
0x08000106 2000      DCW      0x2000
0x08000108 0128      DCW      0x0128
0x0800010A 0800      DCW      0x0800
0x0800010C 0000      DCW      0x0000
0x0800010E 2000      DCW      0x2000
0x08000110 0004      DCW      0x0004
0x08000112 0000      DCW      0x0000
0x08000114 00CC      DCW      0x00CC
0x08000116 0800      DCW      0x0800
0x08000118 012C      DCW      0x012C
0x0800011A 0800      DCW      0x0800
0x0800011C 0004      DCW      0x0004
0x0800011E 2000      DCW      0x2000
0x08000120 0404      DCW      0x0404
0x08000122 0000      DCW      0x0000
0x08000124 00DC      DCW      0x00DC
0x08000126 0800      DCW      0x0800

Rebuild target 'prj'
compiling core_cm3.c...
compiling stm32f10x_it.c...
compiling system_stm32f10x.c...
user\system_stm32f10x.c(76): warning:  #111-D: statement is unreachable
    RCC->CFGR &= (uint32_t)0xF8FF0000;
user\system_stm32f10x.c: 1 warning, 0 errors
assembling mystartup.s...
compiling main.c...
compiling go.c...
linking...
Program Size: Code=196 RO-data=100 RW-data=4 ZI-data=1028  
FromELF: creating hex file...
".\OBJ\output.axf" - 0 Error(s), 1 Warning(s).

ARM Linker, 5.03 [Build 76] [MDK-ARM Standard]

==============================================================================

Section Cross References

    system_stm32f10x.o(i.SetSysClock) refers to system_stm32f10x.o(i.SetSysClockTo72) for SetSysClockTo72
    system_stm32f10x.o(i.SystemCoreClockUpdate) refers to system_stm32f10x.o(.data) for SystemCoreClock
    mystartup.o(RESET) refers to mystartup.o(STACK) for __initial_sp
    mystartup.o(RESET) refers to mystartup.o(.text) for Reset_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.NMI_Handler) for NMI_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.HardFault_Handler) for HardFault_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.MemManage_Handler) for MemManage_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.BusFault_Handler) for BusFault_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.UsageFault_Handler) for UsageFault_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.SVC_Handler) for SVC_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.DebugMon_Handler) for DebugMon_Handler
    mystartup.o(RESET) refers to stm32f10x_it.o(i.PendSV_Handler) for PendSV_Handler
    mystartup.o(.text) refers to system_stm32f10x.o(i.SystemInit) for SystemInit
    mystartup.o(.text) refers to entry.o(.ARM.Collect$$$$00000000) for __main
    main.o(i.main) refers to main.o(.data) for var_m
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry10a.o(.ARM.Collect$$$$0000000D) for __rt_final_cpp
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry11a.o(.ARM.Collect$$$$0000000F) for __rt_final_exit
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry7b.o(.ARM.Collect$$$$00000008) for _main_clock
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry8b.o(.ARM.Collect$$$$0000000A) for _main_cpp_init
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry9a.o(.ARM.Collect$$$$0000000B) for _main_init
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry5.o(.ARM.Collect$$$$00000004) for _main_scatterload
    entry.o(.ARM.Collect$$$$00000000) refers (Special) to entry2.o(.ARM.Collect$$$$00000001) for _main_stk
    entry2.o(.ARM.Collect$$$$00000001) refers to entry2.o(.ARM.Collect$$$$00002712) for __lit__00000000
    entry2.o(.ARM.Collect$$$$00002712) refers to mystartup.o(STACK) for __initial_sp
    entry2.o(__vectab_stack_and_reset_area) refers to mystartup.o(STACK) for __initial_sp
    entry2.o(__vectab_stack_and_reset_area) refers to entry.o(.ARM.Collect$$$$00000000) for __main
    entry5.o(.ARM.Collect$$$$00000004) refers to init.o(.text) for __scatterload
    entry9a.o(.ARM.Collect$$$$0000000B) refers to main.o(i.main) for main
    entry9b.o(.ARM.Collect$$$$0000000C) refers to main.o(i.main) for main
    init.o(.text) refers to entry5.o(.ARM.Collect$$$$00000004) for __main_after_scatterload


==============================================================================

Removing Unused input sections from the image.

    Removing core_cm3.o(.emb_text), (32 bytes).
    Removing system_stm32f10x.o(i.SetSysClock), (8 bytes).
    Removing system_stm32f10x.o(i.SetSysClockTo72), (220 bytes).
    Removing system_stm32f10x.o(i.SystemCoreClockUpdate), (164 bytes).
    Removing system_stm32f10x.o(.data), (20 bytes).
    Removing mystartup.o(HEAP), (512 bytes).
    Removing go.o(.data), (4 bytes).

7 unused section(s) (total 960 bytes) removed from the image.

==============================================================================

Image Symbol Table

    Local Symbols

    Symbol Name                              Value     Ov Type        Size  Object(Section)

    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry11a.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry11b.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry10b.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry10a.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry9b.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry9a.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry8b.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry8a.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry7a.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry5.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry7b.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry.o ABSOLUTE
    ../clib/microlib/init/entry.s            0x00000000   Number         0  entry2.o ABSOLUTE
    dc.s                                     0x00000000   Number         0  dc.o ABSOLUTE
    handlers.s                               0x00000000   Number         0  handlers.o ABSOLUTE
    init.s                                   0x00000000   Number         0  init.o ABSOLUTE
    user\\core_cm3.c                         0x00000000   Number         0  core_cm3.o ABSOLUTE
    user\core_cm3.c                          0x00000000   Number         0  core_cm3.o ABSOLUTE
    user\go.c                                0x00000000   Number         0  go.o ABSOLUTE
    user\main.c                              0x00000000   Number         0  main.o ABSOLUTE
    user\mystartup.s                         0x00000000   Number         0  mystartup.o ABSOLUTE
    user\stm32f10x_it.c                      0x00000000   Number         0  stm32f10x_it.o ABSOLUTE
    user\system_stm32f10x.c                  0x00000000   Number         0  system_stm32f10x.o ABSOLUTE
    RESET                                    0x08000000   Section       68  mystartup.o(RESET)
    .ARM.Collect$$$$00000000                 0x08000044   Section        0  entry.o(.ARM.Collect$$$$00000000)
    .ARM.Collect$$$$00000001                 0x08000044   Section        4  entry2.o(.ARM.Collect$$$$00000001)
    .ARM.Collect$$$$00000004                 0x08000048   Section        4  entry5.o(.ARM.Collect$$$$00000004)
    .ARM.Collect$$$$00000008                 0x0800004c   Section        0  entry7b.o(.ARM.Collect$$$$00000008)
    .ARM.Collect$$$$0000000A                 0x0800004c   Section        0  entry8b.o(.ARM.Collect$$$$0000000A)
    .ARM.Collect$$$$0000000B                 0x0800004c   Section        8  entry9a.o(.ARM.Collect$$$$0000000B)
    .ARM.Collect$$$$0000000D                 0x08000054   Section        0  entry10a.o(.ARM.Collect$$$$0000000D)
    .ARM.Collect$$$$0000000F                 0x08000054   Section        0  entry11a.o(.ARM.Collect$$$$0000000F)
    .ARM.Collect$$$$00002712                 0x08000054   Section        4  entry2.o(.ARM.Collect$$$$00002712)
    __lit__00000000                          0x08000054   Data           4  entry2.o(.ARM.Collect$$$$00002712)
    .text                                    0x08000058   Section       36  mystartup.o(.text)
    .text                                    0x0800007c   Section       36  init.o(.text)
    i.BusFault_Handler                       0x080000a0   Section        0  stm32f10x_it.o(i.BusFault_Handler)
    i.DebugMon_Handler                       0x080000a4   Section        0  stm32f10x_it.o(i.DebugMon_Handler)
    i.HardFault_Handler                      0x080000a6   Section        0  stm32f10x_it.o(i.HardFault_Handler)
    i.MemManage_Handler                      0x080000aa   Section        0  stm32f10x_it.o(i.MemManage_Handler)
    i.NMI_Handler                            0x080000ae   Section        0  stm32f10x_it.o(i.NMI_Handler)
    i.PendSV_Handler                         0x080000b0   Section        0  stm32f10x_it.o(i.PendSV_Handler)
    i.SVC_Handler                            0x080000b2   Section        0  stm32f10x_it.o(i.SVC_Handler)
    i.SystemInit                             0x080000b4   Section        0  system_stm32f10x.o(i.SystemInit)
    i.UsageFault_Handler                     0x080000c8   Section        0  stm32f10x_it.o(i.UsageFault_Handler)
    i.__scatterload_copy                     0x080000cc   Section       14  handlers.o(i.__scatterload_copy)
    i.__scatterload_null                     0x080000da   Section        2  handlers.o(i.__scatterload_null)
    i.__scatterload_zeroinit                 0x080000dc   Section       14  handlers.o(i.__scatterload_zeroinit)
    i.main                                   0x080000ec   Section        0  main.o(i.main)
    .data                                    0x20000000   Section        4  main.o(.data)
    STACK                                    0x20000008   Section     1024  mystartup.o(STACK)

    Global Symbols

    Symbol Name                              Value     Ov Type        Size  Object(Section)

    BuildAttributes$$THM_ISAv4$P$D$K$B$S$PE$A:L22UL41UL21$X:L11$S22US41US21$IEEE1$IW$USESV6$~STKCKD$USESV7$~SHL$OSPACE$EBA8$MICROLIB$REQ8$PRES8$EABIv2 0x00000000   Number         0  anon$$obj.o ABSOLUTE
    __ARM_use_no_argv                        0x00000000   Number         0  main.o ABSOLUTE
    __cpp_initialize__aeabi_                  - Undefined Weak Reference
    __cxa_finalize                            - Undefined Weak Reference
    __decompress                              - Undefined Weak Reference
    _clock_init                               - Undefined Weak Reference
    _microlib_exit                            - Undefined Weak Reference
    __Vectors_Size                           0x00000044   Number         0  mystartup.o ABSOLUTE
    __Vectors                                0x08000000   Data           4  mystartup.o(RESET)
    __Vectors_End                            0x08000044   Data           0  mystartup.o(RESET)
    __main                                   0x08000045   Thumb Code     0  entry.o(.ARM.Collect$$$$00000000)
    _main_stk                                0x08000045   Thumb Code     0  entry2.o(.ARM.Collect$$$$00000001)
    _main_scatterload                        0x08000049   Thumb Code     0  entry5.o(.ARM.Collect$$$$00000004)
    __main_after_scatterload                 0x0800004d   Thumb Code     0  entry5.o(.ARM.Collect$$$$00000004)
    _main_clock                              0x0800004d   Thumb Code     0  entry7b.o(.ARM.Collect$$$$00000008)
    _main_cpp_init                           0x0800004d   Thumb Code     0  entry8b.o(.ARM.Collect$$$$0000000A)
    _main_init                               0x0800004d   Thumb Code     0  entry9a.o(.ARM.Collect$$$$0000000B)
    __rt_final_cpp                           0x08000055   Thumb Code     0  entry10a.o(.ARM.Collect$$$$0000000D)
    __rt_final_exit                          0x08000055   Thumb Code     0  entry11a.o(.ARM.Collect$$$$0000000F)
    Reset_Handler                            0x08000059   Thumb Code     8  mystartup.o(.text)
    SysTick_Handler                          0x08000071   Thumb Code     2  mystartup.o(.text)
    WWDG_IRQHandler                          0x08000073   Thumb Code     0  mystartup.o(.text)
    __scatterload                            0x0800007d   Thumb Code    28  init.o(.text)
    __scatterload_rt2                        0x0800007d   Thumb Code     0  init.o(.text)
    BusFault_Handler                         0x080000a1   Thumb Code     4  stm32f10x_it.o(i.BusFault_Handler)
    DebugMon_Handler                         0x080000a5   Thumb Code     2  stm32f10x_it.o(i.DebugMon_Handler)
    HardFault_Handler                        0x080000a7   Thumb Code     4  stm32f10x_it.o(i.HardFault_Handler)
    MemManage_Handler                        0x080000ab   Thumb Code     4  stm32f10x_it.o(i.MemManage_Handler)
    NMI_Handler                              0x080000af   Thumb Code     2  stm32f10x_it.o(i.NMI_Handler)
    PendSV_Handler                           0x080000b1   Thumb Code     2  stm32f10x_it.o(i.PendSV_Handler)
    SVC_Handler                              0x080000b3   Thumb Code     2  stm32f10x_it.o(i.SVC_Handler)
    SystemInit                               0x080000b5   Thumb Code    14  system_stm32f10x.o(i.SystemInit)
    UsageFault_Handler                       0x080000c9   Thumb Code     4  stm32f10x_it.o(i.UsageFault_Handler)
    __scatterload_copy                       0x080000cd   Thumb Code    14  handlers.o(i.__scatterload_copy)
    __scatterload_null                       0x080000db   Thumb Code     2  handlers.o(i.__scatterload_null)
    __scatterload_zeroinit                   0x080000dd   Thumb Code    14  handlers.o(i.__scatterload_zeroinit)
    main                                     0x080000ed   Thumb Code    24  main.o(i.main)
    Region$$Table$$Base                      0x08000108   Number         0  anon$$obj.o(Region$$Table)
    Region$$Table$$Limit                     0x08000128   Number         0  anon$$obj.o(Region$$Table)
    var_m                                    0x20000000   Data           4  main.o(.data)
    __initial_sp                             0x20000408   Data           0  mystartup.o(STACK)



==============================================================================

Memory Map of the image

  Image Entry point : 0x08000045

  Load Region LR_IROM1 (Base: 0x08000000, Size: 0x0000012c, Max: 0x00100000, ABSOLUTE)

    Execution Region ER_IROM1 (Base: 0x08000000, Size: 0x00000128, Max: 0x00100000, ABSOLUTE)

    Base Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x08000000   0x00000044   Data   RO          117    RESET               mystartup.o
    0x08000044   0x00000000   Code   RO          140  * .ARM.Collect$$$$00000000  mc_w.l(entry.o)
    0x08000044   0x00000004   Code   RO          143    .ARM.Collect$$$$00000001  mc_w.l(entry2.o)
    0x08000048   0x00000004   Code   RO          146    .ARM.Collect$$$$00000004  mc_w.l(entry5.o)
    0x0800004c   0x00000000   Code   RO          148    .ARM.Collect$$$$00000008  mc_w.l(entry7b.o)
    0x0800004c   0x00000000   Code   RO          150    .ARM.Collect$$$$0000000A  mc_w.l(entry8b.o)
    0x0800004c   0x00000008   Code   RO          151    .ARM.Collect$$$$0000000B  mc_w.l(entry9a.o)
    0x08000054   0x00000000   Code   RO          153    .ARM.Collect$$$$0000000D  mc_w.l(entry10a.o)
    0x08000054   0x00000000   Code   RO          155    .ARM.Collect$$$$0000000F  mc_w.l(entry11a.o)
    0x08000054   0x00000004   Code   RO          144    .ARM.Collect$$$$00002712  mc_w.l(entry2.o)
    0x08000058   0x00000024   Code   RO          118    .text               mystartup.o
    0x0800007c   0x00000024   Code   RO          157    .text               mc_w.l(init.o)
    0x080000a0   0x00000004   Code   RO           17    i.BusFault_Handler  stm32f10x_it.o
    0x080000a4   0x00000002   Code   RO           18    i.DebugMon_Handler  stm32f10x_it.o
    0x080000a6   0x00000004   Code   RO           19    i.HardFault_Handler  stm32f10x_it.o
    0x080000aa   0x00000004   Code   RO           20    i.MemManage_Handler  stm32f10x_it.o
    0x080000ae   0x00000002   Code   RO           21    i.NMI_Handler       stm32f10x_it.o
    0x080000b0   0x00000002   Code   RO           22    i.PendSV_Handler    stm32f10x_it.o
    0x080000b2   0x00000002   Code   RO           23    i.SVC_Handler       stm32f10x_it.o
    0x080000b4   0x00000014   Code   RO           71    i.SystemInit        system_stm32f10x.o
    0x080000c8   0x00000004   Code   RO           24    i.UsageFault_Handler  stm32f10x_it.o
    0x080000cc   0x0000000e   Code   RO          161    i.__scatterload_copy  mc_w.l(handlers.o)
    0x080000da   0x00000002   Code   RO          162    i.__scatterload_null  mc_w.l(handlers.o)
    0x080000dc   0x0000000e   Code   RO          163    i.__scatterload_zeroinit  mc_w.l(handlers.o)
    0x080000ea   0x00000002   PAD
    0x080000ec   0x0000001c   Code   RO          122    i.main              main.o
    0x08000108   0x00000020   Data   RO          159    Region$$Table       anon$$obj.o


    Execution Region RW_IRAM1 (Base: 0x20000000, Size: 0x00000408, Max: 0x00017f00, ABSOLUTE)

    Base Addr    Size         Type   Attr      Idx    E Section Name        Object

    0x20000000   0x00000004   Data   RW          123    .data               main.o
    0x20000004   0x00000004   PAD
    0x20000008   0x00000400   Zero   RW          115    STACK               mystartup.o


==============================================================================

Image component sizes


      Code (inc. data)   RO Data    RW Data    ZI Data      Debug   Object Name

         0          0          0          0          0       1476   core_cm3.o
        28          4          0          4          0        499   main.o
        36          8         68          0       1024        692   mystartup.o
        24          0          0          0          0       2788   stm32f10x_it.o
        20          6          0          0          0        357   system_stm32f10x.o

    ----------------------------------------------------------------------
       108         18        100          4       1028       5812   Object Totals
         0          0         32          0          0          0   (incl. Generated)
         0          0          0          0          4          0   (incl. Padding)

    ----------------------------------------------------------------------

      Code (inc. data)   RO Data    RW Data    ZI Data      Debug   Library Member Name

         0          0          0          0          0          0   entry.o
         0          0          0          0          0          0   entry10a.o
         0          0          0          0          0          0   entry11a.o
         8          4          0          0          0          0   entry2.o
         4          0          0          0          0          0   entry5.o
         0          0          0          0          0          0   entry7b.o
         0          0          0          0          0          0   entry8b.o
         8          4          0          0          0          0   entry9a.o
        30          0          0          0          0          0   handlers.o
        36          8          0          0          0         68   init.o

    ----------------------------------------------------------------------
        88         16          0          0          0         68   Library Totals
         2          0          0          0          0          0   (incl. Padding)

    ----------------------------------------------------------------------

      Code (inc. data)   RO Data    RW Data    ZI Data      Debug   Library Name

        86         16          0          0          0         68   mc_w.l

    ----------------------------------------------------------------------
        88         16          0          0          0         68   Library Totals

    ----------------------------------------------------------------------

==============================================================================


      Code (inc. data)   RO Data    RW Data    ZI Data      Debug   

       196         34        100          4       1028       5412   Grand Totals
       196         34        100          4       1028       5412   ELF Image Totals
       196         34        100          4          0          0   ROM Totals

==============================================================================

    Total RO  Size (Code + RO Data)                  296 (   0.29kB)
    Total RW  Size (RW Data + ZI Data)              1032 (   1.01kB)
    Total ROM Size (Code + RO Data + RW Data)        300 (   0.29kB)

==============================================================================

 

;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name          : startup_stm32f10x_xl.s
;* Author             : MCD Application Team
;* Version            : V3.5.0
;* Date               : 11-March-2011
;* Description        : STM32F10x XL-Density 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 and also configure the external 
;*                        SRAM mounted on STM3210E-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 CortexM3 processor is in Thread mode,
;*                      priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>>   
;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;*******************************************************************************

; 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                  1;
                DCD     HardFault_Handler          ; Hard Fault Handler           2;
                DCD     MemManage_Handler          ; MPU Fault Handler            3;
                DCD     BusFault_Handler           ; Bus Fault Handler            4;
                DCD     UsageFault_Handler         ; Usage Fault Handler          5;
                DCD     0                          ; Reserved                     6;
                DCD     0                          ; Reserved                     7;
                DCD     0                          ; Reserved                     8;
                DCD     0                          ; Reserved                     9;
                DCD     SVC_Handler                ; SVCall Handler               10;
                DCD     DebugMon_Handler           ; Debug Monitor Handler        11;
                DCD     0                          ; Reserved                     12;
                DCD     PendSV_Handler             ; PendSV Handler               13;
                DCD     SysTick_Handler            ; SysTick Handler              14;

                ; External Interrupts
                DCD     WWDG_IRQHandler               ; Window Watchdog
                ;DCD     PVD_IRQHandler                ; PVD through EXTI Line detect
__Vectors_End

__Vectors_Size  EQU  __Vectors_End - __Vectors

                AREA    |.text|, CODE, READONLY
                
; Reset handler
Reset_Handler   PROC
                EXPORT  Reset_Handler             [WEAK]
                IMPORT  __main
                IMPORT  SystemInit
                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]
WWDG_IRQHandler
;PVD_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

;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****

知识点

1/问:MAP发现仅仅定义一个变量,这个变量占用4个字节,那么为什么HEX刚开始显示SP值0X20000408?

答:看启动代码ALIGN=3 就是说8字节对齐。就是说即便定义两个4字节的变量,SP值仍然会是0X20000408,倘若定义三个4字节的变量,则SP值0X2000040C.

2/问:RWdata会占用ROM么?举例说明?

答:因为RW就是含有初值的变量。那么初值会放在哪里呢?一定是在编译阶段,编译器会安排在ROM里啊。然后运行的时候取出来。所以答案是会占用。如HEX文件的最后一行 0X800128的位置就是本程序唯一的变量的初值。

 3/问:用MDK查看汇编时候要注意什么?

答:用ASSEMBLY MODE

4/问:buid output界面的CODE =196是怎么算出来的?

答:能口算出ZI RO RW就可以了。由于涉及到microlib库,口算出CODE SIZE还是比较困难的。没必要纠结!

5:/问:执行流程?

答:如下

(01)读取可执行文件HEX的刚开始8个字节,分别赋值给SP和PC。这个PC值就是Reset_HandLer所在的位置。
(02)SystemInit
(03)__main
 (04) _main_scatterload
 (05) __scatterload
 (06) __scatterload_copy
 (07) __scatterload
 (08) __scaatterload_zeroinit
 (09)__scatterload
(10)__main_after_scatterload
 (11) main

   6/问:工程在哪里MDK工程呢?

答:https://download.csdn.net/download/unsv29/12131763

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!