gcc Compile Speedup
C Technologies has conveniently provided a fully configured development environment
based on the gcc software.
There appears to be a bug in the gcc compiler which causes the compiles
to be very slow after the source code reaches a certain size.
On my system, it was taking 4 seconds per compile until the source code reached
about 750 lines, and the object code passed 18K.
Then compiles began to take over 10 minutes. In fact, I thought the compiler had hung,
but when I discovered that others had seen a similar problem, I allowed it to complete
the compile and everything was fine in the finished .car module.
Upon investigation, it turns out that the problem lies in the optimization step of
the compiler. If optimization is turned off, compiles will be almost instantaneous
on a P3 class machine. But, of course, the object module will be slightly larger.
The current make file tells the compiler to compile for minimum size.
How to overcome slow compiles:
Make a copy of rules.mak found in C:\Program Files\C Technologies\C-Pen SDK\Aripos\tools
Call it: rules.qik
Edit rules.qik:
In line 52 (CFLAGS ...) change the
-oS (col 143) to -o0
(that is the number zero)
In your project makefile, change the last line
from: include ../../tools/rules.mak
to: include ../../tools/rules.qik
Now, when you type make, you will be compiling without the size optimization. When you have completed
your project, change your makefile back to the original, and wait the ten minutes
required for a size optimized object module.
I understand that there is a better fix for this problem which involves
changing the heap size in the configuration of the arm-elf-gcc compiler, but
I do not know how to do that. I would appreciate hearing from anyone who can help
with a more elegant solution to this problem.
|