Re: [arm-gnu] Image size reduction with linker optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Image size reduction with linker optimization



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Daniel Jacobowitz wrote:
> On Fri, Feb 06, 2009 at 08:37:14AM +1100, James wrote:
>>> * Link with --gc-sections.  This will only help.
>> With this alone, I get infinitely small code that unfortunately
>> doesn't run.  For some reason the linker thought it was cool to
>> remove *all* text, bss and data sections.
>
> Normally this means you did not tell the linker about the entry
> point of your program.  Try adding a -Wl,-e,SYMBOLNAME if the entry
> point is not named _start, or using KEEP in the linker script to
> ensure the reset vector is not discarded.
>
>> Optimisations caused a heap of warnings to be generated by the ST
>> FWLib, as in;
>>
>> ../../FWLib/library/src/stm32f10x_tim.c:368: warning:
>> dereferencing type-punned pointer will break strict-aliasing
>> rules
>>
>> Adding -fno-strict-aliasing ignored the warning, but is this a
>> good idea?  Or should ST be changing their FWLib source?
>
> ST should fix it, but using the flag is generally a safe
> workaround.
>


Michael,

I am also using CodeSourcery G++ with stm32 micros.  I've attached the
startup code I use, as well as my linker scripts.  You'll probably
have to change them unless you are using the same density devices as I
am.  I tried to follow the CodeSourcery design.  Hopefully STM32 will
be supported out of the box soon.

I'm not using ST's firmware library, but it works with this startup
code.  The only thing you would have to change would be the ISR names,
as I followed the CS naming convention, and not ST's.

If I may ask, how are you flashing / debugging your board?  I have a
KEIL uLink2, and use the CodeSourcery sprite for debugging in Eclipse.

Best Regards,
Mark Deneen
Saucon Technologies
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
iD8DBQFJi2OBtf95hArmCUURAupSAJ0bvDCiDiHA8kjqQ2YyLp31tWfyqACdEXYg
ZSQ1sKJk078JoFxz+RGyEgA=
=ua4T
-----END PGP SIGNATURE-----

Attachment: stm32_cs.zip
Description: Binary data