On 16/05/2012 17:18, Adam Ford wrote:
> As a followup...
>
> I have also compiled without:
>
> -fdata-sections -ffunction-sections and linked with --no-keep-memory
> -Wl,-gc-sections
>
> Having them on seems to make the code slightly smaller, but not much.

Using these flags will only reduce code size if you have source code (or 
data) that is compiled but never used in the binary.  In most cases, 
that indicates a mistake in the source code or that the source is due 
for a spring clean.  (Some people make more active use of such flags, 
letting them write library-style code modules for re-use in different 
projects, and therefore have good reason for having lots of "unused" code.)

mvh.,

David


>
> adam
> On 05/16/2012 10:14 AM, Adam Ford wrote:
>> I'm sorry for bugging people, and I have Googled this question, but the
>> answers I'm finding are really old and I know there are updates to
>> mspgcc since most of the answers were posted....
>>
>> I am trying to port 3 different programs from IAR to MSPGCC for work.
>> I'm using the latest released version, but 2 of the 3 won't fit even
>> when compiling using optimizations: -mmcu=$(MCU) -g -Os -Wall
>> -fdata-sections -ffunction-sections  and linked with --no-keep-memory
>> -Wl,-gc-sections
>>
>> Does anyone have any ideas how I can further optimize the compiler
>> (other than rewriting - which I've been trying to do)?
>>
>> With an MSP430F149 processor, under IAR, the code compiles and links
>> (Code = 45858, data = 3000, CONST=4935)
>>
>> Under GCC, it won't link because '.rodata won't fit into region rom' and
>> rom overflows by 796 bytes.
>>
>> Examining the Map file shows .rodata is 0x1a66 in size, .text is 0xc240
>> in size, .bss is 0x712
>>
>> Any ideas how to make the libraries or optimizer make smaller code?
>>
>> adam
>>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to