I wrote simple program to print "Hi how are you" 100,000 times and compiled on Redhat Linux.
test.c
main() { printf("Hi How are you"); . . . /*Repeated printf for more one hundread thousand times */ }
then
did #make test cc test.c -o test
this command did NOT exit for more than half hour, later I did control-c to exit.
Please tell me why I can't compile this long code?, what would be the best approach other than splitting the code.
thanks kishuri
Didn't find your answer? Ask the community — no account required.
K
kishuri
I know your embedded world is different. However, every embedded systems do need a compiler and an operating system. This Question falls under these two sections of embedded systems. Are not there any better way to generate code, why does it fail or take longer when compiling huge function like here main()? How long your embedded OS take to compile this. If fails, how can you fix it? Think over it before questioning others. thanks, kishuri
W
Wolfgang Denk
Actually this is an indication of extreme low resources on the development host. I just tested this on a standard PC running Linux:
bash$ time gcc -o foo foo.c
real 0m13.948s user 0m12.880s sys 0m0.230s
As you can see, it took just 14 seconds to compile your program.
And this is no high-end machine at all. It's a standard AMD XP processor at 2083 MHz with 512 MB RAM.
I have not the slightest idea where you get such a number from. To build a medium-sized project (U-Boot) with some 350k+ lines of C code (_not_ counting the header and assembler files) takes less than 20 seconds on an even slower machine (AMD Athlon at 1400 Mhz).
Your number is approx. 600 times too big!
Wolfgang Denk
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Web: www.denx.de
"The pathology is to want control, not that you ever get it, because
of course you never do." - Gregory Bateson
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.