• text data bss dec 代表的含义


    Invoking: Print Size
    tc32-elf-size -t tl_zigbee_switch_k4.elf
       text	   data	    bss	    dec	    hex	filename
     195984	    576	  20200	 216760	  34eb8	tl_zigbee_switch_k4.elf
     195984	    576	  20200	 216760	  34eb8	(TOTALS)
    Finished building: sizedummy
    

      

    在stm32中flash就是ROM,掉电数据不会丢失;(通常保存着text段、Code、Ro-data、Rw-data)

    RAM就是运行内存,掉电数据就丢失;(通常保存着堆、栈、bss段、data段、ZI-data、RW-data)

    一.text

    ‘text’ is what ends up in FLASH memory. I can show this with adding

    text段最终是存放在FLASH存储器中的。通过增加如下代码到程序中:

    void foo(void) {
    
      /* dummy function to show how this adds to 'text' */
    
    }
       text	   data	    bss	    dec	    hex	filename
     195995	    576	  20200	 216760	  34eb8	tl_zigbee_switch_k4.elf
    

    但text段不仅包含函数,还有常量。例如我有如下的一个常量表:

    const int table[] = {5,0,1,5,6,7,9,10};
     
    二.data

    ‘data’ is used for initialized data. This is best explained with the following (global/extern) variable:

    data段是用于初始化数据。用如下的变量(全局/外部)可以解释得很清楚:

    int32_t myVar = 0x12345678;

    Adding above variable to my application will increase the ‘data’ portion by 4 bytes:

    加入上述变量会导致我的应用的data部分增长四个字节:

       text	   data	    bss	    dec	    hex	filename
     195995	    580	  20200	 216760	  34eb8	tl_zigbee_switch_k4.elf
    
    

    三.bss

    The ‘bss’ contains all the uninitalized data.

    bss段包含着所有未初始化的数据。

    bss (or .bss, or BSS) is the abbreviation for ‘Block Started by Symbol’ by an old assembler (see this link).

    bss(.bss, BSS ) 是旧式汇编器中‘Block Started by Symbol’的简称(详情参看 link)。

    This is best explained with following (global/extern) variable:

    用如下的变量(全局/外部)可以解释得很清楚:

    int32_t myGlobal;

    Adding this variable will increase the ‘bss’ portion by 4:

    加入上述变量会导致bss部分增长4个字节:

      text	   data	    bss	    dec	    hex	filename
     195995	    580	  20204	 216760	  34eb8	tl_zigbee_switch_k4.elf

    dec

    The ‘dec’ (as a decimal number) is the sum of text, data and bss:

    dec(decimal的缩写,即十进制数)是text,data和bss的算术和。

    dec = text + data + bss
  • 相关阅读:
    java数组的相关方法
    spring boot 文件目录
    mysql 数据库安装,datagrip安装,datagrip连接数据库
    linux maven 的安装与配置
    java String字符串常量常用方法
    java 命名规范
    deepin 安装open jdk
    jetbrains(idea,webstorm,pycharm,datagrip)修改背景,主题,添加特效,汉化
    JVM学习(九)volatile应用
    JVM学习(八)指令重排序
  • 原文地址:https://www.cnblogs.com/z3286586/p/14817832.html
Copyright © 2020-2023  润新知