apollo系列之apollo2 mcu开发(基础篇)之1.3-解析编译生成的IAR中的map文件

一、map文件的主信息

###############################################################################
#
# IAR ELF Linker V8.32.2.178/W32 for ARM                  12/Jan/2021  16:24:56
# Copyright 2007-2018 IAR Systems AB.
#
#    Output file  =  
#    ...\iar\bin\VoS_THF.out
#    Map file     =  
#      ...\iar\bin\VoS_THF.map
#    Command line =  
#     ...
#
###############################################################################


主要是文件路径,IAR的版本信息等。


二、运行模型属性(RUNTIME MODEL ATTRIBUTES)

*******************************************************************************
*** RUNTIME MODEL ATTRIBUTES
***
CppFlavor       = *
__Heap_Handler  = DLMalloc
__SystemLibrary = DLib
__dlib_version  = 6


运行模型属性:__Heap_Handler用的是DLMalloc,__SystemLibrarys DLib,__dlib_version版本是6


三、堆选择(HEAP SELECTION)

*******************************************************************************
*** HEAP SELECTION
***
The advanced heap was selected because the application calls memory
allocation functions outside of system library functions, and there
are calls to deallocation functions in the application.


之所以选择高级堆,是因为应用程序在系统库函数之外调用内存分配函数,并且应用程序中有对回收分配函数的调用。


四、

*******************************************************************************
*** PLACEMENT SUMMARY
***
"A0":  place at 0x0 { ro section .intvec };//A0段位于0,类型.intvec
"P1":  place in [from 0x0 to 0xf'ffff] { ro };//p1段位于0到0xfffff,类型ro
define block CSTACK with size = 1K, alignment = 8 { };//定义堆块1K,8字节对齐
define block HEAP with size = 2K, alignment = 8 { };//定义栈2K,8字节对齐
"P3":  place in [from 0x0 to 0x0] |
                [from 0x1000'0000 to 0x1003'ffff] {
          rw, block CSTACK, block HEAP };
do not initialize { section .noinit };
initialize by copy { rw };
No sections matched the following patterns:
  ro section application_specific_ro  in "P2|P4"
  rw section application_specific_rw  in "P2|P4"
  Section(段)       Kind(种类) Address     Size  Object(编译后的对象)
  -------            ----         -------     ----  ------
"A0":                                         0xc0
  .intvec            const            0x0     0xc0  startup_iar.o [1]
                                   - 0xc0     0xc0
"P1":                                      0x50573
  .rodata            const           0xc0  0x21778  cnn.o [5]//常量
  .rodata            const       0x2'1838  0x213f8  cnn_stage2.o [5]
  .text              ro code     0x4'2c30   0x22c0  am_hal_iom.o [6]//ro code 代码
  .text              ro code     0x4'4ef0      0x2  am_hal_debug.o [6]
  .text              ro code     0x4'4ef2     0x3a  zero_init3.o [9]
。。。
"P3", part 1 of 3:                           0x2ae
  P3 s0                       0x1000'0000    0x2ae  <Init block>
    .data            inited   0x1000'0000    0x134  am_hal_iom.o [6]//.data已经初始化数据
。。。
"P3", part 2 of 3:                         0x2d154//.bss 未初始化数据 为0
  .bss               zero     0x1000'02b0  0x1803c  am_audio_buffer.o [1]
  .bss               zero     0x1001'82ec  0x10018  heap_4.o [1]
。。。
P3", part 3 of 3:                          0x1000//未初始化
  .noinit            uninit   0x1002'd404   0x1000  startup_iar.o [1]
                            - 0x1002'e404   0x1000
Unused ranges://空闲范围
         From           To      Size
         ----           --      ----
     0x5'0633     0xf'ffff  0xa'f9cd//flash空闲地址段
  0x1000'02ae  0x1000'02af       0x2
  0x1002'e404  0x1003'ffff  0x1'1bfc


总结:

1.  Section(段)       Kind(种类) Address(地址)     Size(大小)  Object(编译后的对象)


2..rodata:常量


3.text:代码段


4..bss:BSS段(bss segment)通常是指用来存放程序中未初始化的或者初始值为0的全局变量的一块内存区域。BSS是英文Block Started by Symbol的简称。BSS段属于静态内存分配。


5.noinit:未初始化部分


6..data:已初始化



四、初始化列表(INIT TABLE)

*******************************************************************************
*** INIT TABLE
***
          Address      Size
          -------      ----
Zero (__iar_zero_init3)
    1 destination range, total size 0x2d153:
          0x1000'02b0  0x2d153
Copy/packbits (__iar_packbits_init3)
    1 source range, total size 0xef (34% of destination):
             0x5'0544     0xef
    1 destination range, total size 0x2ae:
          0x1000'0000    0x2ae
五、模块概述(MODULE SUMMARY)
*******************************************************************************
*** MODULE SUMMARY
***
    Module                              ro code  ro data  rw data
    ------                              -------  -------  -------
command line/config:
    -------------------------------------------------------------
    Total:
 am_app_KWD_audio.o                      248               328
 am_app_KWD_board_setup.o              1 508       95       20
 am_app_KWD_init.o                       136      152    1 111
 am_app_KWD_isr.o                        352                 1
...
  -------------------------------------------------------------
    Total:                               12 460      450  173 255
...
-----------------------------------------------------------------
    Grand Total:                         50 710  278 557  189 441
这部分主要描述文件库ro代码大小,ro rw数据大小。


六、入口列表(ENTRY LIST)

*******************************************************************************
*** ENTRY LIST
***
Entry                       Address     Size  Type      Object
-----                       -------     ----  ----      ------
.iar.init_table$$Base      0x5'04b4            --   Gb  - Linker created -
.iar.init_table$$Limit     0x5'04e0            --   Gb  - Linker created -
?main                      0x5'04e1           Code  Gb  cmain.o [9]
GPIO_Init                  0x4'a79f    0x288  Code  Lc  am_app_KWD_board_setup.o [1]
。。。
   50 710 bytes of readonly  code memory//只读属性,代码内存,存储在flahs中
  278 557 bytes of readonly  data memory//只读变量内存,存储在flash中
  189 441 bytes of readwrite data memory//可读可写变量内存


总结:

1.?main,全局函数入口,地址0x504e1,存储在flash中


2.Code Gb,代码段,全局函数


3.Code LC,局部函数


4.Data  Lc,局部变量


5.Data  Gb,全局变量


Flash = readonly code memory + readonly data memory

RAM = readwrite data memory


上一篇:使用nginx反向代理实现多端口映射(未解决)


下一篇:如何手动创建SAP S/4HANA的生产订单