Large binary size of RTCS examples

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

Large binary size of RTCS examples

Jump to solution
767 Views
thom_nic
Contributor II

Hi folks,

 

I'm getting started with the KSDK 1.2, trying to get some of the RTCS examples running on my FRDM-k64f board.  I built the examples with ARMGCC and the resulting elf files are really big - 1.5MB or more which seems unusually large for a simple example.  Doesn't the K64 only have 1MB of program space?  Additionally, I tried to flash one of the binaries on to the k64 board with pyOCD and it seemed to take a very long time.  Any idea what's going on here?

 

-rwxr-xr-x  1 thom  staff   1.6M May 22 10:10 ./httpsrv/build/armgcc/httpsrv_frdmk64f/int flash debug/httpsrv.elf -rwxr-xr-x  1 thom  staff   1.5M May 22 10:11 ./httpsrv/build/armgcc/httpsrv_frdmk64f/int flash release/httpsrv.elf -rwxr-xr-x  1 thom  staff   2.2M May 26 08:40 ./shell/build/armgcc/shell_frdmk64f/int flash debug/shell.elf -rwxr-xr-x  1 thom  staff   2.3M May 26 08:41 ./shell/build/armgcc/shell_frdmk64f/int flash release/shell.elf -rwxr-xr-x  1 thom  staff   1.5M May 26 08:36 ./snmp/build/armgcc/snmp_frdmk64f/int flash debug/snmp.elf -rwxr-xr-x  1 thom  staff   1.4M May 26 08:37 ./snmp/build/armgcc/snmp_frdmk64f/int flash release/snmp.elf 
Labels (1)
Tags (3)
0 Kudos
1 Solution
603 Views
DavidS
NXP Employee
NXP Employee

Hi Thom,

The size of the elf file contains much symbolic debugger information and isn't a direct correlation of the actual binary image size.

To find that out either look at the *.map file that is generated or in the project Properties do the following:

C/C++ Build->Settings->Toolchains now check Print size.

Output after compile will look like:

'Invoking: Cross ARM GNU Print Size'

arm-none-eabi-size --format=berkeley "test_twrk65f180m_pe.elf"

   text   data    bss    dec    hex filename

  11212    120   2212  13544   34e8 test_twrk65f180m_pe.elf

'Finished building: test_twrk65f180m_pe.siz'

' '

This does not contain the symbolic information.

Regards,

David

View solution in original post

0 Kudos
3 Replies
604 Views
DavidS
NXP Employee
NXP Employee

Hi Thom,

The size of the elf file contains much symbolic debugger information and isn't a direct correlation of the actual binary image size.

To find that out either look at the *.map file that is generated or in the project Properties do the following:

C/C++ Build->Settings->Toolchains now check Print size.

Output after compile will look like:

'Invoking: Cross ARM GNU Print Size'

arm-none-eabi-size --format=berkeley "test_twrk65f180m_pe.elf"

   text   data    bss    dec    hex filename

  11212    120   2212  13544   34e8 test_twrk65f180m_pe.elf

'Finished building: test_twrk65f180m_pe.siz'

' '

This does not contain the symbolic information.

Regards,

David

0 Kudos
603 Views
thom_nic
Contributor II

Thanks David.  I was confused because the 'release' binaries are almost the same size but clearly you're right, after hitting a bug in pyOCD I was able to load the .elf via GDB.

Is there a straightforward way to generate .bin files from the .elf?

EDIT I think I found the relevant bits in CMakeLists.txt:

# BIN AND HEX

ADD_CUSTOM_COMMAND(TARGET bubble_level_ftm POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex ${EXECUTABLE_OUTPUT_PATH}/bubble_level_ftm.elf ${EXECUTABLE_OUTPUT_PATH}/bubble_level_ftm.hex)

ADD_CUSTOM_COMMAND(TARGET bubble_level_ftm POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary ${EXECUTABLE_OUTPUT_PATH}/bubble_level_ftm.elf ${EXECUTABLE_OUTPUT_PATH}/bubble_level_ftm.bin)

0 Kudos
604 Views
DavidS
NXP Employee
NXP Employee

Hi Thom,

If that works...great!

Alternative is to look at the following great blog:

CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse | MCU on Eclipse

Where is sets the output to S-Record you can set it to hex or binary file generation.

Regards,

David

0 Kudos