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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM