how to reduce executable compiled file

35 views
Skip to first unread message

Luca Cinquepalmi

unread,
Apr 3, 2012, 11:51:55 AM4/3/12
to rtems...@rtems.org
Hi all,
I'm new of the list and I have a simple question. I compiled a simple
"Hello World" c code
with sparc-rtems-gcc, but the generated executable is about 3MB, so much
for my use...
I don't know why the executable file is so large... How can I reduce its
size?
Thank you

Luca
_______________________________________________
rtems-users mailing list
rtems...@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-users

Rhenzo Losso

unread,
Apr 3, 2012, 12:04:18 PM4/3/12
to Luca Cinquepalmi, rtems...@rtems.org
Greetings,

Maybe you can use the sparc-rtems-objdump or sparc-rtems-strip. I'm using RTEMS on arm processor (CSN637 port) and I use arm-rtems-objcopy to transform the arm.exe into arm.bin. It reduce from 2MB to near 147kB.



2012/4/3 Luca Cinquepalmi <cinqu...@planetek.it>



--
Rhenzo Losso
Bacharel em Ciência da Computação - UNESP / São José do Rio Preto

Instituto Tecnológico de Aeronáutica
Praça Marechal do Ar Eduardo Gomes, no. 50 - Sala 253 - Projeto ITASAT
Vila das Acácias
12228-900 Sao Jose dos Campos, SP, Brazil
+55 012 3947-6903 (Sala do ITA)

Luca Cinquepalmi

unread,
Apr 3, 2012, 12:11:24 PM4/3/12
to Rhenzo Losso, rtems...@rtems.org
In  my Makefile I also use these commands:

sparc-rtems-strip $@.exe
sparc-rtems-objcopy --remove-section=.comment $@.exe


but the final .exe file is always large, about 300KB from the original 3MB.
Should I use other commands? Thanks


Luca Cinquepalmi

unread,
Apr 3, 2012, 12:19:15 PM4/3/12
to Rhenzo Losso, rtems...@rtems.org
Mi viene ridotto solo di qualke byte...:-(

Il 03/04/2012 18.15, Rhenzo Losso ha scritto:
Try to change some argument o sparc-rtems-objcopy such this line below:

"sparc-rtems-objcopy -O binary name_of_source_ exe name_of_binary.bin"

that  is the "same" line I use on my ARM, excpet it arm-rtems-objcopy not sparc-rtems-objcopy.



2012/4/3 Luca Cinquepalmi <cinqu...@planetek.it>

Luca Cinquepalmi

unread,
Apr 3, 2012, 12:20:10 PM4/3/12
to Rhenzo Losso, rtems...@rtems.org
Sorry! I answered in Italian:-)
It only reduce my exe file of some hundreds of bytes:-(


Il 03/04/2012 18.15, Rhenzo Losso ha scritto:
Try to change some argument o sparc-rtems-objcopy such this line below:

"sparc-rtems-objcopy -O binary name_of_source_ exe name_of_binary.bin"

that  is the "same" line I use on my ARM, excpet it arm-rtems-objcopy not sparc-rtems-objcopy.



2012/4/3 Luca Cinquepalmi <cinqu...@planetek.it>
In  my Makefile I also use these commands:

Joel Sherrill

unread,
Apr 3, 2012, 12:43:11 PM4/3/12
to Rhenzo Losso, rtems...@rtems.org
Try sparc-rtems4.xx-size *.exe

The size can vary enormously based upon what you
are doing in application space.

--joel

On 04/03/2012 11:33 AM, Rhenzo Losso wrote:
I just made this test some right now on BSP SIS.

sparc-rtems-strip -s executable_name.exe -o strip-executable_name.exe

It was reduced a lot. from #MB to 140kB. After this I turn into binary.

sparc-rtems-objcopy -O binary strip-executable_name.exe final-binary-name.bin



2012/4/3 Luca Cinquepalmi <cinqu...@planetek.it>


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.s...@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

Reply all
Reply to author
Forward
0 new messages