Making small executables from arm-elf-gcc

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi.
I'm trying to compile this program:
int main()
{
        int i, j;
        for (i = 0; i < 100; i++)
        {
                j = j+1;
        }
        return 0;
}

arm-elf-gcc -s -Os -o test.elf test.c produces a program with the
following output from arm-elf-size:
   text    data     bss     dec     hex filename
   5484    1872     184    7540    1d74 test.elf

Also, tracing the linking: (arm-elf-gcc -s -Os -Wl,--trace -o test.elf
test.c)
/export/home1/jamesl/arm/arm-elf/bin/ld: mode armelf
/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/crtbegin.o
/export/home1/jamesl/arm/arm-elf/lib/crt0.o
/tmp/cc9r4g2Q.o
(/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)__main.o
(/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_exit.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)atexit.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)exit.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)impure.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)malloc.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)mallocr.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)memset.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)mlock.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)sbrkr.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)syscalls.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)errno.o
(/export/home1/jamesl/arm/arm-elf/lib/libc.a)freer.o
(/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_udivsi3.o
(/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_dvmd_tls.
o
/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/crtend.o

Is there anyway to prevent all these calls?
5484 bytes of code and 1872 bytes of data for a small program like that
is crazy!

I suspect the problem is the _exit() call in crt0.S

Does anyone have a workaround for this.
I'm using newlib-1.8.1 as my libc.

Thanks.

Please CC me for I"m not subscribed to the list.

--James Lamanna

Re: Making small executables from arm-elf-gcc

Quoted text here. Click to load it

Yes.

Make your own startup module and instruct the linker to ignore the default
startup code. The bulk is coming in due to the startup modules crtbegin.o
and crt0.o.

I'm using a module to create an ARM AIF header to the executable and do the
necessary initialisation for the C runtime. It needs also a tailored linker
script (which is needed for stand-alone code anyway).

BTW, you ought to get a compiler warning about uninitialised variable 'j'.

In my experience, -O2 produces code best suited for embedded use.

HTH

Tauno Voipio
tauno voipio @ iki fi




Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

Well, I wrote a book about it, does that help? ;)
Seriously, email me privately and I'll dig into my backups and send
you the code (Monday).

Quoted text here. Click to load it

All the I/O is memory mapped. You just coerce a pointer into
containing the correct address. The sample source I'll send you
illustrates it simply.

Re: Making small executables from arm-elf-gcc

Quoted text here. Click to load it

There seems to be a social request for a very simple ARM board, e.g. an
AT91R40008 with a single Flash chip (e.g. AM29DL163) , crystal, RS-232
buffers, reset chip and connectors for the PIO and JTAG pins.

I could provide a draft schematic, if somebody is interested to make the
thing.

Tauno Voipio
tauno voipio @ iki fi




Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

I've done a lot of PCB designs before, so I could make up the PCB
design and everything, and then I could release it to whoever wants it
and give them the names of a few reasonably priced PCB-manufacture
companies.

Also, like one of the previous posters, I was looking to step way up
from a Atmel AVR. I'm looking at the AT91s, but also there is a new
chip coming out from TI, the TMS320F281x series. Pretty fast chip, for
about $20 each. Problem is you have to pay for development tools,
etc....

Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

I recommended the AT91EB40 in my book, for that specific reason. It
was $179 at the time (it's now more expensive!). It has been
superseded by the EB40A, which costs $198.00 at Digi-Key (cat
#AT91EB40A-ND). Very reasonably priced kits, I highly recommend them.

Of course, it is almost trivial to make up a simple demo board for
these cheap ARMs. Personally I'd like to make a little board with a
Cirrus EP7312 or Sharp LH79520, a socket for a DIP flash chip, and a
socket for a standard RAM DIMM, and everything else brought out to
headers. The production cost of such an item would be about $100-$120
(in tiny quantity). But I never seem to find time to sit down and
finalize such a project.

Oh, by the way: also look at <http://www.earthlcd.com/marmalade.htm ,
but it still doesn't appear to be shipping yet and there's no
guarantee as to support/availability. So the EB40A is still a safer
bet.

Re: Making small executables from arm-elf-gcc
I searched on the Atmel website and found a few different AT91 eval boards
like AT91EB42, AT91EB55, AT91EB63.

Does someone know the differences ?
What are the prices of them ? Perhaps buying is cheaper than making it
ourself
(especially if you add to get all the parts, perhaps from different
distributors ?).

Can someone point me to a (up-to-date) website,
where i can download the arm-gcc ?

Greetings,

         Martin



Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

I bought an AT91EB55 and it was about $200 or maybe $250.  You need to
check with distribution or Atmel for pricing.  This stuff can vary and
they obsolete boards from time to time.  

Quoted text here. Click to load it

I believe different CPU chips.  I know the AT91EB55 uses the AT91M55800A
which has a lot of IO functions on chip.  


Quoted text here. Click to load it

Building your own board is a PITA.  Some of the more commone boards like
the EB40 are defacto standards with a lot of third party support like
board support packages for OS, etc.  

Quoted text here. Click to load it

Try this link...

http://www.sharpsma.com/sma/Products/mcu_soc/Arm-Bluestreak-Library.htm#TOF

You will have to register.  I normally use a yahoo account for this sort
of thing.  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

You can try mine, of course ;) My goal is to get in the top 25,000
selling SKUs on amazon, and I've got a long way to go yet (currently
#70,711 - up a long way from where I started at 2,000,000th!). But at
least I outsell bulk packs of Oberto beef jerky, and also such
memorable tomes as "DB2 Universal Database for OS/390: An Introduction
to DB2 for OS/390 Version 7" and "Squids Will Be Squids: Fresh Morals,
Beastly Fables".

I have made the sourcecode for the book example projects available at
http://www.zws.com/downloads/sourcecode.tar.gz - this source is
intended for the EB40 but should easily be adaptable to the 40A. I
have NOT yet analyzed exactly what would need to be changed (I don't
own an EB40A) so please don't ask :)

(I haven't linked this file on zws.com yet; I'll do that when I get
time to write some decent text; patience!).

Re: Making small executables from arm-elf-gcc
Quoted text here. Click to load it

Stupid! The URL is actually:

http://www.zws.com/publications/downloads/sourcecode.tar.gz

Sorry, all!

Re: Making small executables from arm-elf-gcc

Quoted text here. Click to load it

Dang -- might have to take a short trip at lunchtime tomorrow. Thanks
for the pointer, looks like a good hack (in the original sense).

--
Rich Webb   Norfolk, VA

Re: Making small executables from arm-elf-gcc
Hello,

Quoted text here. Click to load it
S3C4510B

Great idea ! Can you give me the manufacturer and perhaps complete name of
this part ? I am from Germany and want to try to get it in Germany.

Do someone know of equivalent things containing an ARM processor
and flash memory ?

Greetings,

         Martin (mailto:newsgroup snipped-for-privacy@clibb.de)





Re: Making small executables from arm-elf-gcc

: Great idea ! Can you give me the manufacturer and perhaps complete name of
: this part ? I am from Germany and want to try to get it in Germany.

: Do someone know of equivalent things containing an ARM processor
: and flash memory ?

Item number 290331
Cable/DSL Broadband Router w/4 port 10/100Mbps Switch

Direct Link:
http://www.compusa.com/products/product_info.asp?product_code29%0331&pfp=BROWSE

You can order it online with the link above.

--
Greg Holdren
greg <dot> holdren <at> <initials of company> <dot> com

Site Timeline