Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MX220 and LCD
16-05-2012, 05:19 AM,
#11
RE: MX220 and LCD
If you run into size problems, you may want to check this out: http://gcc.gnu.org/onlinedocs/gcc-4.5.3/...ze-Options
The optimizer flag is set in source/Makefile.* with the ELF_FLAGS, -O3 per default.
With the HelloWorld.pde I get this:
-O2: code size: 9040 / 32767 bytes (27% used)
-Os: code size: 8900 / 32767 bytes (27% used)
And with Hannes' example and -O2 it's still good for the MX220:
code size: 12964 / 32767 bytes (39% used)
Reply
16-05-2012, 06:37 AM,
#12
RE: MX220 and LCD
bjoernp,

amazing! That's the kind of solutions I like.

I just compiled my origin code.
O3: 33520 bytes
O2: 12080 bytes

Following your link, I read for -O3:
Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on...
Whatever! Most important is that it works.

You are my hero of the day ;-)

Thanks
Hannes
Reply
16-05-2012, 08:33 AM,
#13
RE: MX220 and LCD
So changing O2 to O3 made the code nearly 3 times bigger!?

John
Reply
16-05-2012, 09:54 PM,
#14
RE: MX220 and LCD
(16-05-2012, 08:33 AM)pingotg Wrote: So changing O2 to O3 made the code nearly 3 times bigger!?

John

Yes. Quite a big hunk.

From the manual:
Quote:-O2
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff.
...

-O3
Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload, -ftree-vectorize and -fipa-cp-clone options.
...

-Os
Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.

I'd say, O2 or Os are a better fit for most cases.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)