code optimization.

hemant undale
Wed Aug 7 06:01:00 GMT 2013

Hi to All,
My current compiler settings are 
arm-none-eabi-gcc -Wall -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
-fshort-double-mcpu=cortex-m4 -mthumb -Qn -Os -finstrument-functions
-mlong-calls -c temp.c -o temp.o
so on for temp1, temp2... Etc
I am compiling multiple C files.
and linker settings are
ld -r temp.o -o one.o
so on for temp1, temp2... Etc
I am linking multiple .O files.
Also I am using linker script i.e link.txt (invoked externally as below)
ld -cref -Map map.txt -S -T link.txt -temp.o -lm -lc -lgcc
arm-none-eabi-gcc -Wall sample.o -O Firmware.abs
Now, At output I get .abs file of 140KB.
My Questions are
1.	How to optimize (reduce size of .abs) by using complier or linker
specific options??????
2.	There are Number of NOT used global variables and Blank Function
Calls in my C files (NO Dead Code!!!!). Is it possible to perform some link
time optimization??????????
3.	Please Elaborate as I am new to this, I have referred sites, gcc
help and tried some "lto" options but NO reduction is size!!!!!!!!!!!!!
4.	I also tried using 
But It has INCREASED my firmware.abs file size from KB to MB (yes it is
MB!!!!) I also wondered WHY??????????
I am using codesourcery arm toolchain evaluation.
It has gcc version 4.5.2 

Thanks for patiently reading my question.

More information about the Gcc-help mailing list