avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Flags to use in Building a Library


From: User Tomdean
Subject: [avr-gcc-list] Flags to use in Building a Library
Date: Tue, 26 Jul 2005 12:20:57 -0700 (PDT)

I have several .o files I most likely will use in every application.
Things like serial_init(), serial_send(), serial_print(), etc.  These
are simple, just a pain to include in every application as source.

I want to make a library to hold all these.  I tried it and have very
strange results.

I have made many libraries with other backends, without problem.

I make the .o files with

# make -DATMEGA8515 clean allrm *.o
avr-gcc -O -pipe -mmcu=atmega8515 -Wall -Os -I../../include -c serial_flush.c
avr-gcc -O -pipe -mmcu=atmega8515 -Wall -Os -I../../include -c serial_init.c
avr-gcc -O -pipe -mmcu=atmega8515 -Wall -Os -I../../include -c serial_print.c
...
avr-ar -cr ../../lib/libasus.a serial_flush.o serial_init.o serial_print.o ...
avr-ranlib ../../lib/libasus.a

And, I build an application with: (line split at \)
make -DATMEGA8515 clean all
rm -f echo.elf echo.o
avr-gcc -O -pipe -mmcu=atmega8515 -Os -I../../include  -c echo.c
avr-gcc -O -pipe -mmcu=atmega8515 -Os -I../../include  \
   -L../../lib -o echo.elf echo.o -lasus
avr-objcopy -j .text -j .data -O ihex echo.elf echo.hex

I do a similar thing on an mc68hc11 project and it works OK.  The
serial_xxx.c code is copied from that project, with _io_ports[...]
changed ot PORTx, etc.

Looking at the output of avr-objdump -x echo.elf, all appears OK.
But, when I try it, something is screwed, most likely with the stack.
There is a jump back to the middle of code.  Strange.  I put
serial_send(x), where x is 'a', 'b',...'r, statements after every line
in the source code.  I see 'a',...'i',a',...,'i'

This does not work.  If I use '-g' it works.

Any ideas?

I can sen the sources and Makefiles, if anyone is interested.

tomdean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]