question about size of hex file in flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

question about size of hex file in flash

1,474 Views
yangbo1
Contributor III

How to know how many bytes the hex file would take in flash after burning down? I use codewarrior10.6.4.

Thank you for your attention.

Labels (1)
0 Kudos
3 Replies

1,347 Views
BlackNight
NXP Employee
NXP Employee

You get the size with the GNU size utility, see text, data and bss: Code and Data Size Explained | MCU on Eclipse 

I hope this helps,

Erich

1,347 Views
yangbo1
Contributor III

Thank you. The direction of link is detailed. It is useful.

I want to have a further more discussion. In my project, size format is 'SysV' in eclipse panel, the compiling result is as below:

.interrupts               0xc0        0x0
.cfmprotect             0x10        0x400
.text                        0x2834    0x800
.data                       0x4          0x1ffff000
.bss                        0x144      0x1ffff004
.romp                      0x18       0x1ffff148
._user_heap_stack 0x200     0x1ffff160
.ARM.attributes       0x31       0x0

size format is 'Berkeley' in eclipse panel, the result is as below:

   text    data    bss    dec    hex
0x2904 0x1c 0x344 11364 2c64

It seems .romp is count as data by gcc compiler, it is in RAM, but not in flash.

I think all the text and data should be save in flash at the beginning, because everything will disappear in RAM after power down.

The real space used in flash is 11364. Is there anything wrong with me?

0 Kudos

1,347 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mike,

"I think all the text and data should be save in flash at the beginning, "

-> YES, the "text +data" will be download into flash.

"The real space used in flash is 11364."

->Exactly, the size in flash is 0x2920 (0x2904+0x1c), not includes bss. As  the blog of Erich said"As bss ends up in RAM". Also you can check your hex file to calculate the flash size used, the data in hex file is all the data will be download into flash.

How to generate S-record or hex file , you can refer to Erich another bolg:

S-Record Generation with gcc for ARM/Kinetis | MCU on Eclipse 


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos