Hi Arvind,

I completely agree with the comment from David, I would also recommend do
use use "-g -Os" by default and "-g -O1" if you struggle while debugging.

Regarding the binary size, I have recently played around with the TI/RedHat
GCC release and the results are IMO really really bad (standard library??):

 
==============================================================================||

    ||||                        CODE SEGMENT SIZE    (in kB)
             ||||

||||============================================================================||||
  BENCHMARK NAME    |    COMPILER VERSION    |   -Os   |   -O2   |
-O3   
||||=====================+========================+=========+=========+=========||||
Dhrystone v2.1      |   mspgcc     v4.7.2    |   5.81  |   5.79  |
5.81  |||| (common version)    |   msp430-elf v4.9.1    |  36.60  |
37.10  |  37.11
||||---------------------+------------------------+---------+---------+---------||||
Dhrystone v2.1      |   mspgcc     v4.7.2    |   5.70  |   5.67  |
5.69  |||| (MCU adapted)       |   msp430-elf v4.9.1    |  36.61  |
37.08  |  37.10
||||---------------------+------------------------+---------+---------+---------||||
CoreMark v1.0       |   mspgcc     v4.7.2    |  10.48  |  11.26  |
16.22  |||| (official version)  |   msp430-elf v4.9.1    |  41.43  |
42.43  |  49.24  ||
==============================================================================


More about that in this thread:
https://groups.google.com/forum/?fromgroups#!topic/discuss_openmsp430/W-22HePtJsQ

Cheers,
Olivier

On Thu, Feb 19, 2015 at 9:13 AM, David Brown <da...@westcontrol.com> wrote:

> On 19/02/15 06:10, Arvind Padmanabhan wrote:
> > Hi Folks,
> >
> > My friend has Code Composer Studio (CCS) license. He compiled without
> > debugging and no optimization. Code size (ROM) is only 35 KB. This is
> > good for MSP430G2955 that has 56 KB of Flash.
>
> There is no standard for how much optimisation a compiler does -
> settings are only relative to each other in a given compiler.  Sometimes
> you can compare /types/ of optimisation pass between compilers, but even
> then the details vary wildly.
>
> When gcc is used with -O0 (or no optimisation flags), it produces blind
> statement-at-a-time interpretation of the code that is very big, very
> slow, and very hard to follow.  Apart from some tests of the compiler
> itself, it is pretty much useless.
>
> With -O1, you get little in the way of code reordering and no inlining
> without the "inline" keyword, but variables go in registers and there is
> some basic simplification.  If you want the easiest single-step
> debugging, "-O1 -g" works much better than "-O0 -g" because you have
> clearer and more logical assembly code.
>
> With -Os (or -O2), you get a lot more re-arrangement of code, which can
> give smaller and faster results but sometimes means that single-stepping
> jumps around, and breakpoints don't always appear where you expect them
> (a trick here is to make artificial volatile variables, and put
> breakpoints on lines that use them).
>
> -O3 and other options are a more specialised, and can sometimes make
> code faster, sometimes slower.
>
> With CCS, it's "no optimisation" setting would rate around 0.8 on gcc's
> scale, while it's fullest optimisations are around 1.8 (varying by the
> actual code in use, of course).
>
>
> >
> > I compiled the same code using mspgcc, I get the following (-g -Oo):
>
> So use "-g -O1" or "-g -Os".
>
> Unless you have something you need to step through carefully (in which
> case use "-g -O1", it is best to use exactly the same settings ("-g
> -Os") all the time - that way you are debugging what you are going to
> release, and releasing what you have debugged.
>
> >
> <snip>
> > If I remove -g option and optimize for size (-Os), then I can get it
> > down to 32 KB. Problem is I can't do debugging in this case. Am I
> > missing some trick or is CCS compiler doing something smart?
> >
> > Regards, Arvind
> >
> >
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to